编程语言

img ncowboy

使用WMI获取远程机器操作系统的详细信息

发表于2004/9/26 19:13:00  3702人阅读

分类: .net

代码主题部分的OperatingSystem类,是使用工具(Management (WMI) Extensions for Visual Studio .NET 2003 Server Explorer http://www.microsoft.com/downloads/details.aspx?displaylang=zh-cn&FamilyID=62d91a63-1253-4ea6-8599-68fb3ef77de1)生成的。

using System;
using System.Management;
using System.ComponentModel;
using System.Collections;
using System.Globalization;
using System.ComponentModel.Design.Serialization;
using System.Reflection;

public class Program
{
 static void Main(string[] args)
 {
  try
  {
   ConnectionOptions co = new ConnectionOptions();
   co.Username = "administrator";
   co.Password = "lacl";
   System.Management.ManagementScope ms = new System.Management.ManagementScope("////"+"192.168.103.2"+"//root//cimv2", co);

   System.Management.ObjectQuery oq = new System.Management.ObjectQuery("SELECT * FROM Win32_OperatingSystem");

   ManagementObjectSearcher query1 = new ManagementObjectSearcher(ms,oq);
   ManagementObjectCollection queryCollection1 = query1.Get();
   foreach(ManagementObject mo in queryCollection1)
   {
    OperatingSystem os=new OperatingSystem(mo);
    Console.WriteLine(os.Name);
   }
  }
  catch(Exception ee)
  {
   Console.WriteLine("发生了一个异常。");
   Console.WriteLine(ee.Message);
  }
 }
}

   
   
 // ShouldSerialize<PropertyName> 函数是 VS 属性浏览器用来检查具体某个属性是否必须序列化的函数。为所有 ValueType 属性(类型为 Int32、BOOL 等的属性,不能将它们设置为空)添加这些函数。这些函数使用 Is<PropertyName>Null 函数。这些函数还在属性的 TypeConverter 实现中用来检查属性的 NULL 值,以便在 Visual Studio 中进行拖放操作时可以在属性浏览器中显示空值。
 // 函数 Is<PropertyName>Null() 用于检查属性是否为 NULL。
 // 为可为空值的读/写属性添加 Reset<PropertyName> 函数。这些函数由 VS 设计器用来在属性浏览器中将属性设置为 NULL。
 // 添加到 WMI 属性的类的每个属性都有定义其在 Visual Studio 设计器中的行为以及定义要使用的 TypeConverter 的特性集。
 // DateTime 转换函数 ToDateTime 和 ToDmtfDateTime 添加到类以将 DMTF 日期时间转换为 System.DateTime (或相反)。
 // 为 WMI 类生成的早期绑定类。Win32_OperatingSystem
 public class OperatingSystem : System.ComponentModel.Component
 {
       
  // 用于保存该类所驻留的 WMI 命名空间的私有属性。
  private static string CreatedWmiNamespace = "ROOT//CIMV2";
       
  // 私有属性,保存创建此类的 WMI 类的名称。
  private static string CreatedClassName = "Win32_OperatingSystem";
       
  // 用于保存由各种方法使用的 ManagementScope 的私有成员变量。
  private static System.Management.ManagementScope statMgmtScope = null;
       
  private ManagementSystemProperties PrivateSystemProperties;
       
  // 基础 LateBound WMI 对象。
  private System.Management.ManagementObject PrivateLateBoundObject;
       
  // 存储类的“自动提交”行为的成员变量。
  private bool AutoCommitProp = true;
       
  // 保存表示实例的嵌入属性的私有变量。
  private System.Management.ManagementBaseObject embeddedObj;
       
  // 所使用的当前 WMI 对象
  private System.Management.ManagementBaseObject curObj;
       
  // 用于指示实例是否为嵌入对象的标志。
  private bool isEmbedded = false;
       
  // 以下是用 WMI 对象初始化类实例的构造函数的不同重载。
  public OperatingSystem() :
   this(((System.Management.ManagementScope)(null)), ((System.Management.ManagementPath)(null)), ((System.Management.ObjectGetOptions)(null)))
  {
  }
       
  public OperatingSystem(string keyName) :
   this(((System.Management.ManagementScope)(null)), ((System.Management.ManagementPath)(new System.Management.ManagementPath(OperatingSystem.ConstructPath(keyName)))), ((System.Management.ObjectGetOptions)(null)))
  {
  }
       
  public OperatingSystem(System.Management.ManagementScope mgmtScope, string keyName) :
   this(((System.Management.ManagementScope)(mgmtScope)), ((System.Management.ManagementPath)(new System.Management.ManagementPath(OperatingSystem.ConstructPath(keyName)))), ((System.Management.ObjectGetOptions)(null)))
  {
  }
       
  public OperatingSystem(System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) :
   this(((System.Management.ManagementScope)(null)), ((System.Management.ManagementPath)(path)), ((System.Management.ObjectGetOptions)(getOptions)))
  {
  }
       
  public OperatingSystem(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path) :
   this(((System.Management.ManagementScope)(mgmtScope)), ((System.Management.ManagementPath)(path)), ((System.Management.ObjectGetOptions)(null)))
  {
  }
       
  public OperatingSystem(System.Management.ManagementPath path) :
   this(((System.Management.ManagementScope)(null)), ((System.Management.ManagementPath)(path)), ((System.Management.ObjectGetOptions)(null)))
  {
  }
       
  public OperatingSystem(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions)
  {
   if ((path != null))
   {
    if ((CheckIfProperClass(mgmtScope, path, getOptions) != true))
    {
     throw new System.ArgumentException("类名不匹配。");
    }
   }
   PrivateLateBoundObject = new System.Management.ManagementObject(mgmtScope, path, getOptions);
   PrivateSystemProperties = new ManagementSystemProperties(PrivateLateBoundObject);
   curObj = PrivateLateBoundObject;
  }
       
  public OperatingSystem(System.Management.ManagementObject theObject)
  {
   if ((CheckIfProperClass(theObject) == true))
   {
    PrivateLateBoundObject = theObject;
    PrivateSystemProperties = new ManagementSystemProperties(PrivateLateBoundObject);
    curObj = PrivateLateBoundObject;
   }
   else
   {
    throw new System.ArgumentException("类名不匹配。");
   }
  }
       
  public OperatingSystem(System.Management.ManagementBaseObject theObject)
  {
   if ((CheckIfProperClass(theObject) == true))
   {
    embeddedObj = theObject;
    PrivateSystemProperties = new ManagementSystemProperties(theObject);
    curObj = embeddedObj;
    isEmbedded = true;
   }
   else
   {
    throw new System.ArgumentException("类名不匹配。");
   }
  }
       
  // 属性返回 WMI 类的命名空间。
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  public string OriginatingNamespace
  {
   get
   {
    return "ROOT//CIMV2";
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  public string ManagementClassName
  {
   get
   {
    string strRet = CreatedClassName;
    if ((curObj != null))
    {
     if ((curObj.ClassPath != null))
     {
      strRet = ((string)(curObj["__CLASS"]));
      if (((strRet == null)
       || (strRet == System.String.Empty)))
      {
       strRet = CreatedClassName;
      }
     }
    }
    return strRet;
   }
  }
       
  // 指向嵌入对象以获取 WMI 对象的系统属性的属性。
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  public ManagementSystemProperties SystemProperties
  {
   get
   {
    return PrivateSystemProperties;
   }
  }
       
  // 返回基础 LateBound 对象的属性。
  [Browsable(false)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  public System.Management.ManagementBaseObject LateBoundObject
  {
   get
   {
    return curObj;
   }
  }
       
  // 对象的 ManagementScope。
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  public System.Management.ManagementScope Scope
  {
   get
   {
    if ((isEmbedded == false))
    {
     return PrivateLateBoundObject.Scope;
    }
    else
    {
     return null;
    }
   }
   set
   {
    if ((isEmbedded == false))
    {
     PrivateLateBoundObject.Scope = value;
    }
   }
  }
       
  /// <summary>
  ///  显示 WMI 对象的提交行为的属性。如果为 true,则 WMI 对象在每次属性修改后都自动保存(即在修改属性后调用 Put())。
  /// </summary>
  [Browsable(false)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  public bool AutoCommit
  {
   get
   {
    return AutoCommitProp;
   }
   set
   {
    AutoCommitProp = value;
   }
  }
       
  // 基础 WMI 对象的 ManagementPath。
  [Browsable(true)]
  public System.Management.ManagementPath Path
  {
   get
   {
    if ((isEmbedded == false))
    {
     return PrivateLateBoundObject.Path;
    }
    else
    {
     return null;
    }
   }
   set
   {
    if ((isEmbedded == false))
    {
     if ((CheckIfProperClass(null, value, null) != true))
     {
      throw new System.ArgumentException("类名不匹配。");
     }
     PrivateLateBoundObject.Path = value;
    }
   }
  }
       
  // 由各种方法使用的公共静态范围属性。
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  public static System.Management.ManagementScope StaticScope
  {
   get
   {
    return statMgmtScope;
   }
   set
   {
    statMgmtScope = value;
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description("BootDevice 属性表示 Win32 操作系统启动的那个磁盘驱动器的名称。/n例如: ////Device//Harddisk0。")]
  public string BootDevice
  {
   get
   {
    return ((string)(curObj["BootDevice"]));
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description("BuildNumber 属性表示操作系统的内部版本号码。可用于比产品发行版本号更精确的版本信息。/n例如: 1381")]
  public string BuildNumber
  {
   get
   {
    return ((string)(curObj["BuildNumber"]));
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description("BuildType 属性表示用于操作系统的内部版本种类。如销售版本和检查版本。")]
  public string BuildType
  {
   get
   {
    return ((string)(curObj["BuildType"]));
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description("Caption 属性为对象的简短文字描述(一行字符串)。")]
  public string Caption
  {
   get
   {
    return ((string)(curObj["Caption"]));
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description("CodeSet 属性表示由操作系统使用的编码页值。编码页包含由操作系统为不同语言翻译字符串的字符表。American National Standards Ins" +
    "titute (ANSI)列出代表定义过的编码页的值。如果操作系统不使用 ANSI 编码页,这个成员就会被设为 0。CodeSet 字符串可用六个字符定义编码页" +
    "的值。/n例如: 1255。")]
  public string CodeSet
  {
   get
   {
    return ((string)(curObj["CodeSet"]));
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description("CountryCode 属性表示由操作系统使用的国家(地区)编码。值是根据国际电话拨号的前缀(还作为 IBM 国家(地区)编码)。CountryCode 字符串可" +
    "使用六个字符定义国家(地区)编码的值。/n例如: 1 代表美国)")]
  public string CountryCode
  {
   get
   {
    return ((string)(curObj["CountryCode"]));
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description("CreationClassName 表示用来创建范例的类别或子类别的名称。当与这个类别的其它主要属性一起使用时,这个属性允许为这个类别及其子类别的所有范例作唯一识" +
    "别。")]
  public string CreationClassName
  {
   get
   {
    return ((string)(curObj["CreationClassName"]));
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description("CSCreationClassName 包含作用域计算机系统的创建类别名称。")]
  public string CSCreationClassName
  {
   get
   {
    return ((string)(curObj["CSCreationClassName"]));
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description("CSDVersion 属性包含一个 null 结尾的字符串,可表示安装在计算机系统上的最新服务包。如果没有安装服务包,该值为 NULL。对于运行 Windows " +
    "95 的计算机系统,这个属性包含提供仲裁有关其它操作系统的信息的一个 null 结尾的字符串。/n例如: Service Pack 3。")]
  public string CSDVersion
  {
   get
   {
    return ((string)(curObj["CSDVersion"]));
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description("CSName 包含作用域计算机系统的名称。")]
  public string CSName
  {
   get
   {
    return ((string)(curObj["CSName"]));
   }
  }
       
  [Browsable(false)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  public bool IsCurrentTimeZoneNull
  {
   get
   {
    if ((curObj["CurrentTimeZone"] == null))
    {
     return true;
    }
    else
    {
     return false;
    }
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description("CurrentTimeZone 表示操作系统从格林威治时间调整的分钟数。数字不是正数、负数就是零。")]
  [TypeConverter(typeof(WMIValueTypeConverter))]
  public short CurrentTimeZone
  {
   get
   {
    if ((curObj["CurrentTimeZone"] == null))
    {
     return System.Convert.ToInt16(0);
    }
    return ((short)(curObj["CurrentTimeZone"]));
   }
   set
   {
    curObj["CurrentTimeZone"] = value;
    if (((isEmbedded == false)
     && (AutoCommitProp == true)))
    {
     PrivateLateBoundObject.Put();
    }
   }
  }
       
  [Browsable(false)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  public bool IsDebugNull
  {
   get
   {
    if ((curObj["Debug"] == null))
    {
     return true;
    }
    else
    {
     return false;
    }
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description("Debug 属性表示是否检查过(调试)操作系统内部版本。查过的内部版本提供了错误检查、参数验证和系统调试编码。其它在检查过的二进制产生的内核调试错误消息和调试程序" +
    "终断。这可以帮助立即确定错误的原因和位置。操作由于执行的其它编码在检查过的内部版本而受影响。/n值: TRUE 或 FALSE, TRUE 值代表安装了 User" +
    ".exe 的调试版本。")]
  [TypeConverter(typeof(WMIValueTypeConverter))]
  public bool Debug
  {
   get
   {
    if ((curObj["Debug"] == null))
    {
     return System.Convert.ToBoolean(0);
    }
    return ((bool)(curObj["Debug"]));
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description("Description 属性提供 Windows 操作系统的描述。某些用户的界面(那些允许编辑这个描述的)将其长度限制到 48 个字符。")]
  public string Description
  {
   get
   {
    return ((string)(curObj["Description"]));
   }
   set
   {
    curObj["Description"] = value;
    if (((isEmbedded == false)
     && (AutoCommitProp == true)))
    {
     PrivateLateBoundObject.Put();
    }
   }
  }
       
  [Browsable(false)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  public bool IsDistributedNull
  {
   get
   {
    if ((curObj["Distributed"] == null))
    {
     return true;
    }
    else
    {
     return false;
    }
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description("波尔值表示操作系统是否在几个计算机系统节点上发行。如果是这样的话,这些节点应该组成一个群集。")]
  [TypeConverter(typeof(WMIValueTypeConverter))]
  public bool Distributed
  {
   get
   {
    if ((curObj["Distributed"] == null))
    {
     return System.Convert.ToBoolean(0);
    }
    return ((bool)(curObj["Distributed"]));
   }
  }
       
  [Browsable(false)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  public bool IsEncryptionLevelNull
  {
   get
   {
    if ((curObj["EncryptionLevel"] == null))
    {
     return true;
    }
    else
    {
     return false;
    }
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description("EncryptionLevel 属性用于表示为安全交易所使用的加密级别,40 位、128 位或 n 位。")]
  [TypeConverter(typeof(WMIValueTypeConverter))]
  public EncryptionLevelValues EncryptionLevel
  {
   get
   {
    if ((curObj["EncryptionLevel"] == null))
    {
     return ((EncryptionLevelValues)(System.Convert.ToInt32(0)));
    }
    return ((EncryptionLevelValues)(Convert.ToInt32(curObj["EncryptionLevel"])));
   }
  }
       
  [Browsable(false)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  public bool IsForegroundApplicationBoostNull
  {
   get
   {
    if ((curObj["ForegroundApplicationBoost"] == null))
    {
     return true;
    }
    else
    {
     return false;
    }
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description(@"ForegroundApplicationBoost 属性表示给前景应用程序增加的优先性。在运行 Windows NT 4.0 和 Windows 2000 的计算机系统上,应用程序扩大是由给应用程序更多的时间(quantum lengths)而实现的。ForegroundApplicationBoost 值为 0 时表示系统扩大了 6 个量子长度; 如果为 1,那么就是 12; 并且如果是 2 那么就是 18。在 Windows NT 3.51 和更早的版本上,应用程序扩大是由增加日程安排的优先权来实现的。对于这些系统来说,日程安排的优先权是由这个属性得知增加的。默认值为 2。")]
  [TypeConverter(typeof(WMIValueTypeConverter))]
  public ForegroundApplicationBoostValues ForegroundApplicationBoost
  {
   get
   {
    if ((curObj["ForegroundApplicationBoost"] == null))
    {
     return ((ForegroundApplicationBoostValues)(System.Convert.ToInt32(0)));
    }
    return ((ForegroundApplicationBoostValues)(Convert.ToInt32(curObj["ForegroundApplicationBoost"])));
   }
   set
   {
    curObj["ForegroundApplicationBoost"] = value;
    if (((isEmbedded == false)
     && (AutoCommitProp == true)))
    {
     PrivateLateBoundObject.Put();
    }
   }
  }
       
  [Browsable(false)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  public bool IsFreePhysicalMemoryNull
  {
   get
   {
    if ((curObj["FreePhysicalMemory"] == null))
    {
     return true;
    }
    else
    {
     return false;
    }
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description("未使用的和可用的物理内存的 KB 数。")]
  [TypeConverter(typeof(WMIValueTypeConverter))]
  public System.UInt64 FreePhysicalMemory
  {
   get
   {
    if ((curObj["FreePhysicalMemory"] == null))
    {
     return System.Convert.ToUInt64(0);
    }
    return ((System.UInt64)(curObj["FreePhysicalMemory"]));
   }
  }
       
  [Browsable(false)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  public bool IsFreeSpaceInPagingFilesNull
  {
   get
   {
    if ((curObj["FreeSpaceInPagingFiles"] == null))
    {
     return true;
    }
    else
    {
     return false;
    }
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description("能够映射到操作系统的页面文件中,而且不会导致其他页被换出的全部 KB(千字节)数目。0 表示没有页面文件。")]
  [TypeConverter(typeof(WMIValueTypeConverter))]
  public System.UInt64 FreeSpaceInPagingFiles
  {
   get
   {
    if ((curObj["FreeSpaceInPagingFiles"] == null))
    {
     return System.Convert.ToUInt64(0);
    }
    return ((System.UInt64)(curObj["FreeSpaceInPagingFiles"]));
   }
  }
       
  [Browsable(false)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  public bool IsFreeVirtualMemoryNull
  {
   get
   {
    if ((curObj["FreeVirtualMemory"] == null))
    {
     return true;
    }
    else
    {
     return false;
    }
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description("当前没有使用的并且可用的虚拟内存的 KB 数。例如, 这可以通过将空闲 RAM 数目和空闲分页空间(如添加属性、FreePhysicalMemory 和 Free" +
    "SpaceInPagingFiles)相加得出。")]
  [TypeConverter(typeof(WMIValueTypeConverter))]
  public System.UInt64 FreeVirtualMemory
  {
   get
   {
    if ((curObj["FreeVirtualMemory"] == null))
    {
     return System.Convert.ToUInt64(0);
    }
    return ((System.UInt64)(curObj["FreeVirtualMemory"]));
   }
  }
       
  [Browsable(false)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  public bool IsInstallDateNull
  {
   get
   {
    if ((curObj["InstallDate"] == null))
    {
     return true;
    }
    else
    {
     return false;
    }
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description("InstallDate 属性是表示安装对象的日期时间值。没有值并不表示该对象没有安装。")]
  [TypeConverter(typeof(WMIValueTypeConverter))]
  public System.DateTime InstallDate
  {
   get
   {
    if ((curObj["InstallDate"] != null))
    {
     return ToDateTime(((string)(curObj["InstallDate"])));
    }
    else
    {
     return System.DateTime.MinValue;
    }
   }
  }
       
  [Browsable(false)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  public bool IsLargeSystemCacheNull
  {
   get
   {
    if ((curObj["LargeSystemCache"] == null))
    {
     return true;
    }
    else
    {
     return false;
    }
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description("LargeSystemCache 属性表明是否为应用程序 (value=0) 或系统性能 (value=1) 优化内存。")]
  [TypeConverter(typeof(WMIValueTypeConverter))]
  public LargeSystemCacheValues LargeSystemCache
  {
   get
   {
    if ((curObj["LargeSystemCache"] == null))
    {
     return ((LargeSystemCacheValues)(System.Convert.ToInt64(0)));
    }
    return ((LargeSystemCacheValues)(Convert.ToInt64(curObj["LargeSystemCache"])));
   }
  }
       
  [Browsable(false)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  public bool IsLastBootUpTimeNull
  {
   get
   {
    if ((curObj["LastBootUpTime"] == null))
    {
     return true;
    }
    else
    {
     return false;
    }
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description("操作系统最后一次启动的时间。")]
  [TypeConverter(typeof(WMIValueTypeConverter))]
  public System.DateTime LastBootUpTime
  {
   get
   {
    if ((curObj["LastBootUpTime"] != null))
    {
     return ToDateTime(((string)(curObj["LastBootUpTime"])));
    }
    else
    {
     return System.DateTime.MinValue;
    }
   }
  }
       
  [Browsable(false)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  public bool IsLocalDateTimeNull
  {
   get
   {
    if ((curObj["LocalDateTime"] == null))
    {
     return true;
    }
    else
    {
     return false;
    }
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description("操作系统的本地日期和时间标记。")]
  [TypeConverter(typeof(WMIValueTypeConverter))]
  public System.DateTime LocalDateTime
  {
   get
   {
    if ((curObj["LocalDateTime"] != null))
    {
     return ToDateTime(((string)(curObj["LocalDateTime"])));
    }
    else
    {
     return System.DateTime.MinValue;
    }
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description("Locale 属性表示由操作系统使用的语言识别符。语言识别符是一个国家(地区)的标准国际号码的缩写。每种语言有一个语言识别符(LANGID),包含主要语言识别符和" +
    "次要语言识别符的 16 位值。")]
  public string Locale
  {
   get
   {
    return ((string)(curObj["Locale"]));
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description("Manufacturer 属性表示操作系统制造商名称。对于 Win32 系统,这个值就是 Microsoft Corporation。")]
  public string Manufacturer
  {
   get
   {
    return ((string)(curObj["Manufacturer"]));
   }
  }
       
  [Browsable(false)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  public bool IsMaxNumberOfProcessesNull
  {
   get
   {
    if ((curObj["MaxNumberOfProcesses"] == null))
    {
     return true;
    }
    else
    {
     return false;
    }
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description("操作系统可以支持的过程上下文最大数量。如果没有固定的最大值,值应该是 0。有固定最大值的系统上,这个对象可以帮助诊断达到最大值时出现的故障。如果未知,输入 -1。" +
    "")]
  [TypeConverter(typeof(WMIValueTypeConverter))]
  public System.UInt32 MaxNumberOfProcesses
  {
   get
   {
    if ((curObj["MaxNumberOfProcesses"] == null))
    {
     return System.Convert.ToUInt32(0);
    }
    return ((System.UInt32)(curObj["MaxNumberOfProcesses"]));
   }
  }
       
  [Browsable(false)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  public bool IsMaxProcessMemorySizeNull
  {
   get
   {
    if ((curObj["MaxProcessMemorySize"] == null))
    {
     return true;
    }
    else
    {
     return false;
    }
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description("可以指派给一个进程的最大 KB 值内存。对于没有虚拟内存的操作系统,这个值一般来讲等于物理内存减去由 BIOS 和 OS 使用的内存得出。对于某些操作系统,这个值" +
    "可能是无限的 - 在这种情况下,应该键入 0。在其它情况下,这个值可能是固定的 - 例如, 2G 或 4G。")]
  [TypeConverter(typeof(WMIValueTypeConverter))]
  public System.UInt64 MaxProcessMemorySize
  {
   get
   {
    if ((curObj["MaxProcessMemorySize"] == null))
    {
     return System.Convert.ToUInt64(0);
    }
    return ((System.UInt64)(curObj["MaxProcessMemorySize"]));
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description("继承的 Name 属性在计算机系统中作为操作系统范例的项。")]
  public string Name
  {
   get
   {
    return ((string)(curObj["Name"]));
   }
  }
       
  [Browsable(false)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  public bool IsNumberOfLicensedUsersNull
  {
   get
   {
    if ((curObj["NumberOfLicensedUsers"] == null))
    {
     return true;
    }
    else
    {
     return false;
    }
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description("操作系统的用户许可证数目。如果没有限制请键入 0。如果未知请键入 -1。")]
  [TypeConverter(typeof(WMIValueTypeConverter))]
  public System.UInt32 NumberOfLicensedUsers
  {
   get
   {
    if ((curObj["NumberOfLicensedUsers"] == null))
    {
     return System.Convert.ToUInt32(0);
    }
    return ((System.UInt32)(curObj["NumberOfLicensedUsers"]));
   }
  }
       
  [Browsable(false)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  public bool IsNumberOfProcessesNull
  {
   get
   {
    if ((curObj["NumberOfProcesses"] == null))
    {
     return true;
    }
    else
    {
     return false;
    }
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description("在操作系统上当前加载或运行的进程上下文数目。")]
  [TypeConverter(typeof(WMIValueTypeConverter))]
  public System.UInt32 NumberOfProcesses
  {
   get
   {
    if ((curObj["NumberOfProcesses"] == null))
    {
     return System.Convert.ToUInt32(0);
    }
    return ((System.UInt32)(curObj["NumberOfProcesses"]));
   }
  }
       
  [Browsable(false)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  public bool IsNumberOfUsersNull
  {
   get
   {
    if ((curObj["NumberOfUsers"] == null))
    {
     return true;
    }
    else
    {
     return false;
    }
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description("操作系统为其存储当前状态信息的用户会话数。")]
  [TypeConverter(typeof(WMIValueTypeConverter))]
  public System.UInt32 NumberOfUsers
  {
   get
   {
    if ((curObj["NumberOfUsers"] == null))
    {
     return System.Convert.ToUInt32(0);
    }
    return ((System.UInt32)(curObj["NumberOfUsers"]));
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description("Organization 属性指明了已注册用户(操作系统)的公司名称。/n例如,微软公司。")]
  public string Organization
  {
   get
   {
    return ((string)(curObj["Organization"]));
   }
  }
       
  [Browsable(false)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  public bool IsOSLanguageNull
  {
   get
   {
    if ((curObj["OSLanguage"] == null))
    {
     return true;
    }
    else
    {
     return false;
    }
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description("OSLanguage 属性表示操作系统安装的语言版本。/n例如: 0x0807 (德语、瑞士)")]
  [TypeConverter(typeof(WMIValueTypeConverter))]
  public System.UInt32 OSLanguage
  {
   get
   {
    if ((curObj["OSLanguage"] == null))
    {
     return System.Convert.ToUInt32(0);
    }
    return ((System.UInt32)(curObj["OSLanguage"]));
   }
  }
       
  [Browsable(false)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  public bool IsOSProductSuiteNull
  {
   get
   {
    if ((curObj["OSProductSuite"] == null))
    {
     return true;
    }
    else
    {
     return false;
    }
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description("OSProductSuite 属性表示操作系统的安装的和授权的系统产品。")]
  [TypeConverter(typeof(WMIValueTypeConverter))]
  public OSProductSuiteValues OSProductSuite
  {
   get
   {
    if ((curObj["OSProductSuite"] == null))
    {
     return ((OSProductSuiteValues)(System.Convert.ToInt32(0)));
    }
    return ((OSProductSuiteValues)(Convert.ToInt32(curObj["OSProductSuite"])));
   }
  }
       
  [Browsable(false)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  public bool IsOSTypeNull
  {
   get
   {
    if ((curObj["OSType"] == null))
    {
     return true;
    }
    else
    {
     return false;
    }
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description("表示操作系统种类的整数。")]
  [TypeConverter(typeof(WMIValueTypeConverter))]
  public OSTypeValues OSType
  {
   get
   {
    if ((curObj["OSType"] == null))
    {
     return ((OSTypeValues)(System.Convert.ToInt32(0)));
    }
    return ((OSTypeValues)(Convert.ToInt32(curObj["OSType"])));
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description("描述制造商和操作系统种类的字符串 - 当操作系统属性、 OSType 设成 1 (“Other”)时使用。键入到 OtherTypeDescription 中的字" +
    "符串格式应该与为 OSType 定义的字符串值的格式相似。当 OSType 值为 1 以外的其它任何值时,OtherTypeDescription 应该设成 N" +
    "ULL。")]
  public string OtherTypeDescription
  {
   get
   {
    return ((string)(curObj["OtherTypeDescription"]));
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description("PlusProductID 属性包含 Windows Plus! 操作系统增强软件(如果安装了的话)的产品识别号。")]
  public string PlusProductID
  {
   get
   {
    return ((string)(curObj["PlusProductID"]));
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description("PlusVersionNumber 属性包含 Windows Plus! 操作系统增强软件(如果安装了的话)的版本号。")]
  public string PlusVersionNumber
  {
   get
   {
    return ((string)(curObj["PlusVersionNumber"]));
   }
  }
       
  [Browsable(false)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  public bool IsPrimaryNull
  {
   get
   {
    if ((curObj["Primary"] == null))
    {
     return true;
    }
    else
    {
     return false;
    }
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description("Primary 属性决定这是否是主要的操作系统。/n值: TRUE 或 FALSE。TRUE 值代表这是主要的操作系统。")]
  [TypeConverter(typeof(WMIValueTypeConverter))]
  public bool Primary
  {
   get
   {
    if ((curObj["Primary"] == null))
    {
     return System.Convert.ToBoolean(0);
    }
    return ((bool)(curObj["Primary"]));
   }
  }
       
  [Browsable(false)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  public bool IsProductTypeNull
  {
   get
   {
    if ((curObj["ProductType"] == null))
    {
     return true;
    }
    else
    {
     return false;
    }
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description("ProductType 表示有关此系统的额外信息。此数字可以是下面的一个值: /n1 - 工作站 /n2 - 域控制器 /n3 - 服务器")]
  [TypeConverter(typeof(WMIValueTypeConverter))]
  public ProductTypeValues ProductType
  {
   get
   {
    if ((curObj["ProductType"] == null))
    {
     return ((ProductTypeValues)(System.Convert.ToInt64(0)));
    }
    return ((ProductTypeValues)(Convert.ToInt64(curObj["ProductType"])));
   }
  }
       
  [Browsable(false)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  public bool IsQuantumLengthNull
  {
   get
   {
    if ((curObj["QuantumLength"] == null))
    {
     return true;
    }
    else
    {
     return false;
    }
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description("QuantumLength 属性定义每个量子的钟表嘀嗒数。一个量子是计划程序在转换到其它应用程序之前给应用程序的执行时间单位。当线程运行一个量子时,内核占先它并唯" +
    "有同等优先权的应用程序将其移到列队尾端。线程的量子的实际长度在各种 Windows 平台上不同。只用于 Windows NT/Windows 2000。")]
  [TypeConverter(typeof(WMIValueTypeConverter))]
  public QuantumLengthValues QuantumLength
  {
   get
   {
    if ((curObj["QuantumLength"] == null))
    {
     return ((QuantumLengthValues)(System.Convert.ToInt32(0)));
    }
    return ((QuantumLengthValues)(Convert.ToInt32(curObj["QuantumLength"])));
   }
   set
   {
    curObj["QuantumLength"] = value;
    if (((isEmbedded == false)
     && (AutoCommitProp == true)))
    {
     PrivateLateBoundObject.Put();
    }
   }
  }
       
  [Browsable(false)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  public bool IsQuantumTypeNull
  {
   get
   {
    if ((curObj["QuantumType"] == null))
    {
     return true;
    }
    else
    {
     return false;
    }
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description(@"QuantumType 属性指定了使用固定或可变长度量程。Windows NT 4.0 工作站/Windows 2000 缺省时采用可变长度量程,其前台应用程序的量程比后台应用程序的要长。Windows NT 服务器缺省时采用固定长度量程。量程是一种执行时间单位,在切换到另一个应用程序前,允许调度程序将它指定给某个应用程序。对于具有相等优先级的应用程序,当某线程运行了一个量程时,内核程序会抢占它,并将其移到队列末端。在不同的 Windows 平台上,线程的量程的实际长度会有所不同。仅适用于 Windows NT/Windows 2000。
该属性的取值情况如下:
0 =Unkown –量程类型未知,
1 = Fixed –量程长度固定,
2 = Variable –量程长度可变。")]
  [TypeConverter(typeof(WMIValueTypeConverter))]
  public QuantumTypeValues QuantumType
  {
   get
   {
    if ((curObj["QuantumType"] == null))
    {
     return ((QuantumTypeValues)(System.Convert.ToInt32(0)));
    }
    return ((QuantumTypeValues)(Convert.ToInt32(curObj["QuantumType"])));
   }
   set
   {
    curObj["QuantumType"] = value;
    if (((isEmbedded == false)
     && (AutoCommitProp == true)))
    {
     PrivateLateBoundObject.Put();
    }
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description("RegisteredUser 属性表示操作系统的注册的用户名。/n例如: Jane Doe")]
  public string RegisteredUser
  {
   get
   {
    return ((string)(curObj["RegisteredUser"]));
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description("SerialNumber 属性指明了操作系统产品的序列标识号。/n例如,10497-OEM-0031416-71674。")]
  public string SerialNumber
  {
   get
   {
    return ((string)(curObj["SerialNumber"]));
   }
  }
       
  [Browsable(false)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  public bool IsServicePackMajorVersionNull
  {
   get
   {
    if ((curObj["ServicePackMajorVersion"] == null))
    {
     return true;
    }
    else
    {
     return false;
    }
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description("ServicePackMajorVersion 属性表示安装在计算机系统上的服务包的主要版本号。如果没有安装服务包,该这为零。ServicePackMajorVe" +
    "rsion 只在 Windows 2000 或更新版本(否则为 NULL)上运行的计算机上有效。")]
  [TypeConverter(typeof(WMIValueTypeConverter))]
  public System.UInt16 ServicePackMajorVersion
  {
   get
   {
    if ((curObj["ServicePackMajorVersion"] == null))
    {
     return System.Convert.ToUInt16(0);
    }
    return ((System.UInt16)(curObj["ServicePackMajorVersion"]));
   }
  }
       
  [Browsable(false)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  public bool IsServicePackMinorVersionNull
  {
   get
   {
    if ((curObj["ServicePackMinorVersion"] == null))
    {
     return true;
    }
    else
    {
     return false;
    }
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description("ServicePackMinorVersion 属性表示安装在计算机系统上的服务包的次要版本号。如果没有安装服务包,该这为零。ServicePackMajorVe" +
    "rsion 只在 Windows 2000 或更新版本(否则为 NULL)上运行的计算机上有效。")]
  [TypeConverter(typeof(WMIValueTypeConverter))]
  public System.UInt16 ServicePackMinorVersion
  {
   get
   {
    if ((curObj["ServicePackMinorVersion"] == null))
    {
     return System.Convert.ToUInt16(0);
    }
    return ((System.UInt16)(curObj["ServicePackMinorVersion"]));
   }
  }
       
  [Browsable(false)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  public bool IsSizeStoredInPagingFilesNull
  {
   get
   {
    if ((curObj["SizeStoredInPagingFiles"] == null))
    {
     return true;
    }
    else
    {
     return false;
    }
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description("可以储存在操作系统的页面文件中的 KB 总数。注意,这个数字不代表磁盘上页面文件的实际物理大小。0 表示没有页面文件。")]
  [TypeConverter(typeof(WMIValueTypeConverter))]
  public System.UInt64 SizeStoredInPagingFiles
  {
   get
   {
    if ((curObj["SizeStoredInPagingFiles"] == null))
    {
     return System.Convert.ToUInt64(0);
    }
    return ((System.UInt64)(curObj["SizeStoredInPagingFiles"]));
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description("Status 属性为表示对象当前状态的字符串。可定义不同的操作和非操作状态。操作状态为 “确定”、“已降级” 和“预见故障”。“预见故障”表示一个组件可能运行正常" +
    "但预见很快会出现故障。例如 SMART 启用的硬盘驱动器。还可指定非操作状态。这些状态为 “错误”、“启动”、“停止” 和“服务”。后者“服务”可用于磁盘镜像," +
    "重新加载用户权限列表,或其它管理作业。不是所有这类作业都联机; 但是,被管理的组件不是 “确定”也不是任何其它状态。")]
  public string Status
  {
   get
   {
    return ((string)(curObj["Status"]));
   }
  }
       
  [Browsable(false)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  public bool IsSuiteMaskNull
  {
   get
   {
    if ((curObj["SuiteMask"] == null))
    {
     return true;
    }
    else
    {
     return false;
    }
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description(@"SuiteMask 属性表示一组位标志,它识别系统上的一套产品。此数字可以是下列值的组合之一:
0 - Small Business
1 - Enterprise
2 - Backoffice
3 - Communications
4 - Terminal
5 - Smallbusiness Restricted
6 - Embedded NT
7 - Data Center
8 - Singe User
9 - Personal
10 - Blade
30 - NT Work Station
31 - NT Server")]
  [TypeConverter(typeof(WMIValueTypeConverter))]
  public SuiteMaskValues SuiteMask
  {
   get
   {
    if ((curObj["SuiteMask"] == null))
    {
     return ((SuiteMaskValues)(System.Convert.ToInt32(0)));
    }
    return ((SuiteMaskValues)(Convert.ToInt32(curObj["SuiteMask"])));
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description("SystemDevice 属性表示安装了操作系统的物理磁盘分区。")]
  public string SystemDevice
  {
   get
   {
    return ((string)(curObj["SystemDevice"]));
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description("SystemDirectory 属性表示操作系统的系统目录。/n例如: C://WINDOWS//SYSTEM32")]
  public string SystemDirectory
  {
   get
   {
    return ((string)(curObj["SystemDirectory"]));
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description("SystemDrive 属性包含操作系统所在的磁盘驱动器字母。/n例如,C:")]
  public string SystemDrive
  {
   get
   {
    return ((string)(curObj["SystemDrive"]));
   }
  }
       
  [Browsable(false)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  public bool IsTotalSwapSpaceSizeNull
  {
   get
   {
    if ((curObj["TotalSwapSpaceSize"] == null))
    {
     return true;
    }
    else
    {
     return false;
    }
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description("总交换空间(单位为 KB)。如果交换空间跟页面文件没有区分开,这个值可以是 NULL (未指定的)。但是,有些操作系统区分这两个概念。例如,在 UNIX 中,当自" +
    "由页面列表减少并长时间低于某个数量时,这个过程可以被“换”出来。")]
  [TypeConverter(typeof(WMIValueTypeConverter))]
  public System.UInt64 TotalSwapSpaceSize
  {
   get
   {
    if ((curObj["TotalSwapSpaceSize"] == null))
    {
     return System.Convert.ToUInt64(0);
    }
    return ((System.UInt64)(curObj["TotalSwapSpaceSize"]));
   }
  }
       
  [Browsable(false)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  public bool IsTotalVirtualMemorySizeNull
  {
   get
   {
    if ((curObj["TotalVirtualMemorySize"] == null))
    {
     return true;
    }
    else
    {
     return false;
    }
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description("虚拟内存量(单位为 KB)。例如,这可以通过将 RAM 总量添加到页面空间量来计算(即,计算机系统中的内存量和属性 SizeStoredInPagingFiles" +
    " 之和) 。")]
  [TypeConverter(typeof(WMIValueTypeConverter))]
  public System.UInt64 TotalVirtualMemorySize
  {
   get
   {
    if ((curObj["TotalVirtualMemorySize"] == null))
    {
     return System.Convert.ToUInt64(0);
    }
    return ((System.UInt64)(curObj["TotalVirtualMemorySize"]));
   }
  }
       
  [Browsable(false)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  public bool IsTotalVisibleMemorySizeNull
  {
   get
   {
    if ((curObj["TotalVisibleMemorySize"] == null))
    {
     return true;
    }
    else
    {
     return false;
    }
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description("操作系统可用的物理内存的全部数目(单位是千字节)。该值并非需要指明真实的物理内存数目,而是向操作系统通报其可用的内存数目。")]
  [TypeConverter(typeof(WMIValueTypeConverter))]
  public System.UInt64 TotalVisibleMemorySize
  {
   get
   {
    if ((curObj["TotalVisibleMemorySize"] == null))
    {
     return System.Convert.ToUInt64(0);
    }
    return ((System.UInt64)(curObj["TotalVisibleMemorySize"]));
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description("Version 属性表示操作系统的版本。/n例如: 4.0")]
  public string Version
  {
   get
   {
    return ((string)(curObj["Version"]));
   }
  }
       
  [Browsable(true)]
  [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  [Description("WindowsDirectory 属性表示操作系统的 Windows 目录。/n例如: C://WINDOWS")]
  public string WindowsDirectory
  {
   get
   {
    return ((string)(curObj["WindowsDirectory"]));
   }
  }
       
  private bool CheckIfProperClass(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions OptionsParam)
  {
   if (((path != null)
    && (System.String.Compare(path.ClassName, ManagementClassName, true, CultureInfo.InvariantCulture) == 0)))
   {
    return true;
   }
   else
   {
    return CheckIfProperClass(new System.Management.ManagementObject(mgmtScope, path, OptionsParam));
   }
  }
       
  private bool CheckIfProperClass(System.Management.ManagementBaseObject theObj)
  {
   if (((theObj != null)
    && (System.String.Compare(((string)(theObj["__CLASS"])), ManagementClassName, true, CultureInfo.InvariantCulture) == 0)))
   {
    return true;
   }
   else
   {
    System.Array parentClasses = ((System.Array)(theObj["__DERIVATION"]));
    if ((parentClasses != null))
    {
     Int32 count = 0;
     for (count = 0; (count < parentClasses.Length); count = (count + 1))
     {
      if ((System.String.Compare(((string)(parentClasses.GetValue(count))), ManagementClassName, true, CultureInfo.InvariantCulture) == 0))
      {
       return true;
      }
     }
    }
   }
   return false;
  }
       
  private bool ShouldSerializeCurrentTimeZone()
  {
   if ((IsCurrentTimeZoneNull == false))
   {
    return true;
   }
   return false;
  }
       
  private void ResetCurrentTimeZone()
  {
   curObj["CurrentTimeZone"] = null;
   if (((isEmbedded == false)
    && (AutoCommitProp == true)))
   {
    PrivateLateBoundObject.Put();
   }
  }
       
  private bool ShouldSerializeDebug()
  {
   if ((IsDebugNull == false))
   {
    return true;
   }
   return false;
  }
       
  private void ResetDescription()
  {
   curObj["Description"] = null;
   if (((isEmbedded == false)
    && (AutoCommitProp == true)))
   {
    PrivateLateBoundObject.Put();
   }
  }
       
  private bool ShouldSerializeDistributed()
  {
   if ((IsDistributedNull == false))
   {
    return true;
   }
   return false;
  }
       
  private bool ShouldSerializeEncryptionLevel()
  {
   if ((IsEncryptionLevelNull == false))
   {
    return true;
   }
   return false;
  }
       
  private bool ShouldSerializeForegroundApplicationBoost()
  {
   if ((IsForegroundApplicationBoostNull == false))
   {
    return true;
   }
   return false;
  }
       
  private void ResetForegroundApplicationBoost()
  {
   curObj["ForegroundApplicationBoost"] = null;
   if (((isEmbedded == false)
    && (AutoCommitProp == true)))
   {
    PrivateLateBoundObject.Put();
   }
  }
       
  private bool ShouldSerializeFreePhysicalMemory()
  {
   if ((IsFreePhysicalMemoryNull == false))
   {
    return true;
   }
   return false;
  }
       
  private bool ShouldSerializeFreeSpaceInPagingFiles()
  {
   if ((IsFreeSpaceInPagingFilesNull == false))
   {
    return true;
   }
   return false;
  }
       
  private bool ShouldSerializeFreeVirtualMemory()
  {
   if ((IsFreeVirtualMemoryNull == false))
   {
    return true;
   }
   return false;
  }
       
  // 将 DMTF 格式的给定日期时间转换为 System.DateTime 对象。
  static System.DateTime ToDateTime(string dmtfDate)
  {
   int year = System.DateTime.MinValue.Year;
   int month = System.DateTime.MinValue.Month;
   int day = System.DateTime.MinValue.Day;
   int hour = System.DateTime.MinValue.Hour;
   int minute = System.DateTime.MinValue.Minute;
   int second = System.DateTime.MinValue.Second;
   long ticks = 0;
   string dmtf = dmtfDate;
   System.DateTime datetime = System.DateTime.MinValue;
   string tempString = System.String.Empty;
   if ((dmtf == null))
   {
    throw new System.ArgumentOutOfRangeException();
   }
   if ((dmtf.Length == 0))
   {
    throw new System.ArgumentOutOfRangeException();
   }
   if ((dmtf.Length != 25))
   {
    throw new System.ArgumentOutOfRangeException();
   }
   try
   {
    tempString = dmtf.Substring(0, 4);
    if (("****" != tempString))
    {
     year = System.Int32.Parse(tempString);
    }
    tempString = dmtf.Substring(4, 2);
    if (("**" != tempString))
    {
     month = System.Int32.Parse(tempString);
    }
    tempString = dmtf.Substring(6, 2);
    if (("**" != tempString))
    {
     day = System.Int32.Parse(tempString);
    }
    tempString = dmtf.Substring(8, 2);
    if (("**" != tempString))
    {
     hour = System.Int32.Parse(tempString);
    }
    tempString = dmtf.Substring(10, 2);
    if (("**" != tempString))
    {
     minute = System.Int32.Parse(tempString);
    }
    tempString = dmtf.Substring(12, 2);
    if (("**" != tempString))
    {
     second = System.Int32.Parse(tempString);
    }
    tempString = dmtf.Substring(15, 6);
    if (("******" != tempString))
    {
     ticks = (System.Int64.Parse(tempString)
      * (System.TimeSpan.TicksPerMillisecond / 1000));
    }
    if (((((((((year < 0)
     || (month < 0))
     || (day < 0))
     || (hour < 0))
     || (minute < 0))
     || (minute < 0))
     || (second < 0))
     || (ticks < 0)))
    {
     throw new System.ArgumentOutOfRangeException();
    }
   }
   catch (System.Exception e)
   {
    e = e;
    throw new System.ArgumentOutOfRangeException();
   }
   datetime = new System.DateTime(year, month, day, hour, minute, second, 0);
   datetime = datetime.AddTicks(ticks);
   System.TimeSpan tickOffset = System.TimeZone.CurrentTimeZone.GetUtcOffset(datetime);
   int UTCOffset = 0;
   long OffsetToBeAdjusted = 0;
   long OffsetMins = (tickOffset.Ticks / System.TimeSpan.TicksPerMinute);
   tempString = dmtf.Substring(22, 3);
   if ((tempString != "***"))
   {
    tempString = dmtf.Substring(21, 4);
    try
    {
     UTCOffset = System.Int32.Parse(tempString);
    }
    catch (System.Exception e)
    {
     e = e;
     throw new System.ArgumentOutOfRangeException();
    }
    OffsetToBeAdjusted = (OffsetMins - UTCOffset);
    datetime = datetime.AddMinutes(OffsetToBeAdjusted);
   }
   return datetime;
  }
       
  // 将给定的 System.DateTime 对象转换为 DMTF 日期时间格式。
  static string ToDmtfDateTime(System.DateTime date)
  {
   string utcString = System.String.Empty;
   System.TimeSpan tickOffset = System.TimeZone.CurrentTimeZone.GetUtcOffset(date);
   long OffsetMins = (tickOffset.Ticks / System.TimeSpan.TicksPerMinute);
   if ((System.Math.Abs(OffsetMins) > 999))
   {
    date = date.ToUniversalTime();
    utcString = "+000";
   }
   else
   {
    if ((tickOffset.Ticks >= 0))
    {
     utcString = ("+" + ((tickOffset.Ticks / System.TimeSpan.TicksPerMinute)).ToString().PadLeft(3, '0'));
    }
    else
    {
     string strTemp = OffsetMins.ToString();
     utcString = ("-" + strTemp.Substring(1, (strTemp.Length - 1)).PadLeft(3, '0'));
    }
   }
   string dmtfDateTime = date.Year.ToString().PadLeft(4, '0');
   dmtfDateTime = (dmtfDateTime + date.Month.ToString().PadLeft(2, '0'));
   dmtfDateTime = (dmtfDateTime + date.Day.ToString().PadLeft(2, '0'));
   dmtfDateTime = (dmtfDateTime + date.Hour.ToString().PadLeft(2, '0'));
   dmtfDateTime = (dmtfDateTime + date.Minute.ToString().PadLeft(2, '0'));
   dmtfDateTime = (dmtfDateTime + date.Second.ToString().PadLeft(2, '0'));
   dmtfDateTime = (dmtfDateTime + ".");
   System.DateTime dtTemp = new System.DateTime(date.Year, date.Month, date.Day, date.Hour, date.Minute, date.Second, 0);
   long microsec = (((date.Ticks - dtTemp.Ticks)
    * 1000)
    / System.TimeSpan.TicksPerMillisecond);
   string strMicrosec = microsec.ToString();
   if ((strMicrosec.Length > 6))
   {
    strMicrosec = strMicrosec.Substring(0, 6);
   }
   dmtfDateTime = (dmtfDateTime + strMicrosec.PadLeft(6, '0'));
   dmtfDateTime = (dmtfDateTime + utcString);
   return dmtfDateTime;
  }
       
  private bool ShouldSerializeInstallDate()
  {
   if ((IsInstallDateNull == false))
   {
    return true;
   }
   return false;
  }
       
  private bool ShouldSerializeLargeSystemCache()
  {
   if ((IsLargeSystemCacheNull == false))
   {
    return true;
   }
   return false;
  }
       
  private bool ShouldSerializeLastBootUpTime()
  {
   if ((IsLastBootUpTimeNull == false))
   {
    return true;
   }
   return false;
  }
       
  private bool ShouldSerializeLocalDateTime()
  {
   if ((IsLocalDateTimeNull == false))
   {
    return true;
   }
   return false;
  }
       
  private bool ShouldSerializeMaxNumberOfProcesses()
  {
   if ((IsMaxNumberOfProcessesNull == false))
   {
    return true;
   }
   return false;
  }
       
  private bool ShouldSerializeMaxProcessMemorySize()
  {
   if ((IsMaxProcessMemorySizeNull == false))
   {
    return true;
   }
   return false;
  }
       
  private bool ShouldSerializeNumberOfLicensedUsers()
  {
   if ((IsNumberOfLicensedUsersNull == false))
   {
    return true;
   }
   return false;
  }
       
  private bool ShouldSerializeNumberOfProcesses()
  {
   if ((IsNumberOfProcessesNull == false))
   {
    return true;
   }
   return false;
  }
       
  private bool ShouldSerializeNumberOfUsers()
  {
   if ((IsNumberOfUsersNull == false))
   {
    return true;
   }
   return false;
  }
       
  private bool ShouldSerializeOSLanguage()
  {
   if ((IsOSLanguageNull == false))
   {
    return true;
   }
   return false;
  }
       
  private bool ShouldSerializeOSProductSuite()
  {
   if ((IsOSProductSuiteNull == false))
   {
    return true;
   }
   return false;
  }
       
  private bool ShouldSerializeOSType()
  {
   if ((IsOSTypeNull == false))
   {
    return true;
   }
   return false;
  }
       
  private bool ShouldSerializePrimary()
  {
   if ((IsPrimaryNull == false))
   {
    return true;
   }
   return false;
  }
       
  private bool ShouldSerializeProductType()
  {
   if ((IsProductTypeNull == false))
   {
    return true;
   }
   return false;
  }
       
  private bool ShouldSerializeQuantumLength()
  {
   if ((IsQuantumLengthNull == false))
   {
    return true;
   }
   return false;
  }
       
  private void ResetQuantumLength()
  {
   curObj["QuantumLength"] = null;
   if (((isEmbedded == false)
    && (AutoCommitProp == true)))
   {
    PrivateLateBoundObject.Put();
   }
  }
       
  private bool ShouldSerializeQuantumType()
  {
   if ((IsQuantumTypeNull == false))
   {
    return true;
   }
   return false;
  }
       
  private void ResetQuantumType()
  {
   curObj["QuantumType"] = null;
   if (((isEmbedded == false)
    && (AutoCommitProp == true)))
   {
    PrivateLateBoundObject.Put();
   }
  }
       
  private bool ShouldSerializeServicePackMajorVersion()
  {
   if ((IsServicePackMajorVersionNull == false))
   {
    return true;
   }
   return false;
  }
       
  private bool ShouldSerializeServicePackMinorVersion()
  {
   if ((IsServicePackMinorVersionNull == false))
   {
    return true;
   }
   return false;
  }
       
  private bool ShouldSerializeSizeStoredInPagingFiles()
  {
   if ((IsSizeStoredInPagingFilesNull == false))
   {
    return true;
   }
   return false;
  }
       
  private bool ShouldSerializeSuiteMask()
  {
   if ((IsSuiteMaskNull == false))
   {
    return true;
   }
   return false;
  }
       
  private bool ShouldSerializeTotalSwapSpaceSize()
  {
   if ((IsTotalSwapSpaceSizeNull == false))
   {
    return true;
   }
   return false;
  }
       
  private bool ShouldSerializeTotalVirtualMemorySize()
  {
   if ((IsTotalVirtualMemorySizeNull == false))
   {
    return true;
   }
   return false;
  }
       
  private bool ShouldSerializeTotalVisibleMemorySize()
  {
   if ((IsTotalVisibleMemorySizeNull == false))
   {
    return true;
   }
   return false;
  }
       
  [Browsable(true)]
  public void CommitObject()
  {
   if ((isEmbedded == false))
   {
    PrivateLateBoundObject.Put();
   }
  }
       
  private static string ConstructPath(string keyName)
  {
   string strPath = "ROOT//CIMV2:Win32_OperatingSystem";
   strPath = (strPath
    + (".Name="
    + ("/""
    + (keyName + "/""))));
   return strPath;
  }
       
  // 在枚举 WMI 类实例方面的不同重载的 GetInstances() 帮助。
  public static OperatingSystemCollection GetInstances()
  {
   return GetInstances(((System.Management.ManagementScope)(null)), ((System.Management.EnumerationOptions)(null)));
  }
       
  public static OperatingSystemCollection GetInstances(string condition)
  {
   return GetInstances(null, condition, null);
  }
       
  public static OperatingSystemCollection GetInstances(System.String [] selectedProperties)
  {
   return GetInstances(null, null, selectedProperties);
  }
       
  public static OperatingSystemCollection GetInstances(string condition, System.String [] selectedProperties)
  {
   return GetInstances(null, condition, selectedProperties);
  }
       
  public static OperatingSystemCollection GetInstances(System.Management.ManagementScope mgmtScope, System.Management.EnumerationOptions enumOptions)
  {
   if ((mgmtScope == null))
   {
    if ((statMgmtScope == null))
    {
     mgmtScope = new System.Management.ManagementScope();
     mgmtScope.Path.NamespacePath = "root//CIMV2";
    }
    else
    {
     mgmtScope = statMgmtScope;
    }
   }
   System.Management.ManagementPath pathObj = new System.Management.ManagementPath();
   pathObj.ClassName = "Win32_OperatingSystem";
   pathObj.NamespacePath = "root//CIMV2";
   System.Management.ManagementClass clsObject = new System.Management.ManagementClass(mgmtScope, pathObj, null);
   if ((enumOptions == null))
   {
    enumOptions = new System.Management.EnumerationOptions();
    enumOptions.EnsureLocatable = true;
   }
   return new OperatingSystemCollection(clsObject.GetInstances(enumOptions));
  }
       
  public static OperatingSystemCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition)
  {
   return GetInstances(mgmtScope, condition, null);
  }
       
  public static OperatingSystemCollection GetInstances(System.Management.ManagementScope mgmtScope, System.String [] selectedProperties)
  {
   return GetInstances(mgmtScope, null, selectedProperties);
  }
       
  public static OperatingSystemCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition, System.String [] selectedProperties)
  {
   if ((mgmtScope == null))
   {
    if ((statMgmtScope == null))
    {
     mgmtScope = new System.Management.ManagementScope();
     mgmtScope.Path.NamespacePath = "root//CIMV2";
    }
    else
    {
     mgmtScope = statMgmtScope;
    }
   }
   System.Management.ManagementObjectSearcher ObjectSearcher = new System.Management.ManagementObjectSearcher(mgmtScope, new SelectQuery("Win32_OperatingSystem", condition, selectedProperties));
   System.Management.EnumerationOptions enumOptions = new System.Management.EnumerationOptions();
   enumOptions.EnsureLocatable = true;
   ObjectSearcher.Options = enumOptions;
   return new OperatingSystemCollection(ObjectSearcher.Get());
  }
       
  [Browsable(true)]
  public static OperatingSystem CreateInstance()
  {
   System.Management.ManagementScope mgmtScope = null;
   if ((statMgmtScope == null))
   {
    mgmtScope = new System.Management.ManagementScope();
    mgmtScope.Path.NamespacePath = CreatedWmiNamespace;
   }
   else
   {
    mgmtScope = statMgmtScope;
   }
   System.Management.ManagementPath mgmtPath = new System.Management.ManagementPath(CreatedClassName);
   return new OperatingSystem(new System.Management.ManagementClass(mgmtScope, mgmtPath, null).CreateInstance());
  }
       
  [Browsable(true)]
  public void Delete()
  {
   PrivateLateBoundObject.Delete();
  }
       
  public System.UInt32 Reboot()
  {
   if ((isEmbedded == false))
   {
    System.Management.ManagementBaseObject inParams = null;
    bool EnablePrivileges = PrivateLateBoundObject.Scope.Options.EnablePrivileges;
    PrivateLateBoundObject.Scope.Options.EnablePrivileges = true;
    System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("Reboot", inParams, null);
    PrivateLateBoundObject.Scope.Options.EnablePrivileges = EnablePrivileges;
    return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
   }
   else
   {
    return System.Convert.ToUInt32(0);
   }
  }
       
  public System.UInt32 SetDateTime(System.DateTime LocalDateTime)
  {
   if ((isEmbedded == false))
   {
    System.Management.ManagementBaseObject inParams = null;
    bool EnablePrivileges = PrivateLateBoundObject.Scope.Options.EnablePrivileges;
    PrivateLateBoundObject.Scope.Options.EnablePrivileges = true;
    inParams = PrivateLateBoundObject.GetMethodParameters("SetDateTime");
    inParams["LocalDateTime"] = ToDmtfDateTime(((System.DateTime)(LocalDateTime)));
    System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("SetDateTime", inParams, null);
    PrivateLateBoundObject.Scope.Options.EnablePrivileges = EnablePrivileges;
    return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
   }
   else
   {
    return System.Convert.ToUInt32(0);
   }
  }
       
  public System.UInt32 Shutdown()
  {
   if ((isEmbedded == false))
   {
    System.Management.ManagementBaseObject inParams = null;
    bool EnablePrivileges = PrivateLateBoundObject.Scope.Options.EnablePrivileges;
    PrivateLateBoundObject.Scope.Options.EnablePrivileges = true;
    System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("Shutdown", inParams, null);
    PrivateLateBoundObject.Scope.Options.EnablePrivileges = EnablePrivileges;
    return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
   }
   else
   {
    return System.Convert.ToUInt32(0);
   }
  }
       
  public System.UInt32 Win32Shutdown(int Flags, int Reserved)
  {
   if ((isEmbedded == false))
   {
    System.Management.ManagementBaseObject inParams = null;
    bool EnablePrivileges = PrivateLateBoundObject.Scope.Options.EnablePrivileges;
    PrivateLateBoundObject.Scope.Options.EnablePrivileges = true;
    inParams = PrivateLateBoundObject.GetMethodParameters("Win32Shutdown");
    inParams["Flags"] = Flags;
    inParams["Reserved"] = Reserved;
    System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod("Win32Shutdown", inParams, null);
    PrivateLateBoundObject.Scope.Options.EnablePrivileges = EnablePrivileges;
    return System.Convert.ToUInt32(outParams.Properties["ReturnValue"].Value);
   }
   else
   {
    return System.Convert.ToUInt32(0);
   }
  }
       
  public enum EncryptionLevelValues : int
  {
           
   Val_40_位,
           
   Val_128_位,
           
   n_位,
  }
       
  public enum ForegroundApplicationBoostValues : int
  {
           
   无,
           
   最小,
           
   最大,
  }
       
  public enum LargeSystemCacheValues : long
  {
           
   应用程序优化 = 0,
           
   系统性能优化 = 1,
  }
       
  public enum OSProductSuiteValues : int
  {
           
   Small_Business = 1,
           
   Enterprise = 2,
           
   BackOffice = 4,
           
   通讯服务器 = 8,
           
   终端服务器 = 16,
           
   Small_Business_Restricted_ = 32,
           
   Embedded_NT = 64,
           
   Data_Center = 128,
  }
       
  public enum OSTypeValues : int
  {
           
   未知,
           
   其他,
           
   MACOS,
           
   ATTUNIX,
           
   DGUX,
           
   DECNT,
           
   Digital_Unix,
           
   OpenVMS,
           
   HPUX,
           
   AIX,
           
   MVS,
           
   OS400,
           
   OS_2,
           
   JavaVM,
           
   MSDOS,
           
   WIN3x,
           
   WIN95,
           
   WIN98,
           
   WINNT,
           
   WINCE,
           
   NCR3000,
           
   NetWare,
           
   OSF,
           
   DC_OS,
           
   Reliant_UNIX,
           
   SCO_UnixWare,
           
   SCO_OpenServer,
           
   Sequent,
           
   IRIX,
           
   Solaris,
           
   SunOS,
           
   U6000,
           
   ASERIES,
           
   TandemNSK,
           
   TandemNT,
           
   BS2000,
           
   LINUX,
           
   Lynx,
           
   XENIX,
           
   VM_ESA,
           
   交互的_UNIX,
           
   BSDUNIX,
           
   FreeBSD,
           
   NetBSD,
           
   GNU_Hurd,
           
   OS9,
           
   MACH_Kernel,
           
   Inferno,
           
   QNX,
           
   EPOC,
           
   IxWorks,
           
   VxWorks,
           
   MiNT,
           
   BeOS,
           
   HP_MPE,
           
   NextStep,
           
   PalmPilot,
           
   Rhapsody,
           
   Windows_2000,
           
   专用的,
           
   OS_390,
           
   VSE,
           
   TPF,
  }
       
  public enum ProductTypeValues : long
  {
           
   工作站 = 1,
           
   域控制器 = 2,
           
   服务器 = 3,
           
   INVALID_ENUM_VALUE = 0,
  }
       
  public enum QuantumLengthValues : int
  {
           
   未知,
           
   单击,
           
   双击,
  }
       
  public enum QuantumTypeValues : int
  {
           
   未知,
           
   固定,
           
   变量,
  }
       
  public enum SuiteMaskValues : int
  {
           
   Small_Business = 1,
           
   Enterprise = 2,
           
   BackOffice = 4,
           
   通讯 = 8,
           
   终端 = 16,
           
   Smallbusiness_Restricted = 32,
           
   Embedded_NT = 64,
           
   Data_Center = 128,
           
   单一用户 = 256,
           
   Personal = 512,
           
   Blade = 1024,
           
   NT_Work_Station = 2048,
           
   NT_Server = 4096,
  }
       
  // 枚举该类实例的枚举数实现。
  public class OperatingSystemCollection : object, ICollection
  {
           
   private ManagementObjectCollection ObjectCollection;
           
   public OperatingSystemCollection(ManagementObjectCollection objCollection)
   {
    ObjectCollection = objCollection;
   }
           
   public int Count
   {
    get
    {
     return ObjectCollection.Count;
    }
   }
           
   public bool IsSynchronized
   {
    get
    {
     return ObjectCollection.IsSynchronized;
    }
   }
           
   public object SyncRoot
   {
    get
    {
     return this;
    }
   }
           
   public void CopyTo(System.Array array, int index)
   {
    ObjectCollection.CopyTo(array, index);
    int nCtr;
    for (nCtr = 0; (nCtr < array.Length); nCtr = (nCtr + 1))
    {
     array.SetValue(new OperatingSystem(((System.Management.ManagementObject)(array.GetValue(nCtr)))), nCtr);
    }
   }
           
   public System.Collections.IEnumerator GetEnumerator()
   {
    return new OperatingSystemEnumerator(ObjectCollection.GetEnumerator());
   }
           
   public class OperatingSystemEnumerator : object, System.Collections.IEnumerator
   {
               
    private ManagementObjectCollection.ManagementObjectEnumerator ObjectEnumerator;
               
    public OperatingSystemEnumerator(ManagementObjectCollection.ManagementObjectEnumerator objEnum)
    {
     ObjectEnumerator = objEnum;
    }
               
    public object Current
    {
     get
     {
      return new OperatingSystem(((System.Management.ManagementObject)(ObjectEnumerator.Current)));
     }
    }
               
    public bool MoveNext()
    {
     return ObjectEnumerator.MoveNext();
    }
               
    public void Reset()
    {
     ObjectEnumerator.Reset();
    }
   }
  }
       
  // 处理 ValueType 属性的空值的 TypeConverter
  public class WMIValueTypeConverter : TypeConverter
  {
           
   private TypeConverter baseConverter;
           
   public WMIValueTypeConverter(System.Type baseType)
   {
    baseConverter = TypeDescriptor.GetConverter(baseType);
   }
           
   public override bool CanConvertFrom(System.ComponentModel.ITypeDescriptorContext context, System.Type srcType)
   {
    return baseConverter.CanConvertFrom(context, srcType);
   }
           
   public override bool CanConvertTo(System.ComponentModel.ITypeDescriptorContext context, System.Type destinationType)
   {
    return baseConverter.CanConvertTo(context, destinationType);
   }
           
   public override object ConvertFrom(System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
   {
    return baseConverter.ConvertFrom(context, culture, value);
   }
           
   public override object CreateInstance(System.ComponentModel.ITypeDescriptorContext context, System.Collections.IDictionary dictionary)
   {
    return baseConverter.CreateInstance(context, dictionary);
   }
           
   public override bool GetCreateInstanceSupported(System.ComponentModel.ITypeDescriptorContext context)
   {
    return baseConverter.GetCreateInstanceSupported(context);
   }
           
   public override PropertyDescriptorCollection GetProperties(System.ComponentModel.ITypeDescriptorContext context, object value, System.Attribute[] attributeVar)
   {
    return baseConverter.GetProperties(context, value, attributeVar);
   }
           
   public override bool GetPropertiesSupported(System.ComponentModel.ITypeDescriptorContext context)
   {
    return baseConverter.GetPropertiesSupported(context);
   }
           
   public override System.ComponentModel.TypeConverter.StandardValuesCollection GetStandardValues(System.ComponentModel.ITypeDescriptorContext context)
   {
    return baseConverter.GetStandardValues(context);
   }
           
   public override bool GetStandardValuesExclusive(System.ComponentModel.ITypeDescriptorContext context)
   {
    return baseConverter.GetStandardValuesExclusive(context);
   }
           
   public override bool GetStandardValuesSupported(System.ComponentModel.ITypeDescriptorContext context)
   {
    return baseConverter.GetStandardValuesSupported(context);
   }
           
   public override object ConvertTo(System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, System.Type destinationType)
   {
    if ((context != null))
    {
     if ((context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))
     {
      return "";
     }
    }
    return baseConverter.ConvertTo(context, culture, value, destinationType);
   }
  }
       
  // 表示 WMI 系统属性的嵌入类。
  [TypeConverter(typeof(System.ComponentModel.ExpandableObjectConverter))]
   public class ManagementSystemProperties
  {
           
   private System.Management.ManagementBaseObject PrivateLateBoundObject;
           
   public ManagementSystemProperties(System.Management.ManagementBaseObject ManagedObject)
   {
    PrivateLateBoundObject = ManagedObject;
   }
           
   [Browsable(true)]
   public int GENUS
   {
    get
    {
     return ((int)(PrivateLateBoundObject["__GENUS"]));
    }
   }
           
   [Browsable(true)]
   public string CLASS
   {
    get
    {
     return ((string)(PrivateLateBoundObject["__CLASS"]));
    }
   }
           
   [Browsable(true)]
   public string SUPERCLASS
   {
    get
    {
     return ((string)(PrivateLateBoundObject["__SUPERCLASS"]));
    }
   }
           
   [Browsable(true)]
   public string DYNASTY
   {
    get
    {
     return ((string)(PrivateLateBoundObject["__DYNASTY"]));
    }
   }
           
   [Browsable(true)]
   public string RELPATH
   {
    get
    {
     return ((string)(PrivateLateBoundObject["__RELPATH"]));
    }
   }
           
   [Browsable(true)]
   public int PROPERTY_COUNT
   {
    get
    {
     return ((int)(PrivateLateBoundObject["__PROPERTY_COUNT"]));
    }
   }
           
   [Browsable(true)]
   public string[] DERIVATION
   {
    get
    {
     return ((string[])(PrivateLateBoundObject["__DERIVATION"]));
    }
   }
           
   [Browsable(true)]
   public string SERVER
   {
    get
    {
     return ((string)(PrivateLateBoundObject["__SERVER"]));
    }
   }
           
   [Browsable(true)]
   public string NAMESPACE
   {
    get
    {
     return ((string)(PrivateLateBoundObject["__NAMESPACE"]));
    }
   }
           
   [Browsable(true)]
   public string PATH
   {
    get
    {
     return ((string)(PrivateLateBoundObject["__PATH"]));
    }
   }
  }
 }

阅读全文
0 0

相关文章推荐

img
取 消
img