当前位置: 首页>>代码示例>>C#>>正文


C# ManagementObject.GetPropertyValue方法代码示例

本文整理汇总了C#中System.Management.ManagementObject.GetPropertyValue方法的典型用法代码示例。如果您正苦于以下问题:C# ManagementObject.GetPropertyValue方法的具体用法?C# ManagementObject.GetPropertyValue怎么用?C# ManagementObject.GetPropertyValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Management.ManagementObject的用法示例。


在下文中一共展示了ManagementObject.GetPropertyValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: EnterLicense_Load

 private void EnterLicense_Load(object sender, EventArgs e)
 {
     ManagementClass mc = new ManagementClass("Win32_NetworkAdapterConfiguration");
     ManagementObject disk = new ManagementObject("win32_logicaldisk.deviceid=\"c:\"");
     disk.Get();
     string temp = Des.EncryptDES(disk.GetPropertyValue("VolumeSerialNumber").ToString(), Des.ConstKey);
     tempStr = Des.EncryptDES(Des.EncryptDES(disk.GetPropertyValue("VolumeSerialNumber").ToString(), Des.ConstKey), Des.ConstKey);
     this.txtOnlyMsg.Text = temp.Trim();
     this.txtLicense.Text = DealXml.ReadSysConfig("appSettings", "license");
 }
开发者ID:Maginx,项目名称:MallProject,代码行数:10,代码来源:EnterLicense.cs

示例2: DisplayResourcePool

        DisplayResourcePool(
            ManagementObject pool)
        {
            Console.WriteLine("Msvm_ResourcePool:");

            Console.WriteLine("\tPoolID: {0}", pool.GetPropertyValue("PoolID"));
            Console.WriteLine("\tInstanceID: {0}", pool.GetPropertyValue("InstanceID"));
            Console.WriteLine("\tResourceType: {0}", pool.GetPropertyValue("ResourceType"));
            Console.WriteLine("\tResourceSubtype: {0}", pool.GetPropertyValue("ResourceSubType"));
        }
开发者ID:dhanzhang,项目名称:Windows-classic-samples,代码行数:10,代码来源:MsvmResourcePool.cs

示例3: GetDiskVolumeSerialNumber

 //获取硬盘卷标号
 public static string GetDiskVolumeSerialNumber()
 {
     ManagementClass mc = new ManagementClass("win32_NetworkAdapterConfiguration");
     ManagementObject disk = new ManagementObject("win32_logicaldisk.deviceid=\"c:\"");
     disk.Get();
     return disk.GetPropertyValue("VolumeSerialNumber").ToString();
 }
开发者ID:huaminglee,项目名称:yousoftbath,代码行数:8,代码来源:RegisterForm.cs

示例4: CService

 /// <summary>
 /// Initializes a new instance of TaskManager.CService class to the value of System.ServiceProcess.ServiceController object.
 /// </summary>
 /// <param name="Srvc">Object of System.ServiceProcess.ServiceController to initialize TaskManager.CService object.</param>
 public CService(ServiceController Srvc)
 {
     Name = Srvc.ServiceName;
     Description = Srvc.DisplayName;
     Status = Srvc.Status;
     ManagementObject MO = new ManagementObject(@"Win32_service.Name='" + Srvc.ServiceName + "'");
     Id = Int32.Parse(MO.GetPropertyValue("ProcessID").ToString());
 }
开发者ID:subTee,项目名称:Task-Manager,代码行数:12,代码来源:CService.cs

示例5: GetDiskVolumeSerialNumber

        /// <summary>
        /// 取得设备硬盘的卷标号
        /// </summary>
        /// <returns></returns>
        private string GetDiskVolumeSerialNumber() {
            try {
                ManagementClass mc = new ManagementClass("Win32_NetworkAdapterConfiguration");
                ManagementObject disk = new ManagementObject("win32_logicaldisk.deviceid=\"c:\"");
                disk.Get();
                return disk.GetPropertyValue("VolumeSerialNumber").ToString();
            } catch {
                return "unknow";
            } finally {

            }
        }
开发者ID:hsb0307,项目名称:Nut.NET,代码行数:16,代码来源:DefaultMachineCodeProvider.cs

示例6: IsThisExecutable

 private static bool IsThisExecutable(ManagementObject mo)
 {
     var path = mo.GetPropertyValue("PathName").ToString();
     return path.Contains(Assembly.GetEntryAssembly().Location);
 }
开发者ID:drewburlingame,项目名称:MultiCommandConsole,代码行数:5,代码来源:ServicesRepository.cs

示例7: getVolumnSerial

        /// <summary>
        /// ȡӲ�����к�
        /// </summary>
        /// <returns></returns>
        private string getVolumnSerial()
        {
            string serial;
            try
            {
                System.Management.ManagementObject disk = new System.Management.ManagementObject("win32_logicaldisk.deviceid=\"c:\"");
                disk.Get();
                //ȡ�������
                System.Net.IPHostEntry myHost = new System.Net.IPHostEntry();
                myHost = System.Net.Dns.GetHostByName(System.Net.Dns.GetHostName());
                string computername  = myHost.HostName.ToString().Trim();
                computername = "";

                serial=disk.GetPropertyValue("VolumeSerialNumber").ToString();
                return serial;
            }
            catch
            {
                return "24F779C7";
            }
        }
开发者ID:jquery2005,项目名称:GMIS,代码行数:25,代码来源:CCommonInfo.cs

示例8: GetVolumeID

 public string GetVolumeID()
 {
     ManagementObject managementObject = new ManagementObject("win32_logicaldisk.deviceid=\"c:\"");
     string result;
     try
     {
         managementObject.Get();
         result = managementObject.GetPropertyValue("VolumeSerialNumber").ToString();
         return result;
     }
     catch
     {
     }
     result = "ABC";
     return result;
 }
开发者ID:wangshu,项目名称:NY_HACK,代码行数:16,代码来源:clsMe.cs

示例9: DisplayPoolResourceAllocationSettingData

 DisplayPoolResourceAllocationSettingData(
     ManagementScope scope,
     ManagementObject pool)
 {
     using (ManagementObject rasd =
         MsvmResourceAllocationSettingData.GetAllocationSettingsForPool(
             scope,
             pool.GetPropertyValue("ResourceType").ToString(),
             pool.GetPropertyValue("ResourceSubType").ToString(),
             pool.GetPropertyValue("PoolId").ToString()))
     {
         DisplayPoolResourceAllocationSettingData(rasd);
     }
 }
开发者ID:dhanzhang,项目名称:Windows-classic-samples,代码行数:14,代码来源:MsvmResourceAllocationSettingData.cs

示例10: ServiceStartupType

 static string ServiceStartupType(string ServiceName)
 {
     string objPath = string.Format("Win32_Service.Name='{0}'", ServiceName);
      using (ManagementObject service = new ManagementObject(new ManagementPath(objPath)))
      {
          try
          {
             return (string)service.GetPropertyValue("StartMode");
          }
          catch
          {
              return string.Empty;
          }
      }
 }
开发者ID:spokanedj,项目名称:remotepotato,代码行数:15,代码来源:ServiceManager.cs

示例11: Update

 public void Update(ManagementObject proc)
 {
     this.PreviousProcTime = this.CurrentProcTime;
     this.PreviousTimeStamp = this.CurrentTimeStamp;
     this.Name = Convert.ToString(proc.GetPropertyValue(PROC_NAME));
     this.CurrentProcTime = Convert.ToInt64(proc.GetPropertyValue(PROC_TIME));
     this.CurrentTimeStamp = Convert.ToInt64(proc.GetPropertyValue(TIME_STAMP));
     this.CurrentMemory = Convert.ToInt64(proc.GetPropertyValue(WorkingSet()));
     this.ProcessId = Convert.ToInt32(proc.GetPropertyValue(PROC_ID));
     this.CalculateProcPercent();
 }
开发者ID:mistic100,项目名称:Rainmeter-TopProcesses,代码行数:11,代码来源:Performance.cs

示例12: CountQueueMessages

			private void CountQueueMessages(QSetQueueItem queueItem)
			{				
				//first of all, ensure we have a node to work with
				QueueItemListViewItemPair itemPair = null;
				if (_itemPairHashTable.ContainsKey(queueItem.ID))
					itemPair = (QSetMonitorWorker.QueueItemListViewItemPair)_itemPairHashTable[queueItem.ID];
				else
				{
					//TODO create icon
					itemPair = new QueueItemListViewItemPair(queueItem, new ListViewItem(queueItem.Name, (int)Images.IconType.Queue));					
					for (int subItemCounter = 0; subItemCounter < _COLUMNS; subItemCounter ++)
						itemPair.ListViewItem.SubItems.Add(string.Empty);
					_itemPairHashTable.Add(itemPair.QSetQueueItem.ID, itemPair);
					
                    Action x = delegate { _monitorListView.Items.Add(itemPair.ListViewItem); };
                    _monitorListView.Invoke(x);
				}
				
				ManagementObject counter = null;
				try
				{										
					counter = new ManagementObject(String.Format("Win32_PerfRawdata_MSMQ_MSMQQueue.name='{0}'", itemPair.QSetQueueItem.Name));
					counter.Get();			
					uint outgoingMessageCount = Convert.ToUInt32(counter.GetPropertyValue("MessagesInQueue"));
                    uint outgoingBytes = Convert.ToUInt32(counter.GetPropertyValue("BytesInQueue"));

                    Action herewegoagain = () =>
                        {
                            if (itemPair.ListViewItem.SubItems[(int)SubItemList.OutgoingMessageCount].Text != outgoingMessageCount.ToString()) //note: only do if necessary, to avoid flicker
                                itemPair.ListViewItem.SubItems[(int)SubItemList.OutgoingMessageCount].Text = outgoingMessageCount.ToString();

                            if (itemPair.ListViewItem.SubItems[(int)SubItemList.OutgoingBytes].Text != outgoingBytes.ToString()) //note: only do if necessary, to avoid flicker
                                itemPair.ListViewItem.SubItems[(int)SubItemList.OutgoingBytes].Text = outgoingBytes.ToString();
                        };


                    _monitorListView.Invoke(herewegoagain);
				}
				catch
				{
					//exception will occur when cannot get access to performance counters
				}
				finally
				{
					if (counter != null)
						counter.Dispose();
				}
			}
开发者ID:modulexcite,项目名称:QSet,代码行数:48,代码来源:QSetMonitor.cs

示例13: ServiceStartupType

 static string ServiceStartupType(string ServiceName)
 {
     string objPath = string.Format("Win32_Service.Name='{0}'", ServiceName);
      using (ManagementObject service = new ManagementObject(new ManagementPath(objPath)))
      {
          try
          {
              string value = (string)service.GetPropertyValue("StartMode");
              return value;  // Auto, Manual or Disabled  (note Auto not Automatic)
          }
          catch
          {
              return string.Empty;
          }
      }
 }
开发者ID:madhatterpa,项目名称:RemotePotatoLiveTV,代码行数:16,代码来源:ServiceManager.cs

示例14: GetOSServicePack

 private string GetOSServicePack(string servicePack, ManagementObject managementObject)
 {
     int servicePackNumber = Convert.ToInt32(managementObject.GetPropertyValue("ServicePackMajorVersion"));
     if (servicePackNumber != 0)
     {
         servicePack = $"Service Pack {servicePackNumber}";
     }
     return servicePack;
 }
开发者ID:mRemoteNG,项目名称:mRemoteNG,代码行数:9,代码来源:Startup.cs

示例15: Instantiate80211

 private static LinkSAP80211 Instantiate80211(ManagementObject linkSap80211MO, ushort fromMIHFPort, System.Net.IPAddress mihAddr)
 {
     return new LinkSAP80211((string)linkSap80211MO.GetPropertyValue("GUID"), fromMIHFPort, mihAddr);
 }
开发者ID:ATNoG,项目名称:ODTONE,代码行数:4,代码来源:BootUp.cs


注:本文中的System.Management.ManagementObject.GetPropertyValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。