From fd24509ba7e19cfeadb3f2751793a81706148385 Mon Sep 17 00:00:00 2001 From: John Bampton Date: Tue, 31 Dec 2024 22:17:10 +1000 Subject: [PATCH] pre-commit: fix `.cs` files with the `trailing-whitespace` hook (#9794) Co-authored-by: Vishesh --- .pre-commit-config.yaml | 2 +- .../AgentShell/AgentService.Designer.cs | 6 +- .../ServerResource/AgentShell/AgentService.cs | 2 +- .../AgentShell/AgentSettings.Designer.cs | 74 +- .../AgentShell/ProjectInstaller.Designer.cs | 2 +- .../AgentShell/Properties/AssemblyInfo.cs | 10 +- .../HypervResource/CloudStackTypes.cs | 24 +- .../HypervResourceController.cs | 10 +- .../HypervResource/Properties/AssemblyInfo.cs | 10 +- .../HypervResource/WmiCallsV2.cs | 146 +-- .../HypervResourceController1Test.cs | 16 +- .../HypervResourceControllerTest.cs | 10 +- .../Properties/AssemblyInfo.cs | 10 +- .../WmiWrappers/Properties/AssemblyInfo.cs | 10 +- .../ROOT.CIMV2.Win32_OperatingSystem.cs | 710 +++++++------- .../WmiWrappers/ROOT.CIMV2.Win32_Processor.cs | 918 +++++++++--------- ...T.virtualization.v2.Msvm_ComputerSystem.cs | 480 ++++----- ...ROOT.virtualization.v2.Msvm_ConcreteJob.cs | 420 ++++---- ....Msvm_EthernetPortAllocationSettingData.cs | 322 +++--- ...rtualization.v2.Msvm_EthernetSwitchPort.cs | 484 ++++----- ..._EthernetSwitchPortBandwidthSettingData.cs | 260 ++--- ....Msvm_EthernetSwitchPortVlanSettingData.cs | 316 +++--- ...ualization.v2.Msvm_ExternalEthernetPort.cs | 478 ++++----- ...lization.v2.Msvm_ImageManagementService.cs | 348 +++---- ...ualization.v2.Msvm_KvpExchangeComponent.cs | 386 ++++---- ...v2.Msvm_KvpExchangeComponentSettingData.cs | 284 +++--- ...tualization.v2.Msvm_KvpExchangeDataItem.cs | 206 ++-- ...ROOT.virtualization.v2.Msvm_LANEndpoint.cs | 352 +++---- ...irtualization.v2.Msvm_MemorySettingData.cs | 304 +++--- ...OOT.virtualization.v2.Msvm_MigrationJob.cs | 444 ++++----- ...ualization.v2.Msvm_ProcessorSettingData.cs | 298 +++--- ...n.v2.Msvm_ResourceAllocationSettingData.cs | 276 +++--- ...irtualization.v2.Msvm_ShutdownComponent.cs | 384 ++++---- ...on.v2.Msvm_StorageAllocationSettingData.cs | 316 +++--- .../ROOT.virtualization.v2.Msvm_StorageJob.cs | 442 ++++----- ...rtualization.v2.Msvm_SummaryInformation.cs | 464 ++++----- ...2.Msvm_SyntheticEthernetPortSettingData.cs | 290 +++--- ...alization.v2.Msvm_VirtualEthernetSwitch.cs | 348 +++---- ..._VirtualEthernetSwitchManagementService.cs | 342 +++---- ...tion.v2.Msvm_VirtualHardDiskSettingData.cs | 326 +++---- ....v2.Msvm_VirtualSystemManagementService.cs | 382 ++++---- ...rtualSystemManagementServiceSettingData.cs | 234 ++--- ...n.v2.Msvm_VirtualSystemMigrationService.cs | 360 +++---- ....Msvm_VirtualSystemMigrationSettingData.cs | 286 +++--- ...zation.v2.Msvm_VirtualSystemSettingData.cs | 456 ++++----- ...attedData_Counters_ProcessorInformation.cs | 402 ++++---- 46 files changed, 6325 insertions(+), 6325 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5a0d792dad1..803f182f3b8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -59,7 +59,7 @@ repos: - id: mixed-line-ending exclude: \.(cs|xml)$ - id: trailing-whitespace - files: \.(bat|css|gitignore|header|in|install|java|md|properties|py|rb|sh|sql|txt|vue|xml|xsl|yaml|yml)$ + files: \.(cs|bat|css|gitignore|header|in|install|java|md|properties|py|rb|sh|sql|txt|vue|xml|xsl|yaml|yml)$ args: [--markdown-linebreak-ext=md] exclude: ^services/console-proxy/rdpconsole/src/test/doc/freerdp-debug-log\.txt$ - repo: https://github.com/codespell-project/codespell diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/AgentShell/AgentService.Designer.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/AgentShell/AgentService.Designer.cs index 4bf424fa4b9..4b4d8bd121c 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/AgentShell/AgentService.Designer.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/AgentShell/AgentService.Designer.cs @@ -18,7 +18,7 @@ namespace CloudStack.Plugin.AgentShell { partial class AgentService { - /// + /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; @@ -38,8 +38,8 @@ namespace CloudStack.Plugin.AgentShell #region Component Designer generated code - /// - /// Required method for Designer support - do not modify + /// + /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/AgentShell/AgentService.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/AgentShell/AgentService.cs index 94b640edd1b..e2fecd52e47 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/AgentShell/AgentService.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/AgentShell/AgentService.cs @@ -67,7 +67,7 @@ namespace CloudStack.Plugin.AgentShell public static void ConfigServerResource() { // For simplicity, ServerResource config and settings file are tightly coupled. - // An alternative is to pass a dictionary to the server resource and let it find + // An alternative is to pass a dictionary to the server resource and let it find // required settings. In contrast, the approach below is strongly typed and makes // use of VisualStudio settings designer. The designer allows us to avoid // accessing config using their key strings. diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/AgentShell/AgentSettings.Designer.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/AgentShell/AgentSettings.Designer.cs index fc3b69af3e8..5e89a18fb2d 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/AgentShell/AgentSettings.Designer.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/AgentShell/AgentSettings.Designer.cs @@ -16,20 +16,20 @@ // under the License. namespace CloudStack.Plugin.AgentShell { - - + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] public sealed partial class AgentSettings : global::System.Configuration.ApplicationSettingsBase { - + private static AgentSettings defaultInstance = ((AgentSettings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new AgentSettings()))); - + public static AgentSettings Default { get { return defaultInstance; } } - + [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("8")] @@ -38,7 +38,7 @@ namespace CloudStack.Plugin.AgentShell { return ((int)(this["cpus"])); } } - + [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("Routing")] @@ -47,7 +47,7 @@ namespace CloudStack.Plugin.AgentShell { return ((string)(this["type"])); } } - + [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("5fe2bad3-d785-394e-9949-89786b8a63d2")] @@ -56,7 +56,7 @@ namespace CloudStack.Plugin.AgentShell { return ((global::System.Guid)(this["local_storage_uuid"])); } } - + [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("hvm")] @@ -65,7 +65,7 @@ namespace CloudStack.Plugin.AgentShell { return ((string)(this["capabilities"])); } } - + [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("2130")] @@ -74,7 +74,7 @@ namespace CloudStack.Plugin.AgentShell { return ((int)(this["Settingcpuspeed"])); } } - + [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("8250")] @@ -83,7 +83,7 @@ namespace CloudStack.Plugin.AgentShell { return ((int)(this["port"])); } } - + [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("34359738368")] @@ -92,7 +92,7 @@ namespace CloudStack.Plugin.AgentShell { return ((long)(this["memory"])); } } - + [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("camldonall01.citrite.net")] @@ -101,7 +101,7 @@ namespace CloudStack.Plugin.AgentShell { return ((string)(this["host"])); } } - + [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("1")] @@ -110,7 +110,7 @@ namespace CloudStack.Plugin.AgentShell { return ((int)(this["pod"])); } } - + [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("10.1.1.1")] @@ -119,7 +119,7 @@ namespace CloudStack.Plugin.AgentShell { return ((string)(this["gateway_ip_address"])); } } - + [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public global::System.Guid guid { @@ -127,7 +127,7 @@ namespace CloudStack.Plugin.AgentShell { return ((global::System.Guid)(this["guid"])); } } - + [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("2")] @@ -136,7 +136,7 @@ namespace CloudStack.Plugin.AgentShell { return ((int)(this["cluster"])); } } - + [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("1")] @@ -145,7 +145,7 @@ namespace CloudStack.Plugin.AgentShell { return ((int)(this["zone"])); } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("c:\\Secondary")] @@ -157,7 +157,7 @@ namespace CloudStack.Plugin.AgentShell { this["local_secondary_storage_path"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("E:\\Disks\\Disks")] @@ -169,7 +169,7 @@ namespace CloudStack.Plugin.AgentShell { this["local_storage_path"] = value; } } - + [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("5")] @@ -178,7 +178,7 @@ namespace CloudStack.Plugin.AgentShell { return ((int)(this["workers"])); } } - + [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("255.255.240.0")] @@ -187,7 +187,7 @@ namespace CloudStack.Plugin.AgentShell { return ((string)(this["private_ip_netmask"])); } } - + [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("4294967296")] @@ -196,7 +196,7 @@ namespace CloudStack.Plugin.AgentShell { return ((long)(this["RootDeviceReservedSpaceBytes"])); } } - + [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("../../../../../")] @@ -205,7 +205,7 @@ namespace CloudStack.Plugin.AgentShell { return ((string)(this["hyperv_plugin_root"])); } } - + [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("e:\\")] @@ -214,7 +214,7 @@ namespace CloudStack.Plugin.AgentShell { return ((string)(this["RootDeviceName"])); } } - + [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("101F742C6B88")] @@ -247,7 +247,7 @@ namespace CloudStack.Plugin.AgentShell { this["testLocalStorePath"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("testS3Bucket")] @@ -259,7 +259,7 @@ namespace CloudStack.Plugin.AgentShell { this["testS3Bucket"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("testS3Endpoint")] @@ -271,7 +271,7 @@ namespace CloudStack.Plugin.AgentShell { this["testS3Endpoint"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("testS3AccessKey")] @@ -283,7 +283,7 @@ namespace CloudStack.Plugin.AgentShell { this["testS3AccessKey"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("testS3SecretKey")] @@ -295,7 +295,7 @@ namespace CloudStack.Plugin.AgentShell { this["testS3SecretKey"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("206-2-73592258-559a-3b38-8f66-b667aab143eb")] @@ -307,7 +307,7 @@ namespace CloudStack.Plugin.AgentShell { this["testS3TemplateName"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("5fe2bad3-d785-394e-9949-89786b8a63d2")] @@ -319,7 +319,7 @@ namespace CloudStack.Plugin.AgentShell { this["testLocalStoreUUID"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("acton-systemvm-02062012.vhd.bz2")] @@ -331,7 +331,7 @@ namespace CloudStack.Plugin.AgentShell { this["testSystemVMTemplateName"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("acton-systemvm-02062012")] @@ -343,7 +343,7 @@ namespace CloudStack.Plugin.AgentShell { this["testSystemVMTemplateNameNoExt"] = value; } } - + [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("2048")] @@ -352,7 +352,7 @@ namespace CloudStack.Plugin.AgentShell { return ((ulong)(this["dom0MinMemory"])); } } - + [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("10.1.1.1")] @@ -361,7 +361,7 @@ namespace CloudStack.Plugin.AgentShell { return ((string)(this["private_ip_address"])); } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("cifs://10.1.1.1/secondary?user\\u003dadministrator\\u0026password\\u003d1pass%40w" + @@ -374,7 +374,7 @@ namespace CloudStack.Plugin.AgentShell { this["testCifsUrl"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("template/tmpl/2/201/61d5316a-3cc4-30cf-a557-78691ff5c143.vhd")] diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/AgentShell/ProjectInstaller.Designer.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/AgentShell/ProjectInstaller.Designer.cs index 2c6ffe24462..3668a592732 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/AgentShell/ProjectInstaller.Designer.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/AgentShell/ProjectInstaller.Designer.cs @@ -23,7 +23,7 @@ namespace CloudStack.Plugin.AgentShell /// private System.ComponentModel.IContainer components = null; - /// + /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/AgentShell/Properties/AssemblyInfo.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/AgentShell/Properties/AssemblyInfo.cs index bd188bb0ef2..1216f9b1fcb 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/AgentShell/Properties/AssemblyInfo.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/AgentShell/Properties/AssemblyInfo.cs @@ -19,7 +19,7 @@ using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("AgentShell")] @@ -31,8 +31,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] @@ -42,11 +42,11 @@ using System.Runtime.InteropServices; // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/CloudStackTypes.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/CloudStackTypes.cs index 306bc96f8c9..2e3de19939d 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/CloudStackTypes.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/CloudStackTypes.cs @@ -26,7 +26,7 @@ using System.Threading.Tasks; // C# versions of certain CloudStack types to simplify JSON serialisation. // Limit to the number of types, because they are written and maintained manually. // JsonProperty used to identify property name when serialised, which allows -// later adoption of C# naming conventions if requried. +// later adoption of C# naming conventions if requried. namespace HypervResource { public class PrimaryDataStoreTO @@ -474,15 +474,15 @@ namespace HypervResource /// Filesystem, /// - /// NFS or CIFS + /// NFS or CIFS /// NetworkFilesystem, /// - /// shared LUN, with a clusterfs overlay + /// shared LUN, with a clusterfs overlay /// IscsiLUN, /// - /// for e.g., ZFS Comstar + /// for e.g., ZFS Comstar /// Iscsi, /// @@ -494,31 +494,31 @@ namespace HypervResource /// LVM, /// - /// + /// /// CLVM, /// - /// + /// /// RBD, /// - /// + /// /// SharedMountPoint, /// - /// VMware VMFS storage + /// VMware VMFS storage /// VMFS, /// - /// for XenServer, Storage Pool is set up by customers. + /// for XenServer, Storage Pool is set up by customers. /// PreSetup, /// - /// XenServer local EXT SR + /// XenServer local EXT SR /// EXT, /// - /// + /// /// OCFS2, /// @@ -662,7 +662,7 @@ namespace HypervResource } /// - /// Fully qualified named for a number of types used in CloudStack. Used to specify the intended type for JSON serialised objects. + /// Fully qualified named for a number of types used in CloudStack. Used to specify the intended type for JSON serialised objects. /// public class CloudStackTypes { diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs index 59397e8fba8..7e31ced3e38 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs @@ -129,7 +129,7 @@ namespace HypervResource /// /// /// POST takes dynamic to allow it to receive JSON without concern for what is the underlying object. - /// E.g. http://stackoverflow.com/questions/14071715/passing-dynamic-json-object-to-web-api-newtonsoft-example + /// E.g. http://stackoverflow.com/questions/14071715/passing-dynamic-json-object-to-web-api-newtonsoft-example /// and http://stackoverflow.com/questions/3142495/deserialize-json-into-c-sharp-dynamic-object /// Use ActionName attribute to allow multiple POST URLs, one for each supported command /// E.g. http://stackoverflow.com/a/12703423/939250 @@ -141,7 +141,7 @@ namespace HypervResource /// Exceptions handled on command by command basis rather than globally to allow details of the command /// to be reflected in the response. Default error handling is in the catch for Exception, but /// other exception types may be caught where the feedback would be different. - /// NB: global alternatives discussed at + /// NB: global alternatives discussed at /// http://weblogs.asp.net/fredriknormen/archive/2012/06/11/asp-net-web-api-exception-handling.aspx /// /// @@ -174,7 +174,7 @@ namespace HypervResource } /// - /// NOP - placeholder for future setup, e.g. delete existing VMs or Network ports + /// NOP - placeholder for future setup, e.g. delete existing VMs or Network ports /// POST api/HypervResource/SetupCommand /// /// @@ -486,7 +486,7 @@ namespace HypervResource } } - + private static JArray ReturnCloudStackTypedJArray(object ansContent, string ansType) { JObject ansObj = Utils.CreateCloudStackObject(ansType, ansContent); @@ -705,7 +705,7 @@ namespace HypervResource /// +-System.UnauthorizedAccessException /// +-System.IO.IOException /// +-System.IO.PathTooLongException - /// + /// /// Exceptions related to HTTP URIs /// System.SystemException /// +-System.InvalidOperationException diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/Properties/AssemblyInfo.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/Properties/AssemblyInfo.cs index 7bbc9b55adb..6a05afa8f7f 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/Properties/AssemblyInfo.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/Properties/AssemblyInfo.cs @@ -19,7 +19,7 @@ using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("HypervResource")] @@ -31,8 +31,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] @@ -42,11 +42,11 @@ using System.Runtime.InteropServices; // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCallsV2.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCallsV2.cs index d385a8e67ab..6f0327845a0 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCallsV2.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCallsV2.cs @@ -111,7 +111,7 @@ namespace HypervResource return vm; } - + /// /// Returns ComputerSystem lacking any NICs and VOLUMEs /// @@ -164,7 +164,7 @@ namespace HypervResource // Obtain controller for Hyper-V networking subsystem var vmNetMgmtSvc = GetVirtualSwitchManagementService(); - // Create NIC resource by cloning the default NIC + // Create NIC resource by cloning the default NIC var synthNICsSettings = SyntheticEthernetPortSettingData.GetInstances(vmNetMgmtSvc.Scope, "InstanceID LIKE \"%Default\""); // Assert @@ -217,7 +217,7 @@ namespace HypervResource public const string HARDDISK_DISK = "Microsoft:Hyper-V:Virtual Hard Disk"; // For IDE_HARDDISK_DRIVE /// - /// Create new VM. By default we start it. + /// Create new VM. By default we start it. /// public ComputerSystem DeployVirtualMachine(dynamic jsonObj, string systemVmIso) { @@ -351,9 +351,9 @@ namespace HypervResource break; case "DATADISK": break; - default: + default: // TODO: double check exception type - errMsg = string.Format("Unknown disk type {0} for disk {1}, vm named {2}", + errMsg = string.Format("Unknown disk type {0} for disk {1}, vm named {2}", string.IsNullOrEmpty(driveType) ? "NULL" : driveType, string.IsNullOrEmpty(diskName) ? "NULL" : diskName, vmName); var ex = new WmiException(errMsg); @@ -452,9 +452,9 @@ namespace HypervResource SetBandWidthLimit((ulong)networkRateMbps, portSettings); } - logger.DebugFormat("Created adapter {0} on port {1}, {2}", + logger.DebugFormat("Created adapter {0} on port {1}, {2}", newAdapter.Path, portSettings.Path, (vlan == null ? "No VLAN" : "VLAN " + vlan)); - // logger.DebugFormat("Created adapter {0} on port {1}, {2}", + // logger.DebugFormat("Created adapter {0} on port {1}, {2}", // newAdapter.Path, portSettings.Path, (vlan == null ? "No VLAN" : "VLAN " + vlan)); } } @@ -468,7 +468,7 @@ namespace HypervResource var vm = GetComputerSystem(vmName); if (bootArgs != null && !String.IsNullOrEmpty((string)bootArgs)) { - + String bootargs = bootArgs; AddUserData(vm, bootargs); } @@ -576,7 +576,7 @@ namespace HypervResource } /// this method is to add a dvd drive and attach the systemvm iso. - /// + /// public void patchSystemVmIso(String vmName, String systemVmIso) { ComputerSystem vmObject = GetComputerSystem(vmName); @@ -611,7 +611,7 @@ namespace HypervResource /// IDE_HARDDISK_DRIVE or IDE_ISO_DRIVE public ManagementPath AddDiskDriveToIdeController(ComputerSystem vm, string vhdfile, string cntrllerAddr, string driveResourceType) { - logger.DebugFormat("Creating DISK for VM {0} (GUID {1}) by attaching {2}", + logger.DebugFormat("Creating DISK for VM {0} (GUID {1}) by attaching {2}", vm.ElementName, vm.Name, vhdfile); @@ -622,13 +622,13 @@ namespace HypervResource case HARDDISK_DRIVE: diskResourceSubType = HARDDISK_DISK; break; - case ISO_DRIVE: + case ISO_DRIVE: diskResourceSubType = ISO_DISK; break; default: var errMsg = string.Format( "Unrecognised disk drive type {0} for VM {1} (GUID {2})", - string.IsNullOrEmpty(driveResourceType) ? "NULL": driveResourceType, + string.IsNullOrEmpty(driveResourceType) ? "NULL": driveResourceType, vm.ElementName, vm.Name); var ex = new WmiException(errMsg); @@ -886,7 +886,7 @@ namespace HypervResource } /// - /// Create Msvm_StorageAllocationSettingData corresponding to the ISO image, and + /// Create Msvm_StorageAllocationSettingData corresponding to the ISO image, and /// associate this with the VM's DVD drive. /// private void AttachIso(ComputerSystem vm, string isoPath) @@ -1191,7 +1191,7 @@ namespace HypervResource string vmToDestroy = jsonObj.vmName; DestroyVm(vmToDestroy); } - + /// /// Remove all VMs and all SwitchPorts with the displayName. VHD gets deleted elsewhere. /// @@ -1461,7 +1461,7 @@ namespace HypervResource /// /// Path that uniquely identifies the resource. /// VM to which the disk image will be attached. - // Add new + // Add new private void RemoveNetworkResource(ManagementPath resourcePath) { var virtSwitchMgmtSvc = GetVirtualSwitchManagementService(); @@ -1523,9 +1523,9 @@ namespace HypervResource public void SetState(ComputerSystem vm, ushort requiredState) { logger.InfoFormat( - "Changing state of {0} (GUID {1}) to {2}", - vm.ElementName, - vm.Name, + "Changing state of {0} (GUID {1}) to {2}", + vm.ElementName, + vm.Name, RequiredState.ToString(requiredState)); ManagementPath jobPath; @@ -1555,9 +1555,9 @@ namespace HypervResource } logger.InfoFormat( - "Successfully changed vm state of {0} (GUID {1} to requested state {2}", - vm.ElementName, - vm.Name, + "Successfully changed vm state of {0} (GUID {1} to requested state {2}", + vm.ElementName, + vm.Name, requiredState); } @@ -1589,9 +1589,9 @@ namespace HypervResource public SyntheticEthernetPortSettingData GetSyntheticEthernetPortSettings(EthernetSwitchPort port) { - // An ASSOCIATOR object provides the cross reference from the EthernetSwitchPort and the + // An ASSOCIATOR object provides the cross reference from the EthernetSwitchPort and the // SyntheticEthernetPortSettingData, but generated wrappers do not expose a ASSOCIATOR OF query as a method. - // Instead, we use the System.Management to code the equivalant of + // Instead, we use the System.Management to code the equivalant of // string query = string.Format( "ASSOCIATORS OF {{{0}}} WHERE ResultClass = {1}", vm.path, resultclassName); // var wmiObjQuery = new RelatedObjectQuery(port.Path.Path, SyntheticEthernetPortSettingData.CreatedClassName); @@ -1620,7 +1620,7 @@ namespace HypervResource /// Msvm_StorageAllocationSettings with HostResource configured with image /// file and Parent set to a controller associated with the ComputerSystem /// VM to which the disk image will be attached. - // Add new + // Add new private ManagementPath[] AddStorageResource(string[] storageSettings, ComputerSystem vm) { return AddVirtualResource(storageSettings, vm); @@ -1697,7 +1697,7 @@ namespace HypervResource var vmVirtMgmtSvc = GetVirtualisationSystemManagementService(); EthernetSwitchPortVlanSettingData.GetInstances(); - // Create NIC resource by cloning the default NIC + // Create NIC resource by cloning the default NIC var vlanSettings = EthernetSwitchPortVlanSettingData.GetInstances(vmVirtMgmtSvc.Scope, "InstanceID LIKE \"%Default\""); // Assert @@ -1783,7 +1783,7 @@ namespace HypervResource /// /// With V1 API, external ethernet port was attached to the land endpoint, which was attached to the switch. /// e.g. Msvm_ExternalEthernetPort -> SwitchLANEndpoint -> SwitchPort -> VirtualSwitch - /// + /// /// With V2 API, there are two kinds of lan endpoint: one on the computer system and one on the switch /// e.g. Msvm_ExternalEthernetPort -> LANEndpoint -> LANEdnpoint -> EthernetSwitchPort -> VirtualEthernetSwitch /// @@ -1800,7 +1800,7 @@ namespace HypervResource logger.Error(errMsg, ex); throw ex; } - foreach(ExternalEthernetPort externNIC in externNICs.OfType()) { + foreach(ExternalEthernetPort externNIC in externNICs.OfType()) { // A sequence of ASSOCIATOR objects need to be traversed to get from external NIC the vswitch. // We use ManagementObjectSearcher objects to execute this sequence of questions // NB: default scope of ManagementObjectSearcher is '\\.\root\cimv2', which does not contain @@ -1822,7 +1822,7 @@ namespace HypervResource var switchEndpointQuery = new RelatedObjectQuery(adapterEndPoint.Path.Path, LANEndpoint.CreatedClassName); var switchEndpointSearch = new ManagementObjectSearcher(externNIC.Scope, switchEndpointQuery); var switchEndpointCollection = new LANEndpoint.LANEndpointCollection(switchEndpointSearch.Get()); - + // assert if (endpointCollection.Count < 1) { @@ -1831,12 +1831,12 @@ namespace HypervResource logger.Error(errMsg, ex); throw ex; } - + LANEndpoint switchEndPoint = switchEndpointCollection.OfType().First(); var switchPortQuery = new RelatedObjectQuery(switchEndPoint.Path.Path, EthernetSwitchPort.CreatedClassName); var switchPortSearch = new ManagementObjectSearcher(switchEndPoint.Scope, switchPortQuery); var switchPortCollection = new EthernetSwitchPort.EthernetSwitchPortCollection(switchPortSearch.Get()); - + // assert if (switchPortCollection.Count < 1 ) { @@ -1845,7 +1845,7 @@ namespace HypervResource logger.Error(errMsg, ex); throw ex; } - + EthernetSwitchPort switchPort = switchPortCollection.OfType().First(); var vSwitchQuery = new RelatedObjectQuery(switchPort.Path.Path, VirtualEthernetSwitch.CreatedClassName); var vSwitchSearch = new ManagementObjectSearcher(externNIC.Scope, vSwitchQuery); @@ -2001,7 +2001,7 @@ namespace HypervResource private static ComputerSystem CreateDefaultVm(VirtualSystemManagementService vmMgmtSvc, string name) { - // Tweak default settings by basing new VM on default global setting object + // Tweak default settings by basing new VM on default global setting object // with designed display name. UInt16 startupAction = 2; // Do nothing. UInt16 stopAction = 4; // Shutdown. @@ -2142,7 +2142,7 @@ namespace HypervResource { // VirtualSystemManagementService is a singleton, most anonymous way of lookup is by asking for the set // of local instances, which should be size 1. - + var virtSysMgmtSvcCollection = VirtualSystemManagementService.GetInstances(); foreach (VirtualSystemManagementService item in virtSysMgmtSvcCollection) { @@ -2192,8 +2192,8 @@ namespace HypervResource if (jobObj.JobState != JobState.Completed) { var errMsg = string.Format( - "Hyper-V Job failed, Error Code:{0}, Description: {1}", - jobObj.ErrorCode, + "Hyper-V Job failed, Error Code:{0}, Description: {1}", + jobObj.ErrorCode, jobObj.ErrorDescription); var ex = new WmiException(errMsg); logger.Error(errMsg, ex); @@ -2269,18 +2269,18 @@ namespace HypervResource sockets++; } } - + public void GetProcessorUsageInfo(out double cpuUtilization) { - PerfFormattedData_Counters_ProcessorInformation.PerfFormattedData_Counters_ProcessorInformationCollection coll = + PerfFormattedData_Counters_ProcessorInformation.PerfFormattedData_Counters_ProcessorInformationCollection coll = PerfFormattedData_Counters_ProcessorInformation.GetInstances("Name=\"_Total\""); cpuUtilization = 100; // Use the first one foreach (PerfFormattedData_Counters_ProcessorInformation procInfo in coll) { - // Idle during a given internal + // Idle during a given internal // See http://library.wmifun.net/cimv2/win32_perfformatteddata_counters_processorinformation.html - cpuUtilization = 100.0 - (double)procInfo.PercentIdleTime; + cpuUtilization = 100.0 - (double)procInfo.PercentIdleTime; } } @@ -2308,7 +2308,7 @@ namespace HypervResource logger.Error(errMsg); return null; } - + return defaultVirtualHardDiskPath; } @@ -2376,9 +2376,9 @@ namespace HypervResource public ProcessorSettingData GetProcSettings(VirtualSystemSettingData vmSettings) { - // An ASSOCIATOR object provides the cross reference from the VirtualSystemSettingData and the + // An ASSOCIATOR object provides the cross reference from the VirtualSystemSettingData and the // ProcessorSettingData, but generated wrappers do not expose a ASSOCIATOR OF query as a method. - // Instead, we use the System.Management to code the equivalant of + // Instead, we use the System.Management to code the equivalant of // string query = string.Format( "ASSOCIATORS OF {{{0}}} WHERE ResultClass = {1}", vmSettings.path, resultclassName); // var wmiObjQuery = new RelatedObjectQuery(vmSettings.Path.Path, ProcessorSettingData.CreatedClassName); @@ -2401,9 +2401,9 @@ namespace HypervResource public MemorySettingData GetMemSettings(VirtualSystemSettingData vmSettings) { - // An ASSOCIATOR object provides the cross reference from the VirtualSystemSettingData and the + // An ASSOCIATOR object provides the cross reference from the VirtualSystemSettingData and the // MemorySettingData, but generated wrappers do not expose a ASSOCIATOR OF query as a method. - // Instead, we use the System.Management to code the equivalant of + // Instead, we use the System.Management to code the equivalant of // string query = string.Format( "ASSOCIATORS OF {{{0}}} WHERE ResultClass = {1}", vmSettings.path, resultclassName); // var wmiObjQuery = new RelatedObjectQuery(vmSettings.Path.Path, MemorySettingData.CreatedClassName); @@ -2431,7 +2431,7 @@ namespace HypervResource foreach (ResourceAllocationSettingData wmiObj in wmiObjCollection) { - // DVD drive is '16', see http://msdn.microsoft.com/en-us/library/hh850200(v=vs.85).aspx + // DVD drive is '16', see http://msdn.microsoft.com/en-us/library/hh850200(v=vs.85).aspx if (wmiObj.ResourceType == 16) { return wmiObj; @@ -2459,8 +2459,8 @@ namespace HypervResource } var errMsg = string.Format( - "Cannot find the Microsoft Emulated IDE Controlle at address {0} in VirtualSystemSettingData {1}", - cntrllerAddr, + "Cannot find the Microsoft Emulated IDE Controlle at address {0} in VirtualSystemSettingData {1}", + cntrllerAddr, vmSettings.Path.Path); var ex = new WmiException(errMsg); logger.Error(errMsg, ex); @@ -2488,8 +2488,8 @@ namespace HypervResource } /// - /// VM resources, typically hardware a described by a generic MSVM_ResourceAllocationSettingData object. The hardware type being - /// described is identified in two ways: in general terms using an enum in the ResourceType field, and in terms of the implementation + /// VM resources, typically hardware a described by a generic MSVM_ResourceAllocationSettingData object. The hardware type being + /// described is identified in two ways: in general terms using an enum in the ResourceType field, and in terms of the implementation /// using text in the ResourceSubType field. /// See http://msdn.microsoft.com/en-us/library/cc136877%28v=vs.85%29.aspx /// @@ -2497,9 +2497,9 @@ namespace HypervResource /// public ResourceAllocationSettingData.ResourceAllocationSettingDataCollection GetResourceAllocationSettings(VirtualSystemSettingData vmSettings) { - // An ASSOCIATOR object provides the cross reference from the VirtualSystemSettingData and the + // An ASSOCIATOR object provides the cross reference from the VirtualSystemSettingData and the // ResourceAllocationSettingData, but generated wrappers do not expose a ASSOCIATOR OF query as a method. - // Instead, we use the System.Management to code the equivalant of + // Instead, we use the System.Management to code the equivalant of // string query = string.Format( "ASSOCIATORS OF {{{0}}} WHERE ResultClass = {1}", vmSettings.path, resultclassName); // var wmiObjQuery = new RelatedObjectQuery(vmSettings.Path.Path, ResourceAllocationSettingData.CreatedClassName); @@ -2525,9 +2525,9 @@ namespace HypervResource // ComputerSystem -> VirtualSystemSettingData -> EthernetPortAllocationSettingData VirtualSystemSettingData vmSettings = GetVmSettings(vm); - // An ASSOCIATOR object provides the cross reference from the VirtualSystemSettingData and the + // An ASSOCIATOR object provides the cross reference from the VirtualSystemSettingData and the // EthernetPortAllocationSettingData, but generated wrappers do not expose a ASSOCIATOR OF query as a method. - // Instead, we use the System.Management to code the equivalant of + // Instead, we use the System.Management to code the equivalant of // string query = string.Format( "ASSOCIATORS OF {{{0}}} WHERE ResultClass = {1}", vmSettings.path, resultclassName); // var wmiObjQuery = new RelatedObjectQuery(vmSettings.Path.Path, EthernetPortAllocationSettingData.CreatedClassName); @@ -2568,9 +2568,9 @@ namespace HypervResource public EthernetSwitchPortVlanSettingData GetVlanSettings(EthernetPortAllocationSettingData ethernetConnection) { - // An ASSOCIATOR object provides the cross reference from the VirtualSystemSettingData and the + // An ASSOCIATOR object provides the cross reference from the VirtualSystemSettingData and the // EthernetPortAllocationSettingData, but generated wrappers do not expose a ASSOCIATOR OF query as a method. - // Instead, we use the System.Management to code the equivalant of + // Instead, we use the System.Management to code the equivalant of // string query = string.Format( "ASSOCIATORS OF {{{0}}} WHERE ResultClass = {1}", vmSettings.path, resultclassName); // var wmiObjQuery = new RelatedObjectQuery(ethernetConnection.Path.Path, EthernetSwitchPortVlanSettingData.CreatedClassName); @@ -2596,14 +2596,14 @@ namespace HypervResource return wmiObjCollection.OfType().First(); } - + public SyntheticEthernetPortSettingData[] GetEthernetPortSettings(ComputerSystem vm) { - // An ASSOCIATOR object provides the cross reference from the ComputerSettings and the + // An ASSOCIATOR object provides the cross reference from the ComputerSettings and the // SyntheticEthernetPortSettingData, via the VirtualSystemSettingData. // However, generated wrappers do not expose a ASSOCIATOR OF query as a method. - // Instead, we use the System.Management to code the equivalant of + // Instead, we use the System.Management to code the equivalant of // // string query = string.Format( "ASSOCIATORS OF {{{0}}} WHERE ResultClass = {1}", vm.path, resultclassName); // @@ -2640,9 +2640,9 @@ namespace HypervResource public VirtualSystemSettingData GetVmSettings(ComputerSystem vm) { - // An ASSOCIATOR object provides the cross reference from the ComputerSettings and the + // An ASSOCIATOR object provides the cross reference from the ComputerSettings and the // VirtualSystemSettingData, but generated wrappers do not expose a ASSOCIATOR OF query as a method. - // Instead, we use the System.Management to code the equivalant of + // Instead, we use the System.Management to code the equivalant of // string query = string.Format( "ASSOCIATORS OF {{{0}}} WHERE ResultClass = {1}", vm.path, resultclassName); // var wmiObjQuery = new RelatedObjectQuery(vm.Path.Path, VirtualSystemSettingData.CreatedClassName); @@ -2671,9 +2671,9 @@ namespace HypervResource public KvpExchangeComponentSettingData GetKvpSettings(VirtualSystemSettingData vmSettings) { - // An ASSOCIATOR object provides the cross reference from the VirtualSystemSettingData and the + // An ASSOCIATOR object provides the cross reference from the VirtualSystemSettingData and the // KvpExchangeComponentSettingData, but generated wrappers do not expose a ASSOCIATOR OF query as a method. - // Instead, we use the System.Management to code the equivalant of + // Instead, we use the System.Management to code the equivalant of // string query = string.Format( "ASSOCIATORS OF {{{0}}} WHERE ResultClass = {1}", vmSettings.path, resultclassName); // var wmiObjQuery = new RelatedObjectQuery(vmSettings.Path.Path, KvpExchangeComponentSettingData.CreatedClassName); @@ -2700,7 +2700,7 @@ namespace HypervResource { return; } - // Process info available from WMI, + // Process info available from WMI, // See http://msdn.microsoft.com/en-us/library/hh850062(v=vs.85).aspx uint[] requestedInfo = new uint[] { // TODO: correct? 0, // Name @@ -2887,7 +2887,7 @@ namespace HypervResource /// http://msdn.microsoft.com/en-us/library/hh850116(v=vs.85).aspx#methods /// However, the CIM standard has additional possibilities based on the description /// of EnabledState. - /// The previous V1 API is described by + /// The previous V1 API is described by /// http://msdn.microsoft.com/en-us/library/cc136822%28v=vs.85%29.aspx /// public class EnabledState @@ -2914,27 +2914,27 @@ namespace HypervResource public const UInt16 Suspended = 32769; /// /// The VM is starting. This is a transitional state between 3 (Disabled) - /// or 32769 (Suspended) and 2 (Enabled) initiated by a call to the + /// or 32769 (Suspended) and 2 (Enabled) initiated by a call to the /// RequestStateChange method with a RequestedState parameter of 2 (Enabled). /// public const UInt16 Starting = 32770; /// - /// Starting with Windows Server 2008 R2 this value is not supported. - /// If the VM is performing a snapshot operation, the element at index 1 - /// of the OperationalStatus property array will contain 32768 (Creating Snapshot), + /// Starting with Windows Server 2008 R2 this value is not supported. + /// If the VM is performing a snapshot operation, the element at index 1 + /// of the OperationalStatus property array will contain 32768 (Creating Snapshot), /// 32769 (Applying Snapshot), or 32770 (Deleting Snapshot). /// public const UInt16 Snapshotting = 32771; /// /// The VM is saving its state. This is a transitional state between 2 (Enabled) - /// and 32769 (Suspended) initiated by a call to the RequestStateChange method + /// and 32769 (Suspended) initiated by a call to the RequestStateChange method /// with a RequestedState parameter of 32769 (Suspended). /// public const UInt16 Saving = 32773; /// - /// The VM is turning off. This is a transitional state between 2 (Enabled) - /// and 3 (Disabled) initiated by a call to the RequestStateChange method - /// with a RequestedState parameter of 3 (Disabled) or a guest operating system + /// The VM is turning off. This is a transitional state between 2 (Enabled) + /// and 3 (Disabled) initiated by a call to the RequestStateChange method + /// with a RequestedState parameter of 3 (Disabled) or a guest operating system /// initiated power off. /// public const UInt16 Stopping = 32774; @@ -2980,7 +2980,7 @@ namespace HypervResource case Saving: result = "Saving"; break; case Stopping: result = "Stopping"; break; case Pausing: result = "Unknown"; break; - case Resuming: result = "Starting"; break; + case Resuming: result = "Starting"; break; } return result; } diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/ServerResource.Tests/HypervResourceController1Test.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/ServerResource.Tests/HypervResourceController1Test.cs index 91d41e63b9b..91194a1424d 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/ServerResource.Tests/HypervResourceController1Test.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/ServerResource.Tests/HypervResourceController1Test.cs @@ -66,7 +66,7 @@ namespace ServerResource.Tests /// /// Test WmiCalls to which incoming HTTP POST requests are dispatched. - /// + /// /// TODO: revise beyond first approximation /// First approximation is a quick port of the existing Java tests for Hyper-V server resource. /// A second approximation would use the AgentShell settings files directly. @@ -117,10 +117,10 @@ namespace ServerResource.Tests // Clean up old test files in local storage folder FileInfo testVolWorks = new FileInfo(Path.Combine(testLocalStorePath, testSampleVolumeWorkingUUID)); - // Assert.True(testVolWorks.Exists, "Create a working virtual disk at " + testVolWorks.FullName); - + // Assert.True(testVolWorks.Exists, "Create a working virtual disk at " + testVolWorks.FullName); + testSampleTemplateURLJSON = JsonConvert.SerializeObject(testSampleTemplateUUID); - s_logger.Info("Created " + testSampleTemplateURLJSON + " in local storage."); + s_logger.Info("Created " + testSampleTemplateURLJSON + " in local storage."); // Capture other JSON encoded paths @@ -150,7 +150,7 @@ namespace ServerResource.Tests return JsonConvert.SerializeObject(newFileInfo.FullName); } - + [Fact] public void TestCreateCommand() { @@ -267,7 +267,7 @@ namespace ServerResource.Tests Assert.NotNull(startAns[0][CloudStackTypes.StartAnswer]); Assert.True((bool)startAns[0][CloudStackTypes.StartAnswer].result, "StartCommand did not succeed " + startAns[0][CloudStackTypes.StartAnswer].details); - Assert.Null((string)startAns[0][CloudStackTypes.StartAnswer].details); + Assert.Null((string)startAns[0][CloudStackTypes.StartAnswer].details); } [Fact] @@ -323,7 +323,7 @@ namespace ServerResource.Tests "\"volumeId\":10," + // "\"vmName\":\"i-3-5-VM\"," + // TODO: do we have to fill in the vmName? "\"accountId\":3,\"id\":10}" + - "}"; // end of destTO + "}"; // end of destTO return sampleVolumeObjectTO; } @@ -345,6 +345,6 @@ namespace ServerResource.Tests "\"broadcastUri\":\"vlan://261\",\"isolationUri\":\"vlan://261\",\"isSecurityGroupEnabled\":false}" + "]},\"contextMap\":{},\"wait\":0}"; return sample; - } + } } } diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/ServerResource.Tests/HypervResourceControllerTest.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/ServerResource.Tests/HypervResourceControllerTest.cs index 7f03e151253..f8761867b18 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/ServerResource.Tests/HypervResourceControllerTest.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/ServerResource.Tests/HypervResourceControllerTest.cs @@ -64,7 +64,7 @@ namespace ServerResource.Tests /// /// Test WmiCalls to which incoming HTTP POST requests are dispatched. - /// + /// /// TODO: revise beyond first approximation /// First approximation is a quick port of the existing Java tests for Hyper-V server resource. /// A second approximation would use the AgentShell settings files directly. @@ -326,7 +326,7 @@ namespace ServerResource.Tests "\"volumeId\":10," + // "\"vmName\":\"i-3-5-VM\"," + // TODO: do we have to fill in the vmName? "\"accountId\":3,\"id\":10}" + - "}"; // end of destTO + "}"; // end of destTO return sampleVolumeObjectTO; } @@ -443,7 +443,7 @@ namespace ServerResource.Tests "\"vmName\":\"i-3-5-VM\"," + "\"accountId\":3," + "\"id\":10 }" + - "}," + // end of destTO + "}," + // end of destTO "\"wait\":0}"; // end of Copy Command #endregion //"name":"ROOT-8","size":140616708,"volumeId":8,"vmName":"s-8-VM","accountId":1,"id":8}},"contextMap":{},"wait":0} @@ -562,7 +562,7 @@ namespace ServerResource.Tests "\"vmName\":\"i-3-5-VM\"," + "\"accountId\":1," + "\"id\":10}" + - "}," + // end of destTO + "}," + // end of destTO "\"wait\":0}"; // end of Copy Command #endregion @@ -1117,7 +1117,7 @@ namespace ServerResource.Tests string strippedExpectedMac = expectedMac.Replace(":", string.Empty); Assert.Equal(nicSettingsViaVm[0].Address.ToLower(), strippedExpectedMac.ToLower()); - // Assert switchport has correct VLAN + // Assert switchport has correct VLAN var ethernetConnections = wmiCallsV2.GetEthernetConnections(vm); var vlanSettings = wmiCallsV2.GetVlanSettings(ethernetConnections[0]); string isolationUri = (string)jsonStartCmd.vm.nics[0].isolationUri; diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/ServerResource.Tests/Properties/AssemblyInfo.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/ServerResource.Tests/Properties/AssemblyInfo.cs index c8820467b3c..1929739e8f5 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/ServerResource.Tests/Properties/AssemblyInfo.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/ServerResource.Tests/Properties/AssemblyInfo.cs @@ -19,7 +19,7 @@ using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("ServerResource.Tests")] @@ -31,8 +31,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] @@ -42,11 +42,11 @@ using System.Runtime.InteropServices; // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Revision and Build Numbers +// You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/Properties/AssemblyInfo.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/Properties/AssemblyInfo.cs index 8d12d056411..e3ec242149f 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/Properties/AssemblyInfo.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/Properties/AssemblyInfo.cs @@ -19,7 +19,7 @@ using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("WmiWrappers")] @@ -31,8 +31,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] @@ -42,11 +42,11 @@ using System.Runtime.InteropServices; // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.CIMV2.Win32_OperatingSystem.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.CIMV2.Win32_OperatingSystem.cs index ce1e22ffe9c..a29ede0f0a0 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.CIMV2.Win32_OperatingSystem.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.CIMV2.Win32_OperatingSystem.cs @@ -23,8 +23,8 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { using System.Globalization; using System.ComponentModel.Design.Serialization; using System.Reflection; - - + + // Functions ShouldSerialize are functions used by VS property browser to check if a particular property has to be serialized. These functions are added for all ValueType properties ( properties of type Int32, BOOL etc.. which cannot be set to null). These functions use IsNull function. These functions are also used in the TypeConverter implementation for the properties to check for NULL value of property so that an empty value can be shown in Property browser in case of Drag and Drop in Visual studio. // Functions IsNull() are used to check if a property is NULL. // Functions Reset are added for Nullable Read/Write properties. These functions are used by VS designer in property browser to set a property to NULL. @@ -32,58 +32,58 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { // Datetime conversion functions ToDateTime and ToDmtfDateTime are added to the class to convert DMTF datetime to System.DateTime and vice-versa. // An Early Bound class generated for the WMI class.Win32_OperatingSystem public class OperatingSystem0 : System.ComponentModel.Component { - + // Private property to hold the WMI namespace in which the class resides. private static string CreatedWmiNamespace = "ROOT\\CIMV2"; - + // Private property to hold the name of WMI class which created this class. private static string CreatedClassName = "Win32_OperatingSystem"; - + // Private member variable to hold the ManagementScope which is used by the various methods. private static System.Management.ManagementScope statMgmtScope = null; - + private ManagementSystemProperties PrivateSystemProperties; - + // Underlying lateBound WMI object. private System.Management.ManagementObject PrivateLateBoundObject; - + // Member variable to store the 'automatic commit' behavior for the class. private bool AutoCommitProp; - + // Private variable to hold the embedded property representing the instance. private System.Management.ManagementBaseObject embeddedObj; - + // The current WMI object used private System.Management.ManagementBaseObject curObj; - + // Flag to indicate if the instance is an embedded object. private bool isEmbedded; - + // Below are different overloads of constructors to initialize an instance of the class with a WMI object. public OperatingSystem0() { this.InitializeObject(null, new System.Management.ManagementPath(OperatingSystem0.ConstructPath()), null); } - + public OperatingSystem0(System.Management.ManagementScope mgmtScope) { this.InitializeObject(mgmtScope, new System.Management.ManagementPath(OperatingSystem0.ConstructPath()), null); } - + public OperatingSystem0(System.Management.ObjectGetOptions getOptions) { this.InitializeObject(null, new System.Management.ManagementPath(OperatingSystem0.ConstructPath()), getOptions); } - + public OperatingSystem0(System.Management.ManagementScope mgmtScope, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(mgmtScope, new System.Management.ManagementPath(OperatingSystem0.ConstructPath()), getOptions); } - + public OperatingSystem0(System.Management.ManagementPath path) { this.InitializeObject(null, path, null); } - + public OperatingSystem0(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(mgmtScope, path, getOptions); } - + public OperatingSystem0(System.Management.ManagementObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -95,7 +95,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { throw new System.ArgumentException("Class name does not match."); } } - + public OperatingSystem0(System.Management.ManagementBaseObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -108,7 +108,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { throw new System.ArgumentException("Class name does not match."); } } - + // Property returns the namespace of the WMI class. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -117,7 +117,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { return "ROOT\\CIMV2"; } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ManagementClassName { @@ -126,7 +126,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { if ((curObj != null)) { if ((curObj.ClassPath != null)) { strRet = ((string)(curObj["__CLASS"])); - if (((strRet == null) + if (((strRet == null) || (strRet == string.Empty))) { strRet = CreatedClassName; } @@ -135,7 +135,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { return strRet; } } - + // Property pointing to an embedded object to get System properties of the WMI object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -144,7 +144,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { return PrivateSystemProperties; } } - + // Property returning the underlying lateBound object. [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -153,7 +153,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { return curObj; } } - + // ManagementScope of the object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -172,7 +172,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { } } } - + // Property to show the commit behavior for the WMI object. If true, WMI object will be automatically saved after each property modification.(ie. Put() is called after modification of a property). [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -184,7 +184,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { AutoCommitProp = value; } } - + // The ManagementPath of the underlying WMI object. [Browsable(true)] public System.Management.ManagementPath Path { @@ -205,7 +205,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { } } } - + // Public static scope property which is used by the various methods. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -217,7 +217,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { statMgmtScope = value; } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The BootDevice property indicates the name of the disk drive from which the Win32" + @@ -227,7 +227,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { return ((string)(curObj["BootDevice"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The BuildNumber property indicates the build number of the operating system. It " + @@ -238,7 +238,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { return ((string)(curObj["BuildNumber"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The BuildType property indicates the type of build used for the operating system." + @@ -248,7 +248,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { return ((string)(curObj["BuildType"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The Caption property is a short textual description (one-line string) of the obje" + @@ -258,7 +258,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { return ((string)(curObj["Caption"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"The CodeSet property indicates the code page value used by the operating system. A code page contains a character table used by the operating system to translate strings for different languages. The American National Standards Institute (ANSI) lists values that represent defined code pages. If the operating system does not use an ANSI code page, this member will be set to 0. The CodeSet string can use up to six characters to define the code page value. @@ -268,7 +268,7 @@ Example: 1255.")] return ((string)(curObj["CodeSet"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"The CountryCode property indicates the code for the country/regionused by the operating system. Values are based on international phone dialing prefixes (also referred to as IBM country/region codes). The CountryCode string can use up to six characters to define the country/region code value. @@ -278,7 +278,7 @@ Example: 1 for the United States)")] return ((string)(curObj["CountryCode"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("CreationClassName indicates the name of the class or the subclass used in the cre" + @@ -290,7 +290,7 @@ Example: 1 for the United States)")] return ((string)(curObj["CreationClassName"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("CSCreationClassName contains the scoping computer system\'s creation class name.")] @@ -299,7 +299,7 @@ Example: 1 for the United States)")] return ((string)(curObj["CSCreationClassName"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"The CSDVersion property contains a null-terminated string, that indicates the latest Service Pack installed on the computer system. If no Service Pack is installed, the string is NULL. For computer systems running Windows 95, this property contains a null-terminated string that provides arbitrary additional information about the operating system. @@ -309,7 +309,7 @@ Example: Service Pack 3.")] return ((string)(curObj["CSDVersion"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("CSName contains the scoping computer system\'s name.")] @@ -318,7 +318,7 @@ Example: Service Pack 3.")] return ((string)(curObj["CSName"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsCurrentTimeZoneNull { @@ -331,7 +331,7 @@ Example: Service Pack 3.")] } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("CurrentTimeZone indicates the number of minutes the operating system is offset fr" + @@ -345,7 +345,7 @@ Example: Service Pack 3.")] return ((short)(curObj["CurrentTimeZone"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsDataExecutionPrevention_32BitApplicationsNull { @@ -358,7 +358,7 @@ Example: Service Pack 3.")] } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("If true, indicates that 32-bit applications are running with Data Execution Preve" + @@ -372,7 +372,7 @@ Example: Service Pack 3.")] return ((bool)(curObj["DataExecutionPrevention_32BitApplications"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsDataExecutionPrevention_AvailableNull { @@ -385,7 +385,7 @@ Example: Service Pack 3.")] } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"If true, indicates that the hardware supports Windows Data Execution Prevention (DEP) technology. DEP ensures that all memory locations are marked with a non-executable attribute unless the memory location explicitly contains executable code. This can help mitigate certain types of buffer overrun security exploits. If DEP is available, 64-bit applications are automatically protected. To determine if DEP has been enabled for 32-bit applications and drivers, use the DataExecutionPrevention_ properties ")] @@ -398,7 +398,7 @@ Example: Service Pack 3.")] return ((bool)(curObj["DataExecutionPrevention_Available"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsDataExecutionPrevention_DriversNull { @@ -411,7 +411,7 @@ Example: Service Pack 3.")] } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("If true, indicates that drivers are running with Data Execution Prevention (DEP) " + @@ -425,7 +425,7 @@ Example: Service Pack 3.")] return ((bool)(curObj["DataExecutionPrevention_Drivers"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsDataExecutionPrevention_SupportPolicyNull { @@ -438,7 +438,7 @@ Example: Service Pack 3.")] } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"The DataExecutionPrevention_SupportPolicy indicates which one of four Data Execution Prevention (DEP) settings is applied. Each setting varies by the extent to which DEP is applied to 32-bit applications. Note that DEP is always applied to the Windows kernel. Always On (not available in the user interface) indicates that DEP is enabled for all 32-bit applications on the machine with no exceptions. OptOut indicates DEP is on by default for all 32-bit applications and that a user or administrator must explicitly remove support for a 32-bit application by adding to an exceptions list. OptIn indicates DEP is on for a limited number of binaries, the kernel, and all Windows services but it is off by default for all 32-bit applications; a user or administrator must explicitly choose the AlwaysOn (not available in the user interface) or OptOut setting before DEP can be applied to 32-bit applications. AlwaysOff (not available in the user interface) indicates DEP is turned off for all 32-bit applications on the machine. ")] @@ -451,7 +451,7 @@ Example: Service Pack 3.")] return ((DataExecutionPrevention_SupportPolicyValues)(System.Convert.ToInt32(curObj["DataExecutionPrevention_SupportPolicy"]))); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsDebugNull { @@ -464,7 +464,7 @@ Example: Service Pack 3.")] } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"The Debug property indicates whether the operating system is a checked (debug) build. Checked builds provide error checking, argument verification, and system debugging code. Additional code in a checked binary generates a kernel debugger error message and breaks into the debugger. This helps immediately determine the cause and location of the error. Performance suffers in the checked build due to the additional code that is executed. @@ -478,7 +478,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the debugging version of User.e return ((bool)(curObj["Debug"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The Description property provides a description of the Windows operating system. " + @@ -490,13 +490,13 @@ Values: TRUE or FALSE, A value of TRUE indicates the debugging version of User.e } set { curObj["Description"] = value; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsDistributedNull { @@ -509,7 +509,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the debugging version of User.e } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("Boolean indicating whether the operating system is distributed across several com" + @@ -523,7 +523,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the debugging version of User.e return ((bool)(curObj["Distributed"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsEncryptionLevelNull { @@ -536,7 +536,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the debugging version of User.e } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The EncryptionLevel property specifies if the encryption level for secure transac" + @@ -550,7 +550,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the debugging version of User.e return ((EncryptionLevelValues)(System.Convert.ToInt32(curObj["EncryptionLevel"]))); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsForegroundApplicationBoostNull { @@ -563,7 +563,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the debugging version of User.e } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"The ForegroundApplicationBoost property indicates the increase in priority given to the foreground application. On computer systems running Windows NT 4.0 and Windows 2000, application boost is implemented by giving an application more execution time slices (quantum lengths). A ForegroundApplicationBoost value of 0 indicates the system boosts the quantum length by 6; if 1, then 12; and if 2 then 18. On Windows NT 3.51 and earlier, application boost is implemented by increasing the scheduling priority. For these systems, the scheduling priority is increased by the value of this property. The default value is 2.")] @@ -582,13 +582,13 @@ Values: TRUE or FALSE, A value of TRUE indicates the debugging version of User.e else { curObj["ForegroundApplicationBoost"] = value; } - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsFreePhysicalMemoryNull { @@ -601,7 +601,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the debugging version of User.e } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("Number of kilobytes of physical memory currently unused and available")] @@ -614,7 +614,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the debugging version of User.e return ((ulong)(curObj["FreePhysicalMemory"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsFreeSpaceInPagingFilesNull { @@ -627,7 +627,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the debugging version of User.e } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The total number of KBytes that can be mapped into the OperatingSystem\'s paging f" + @@ -642,7 +642,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the debugging version of User.e return ((ulong)(curObj["FreeSpaceInPagingFiles"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsFreeVirtualMemoryNull { @@ -655,7 +655,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the debugging version of User.e } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("Number of kilobytes of virtual memory currently unused and available. For example" + @@ -671,7 +671,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the debugging version of User.e return ((ulong)(curObj["FreeVirtualMemory"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsInstallDateNull { @@ -684,7 +684,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the debugging version of User.e } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The InstallDate property is datetime value indicating when the object was install" + @@ -700,7 +700,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the debugging version of User.e } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsLargeSystemCacheNull { @@ -713,7 +713,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the debugging version of User.e } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The LargeSystemCache property indicates whether to optimize memory for applicatio" + @@ -727,7 +727,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the debugging version of User.e return ((LargeSystemCacheValues)(System.Convert.ToInt32(curObj["LargeSystemCache"]))); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsLastBootUpTimeNull { @@ -740,7 +740,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the debugging version of User.e } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("Time when the operating system was last booted")] @@ -755,7 +755,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the debugging version of User.e } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsLocalDateTimeNull { @@ -768,7 +768,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the debugging version of User.e } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("Operating system\'s notion of the local date and time of day.")] @@ -783,7 +783,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the debugging version of User.e } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"The Locale property indicates the language identifier used by the operating system. A language identifier is a standard international numeric abbreviation for a country or region. Each language has a unique language identifier (LANGID), a 16-bit value that consists of a primary language identifier and a secondary language identifier.")] @@ -792,7 +792,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the debugging version of User.e return ((string)(curObj["Locale"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The Manufacturer property indicates the name of the operating system manufacturer" + @@ -802,7 +802,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the debugging version of User.e return ((string)(curObj["Manufacturer"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsMaxNumberOfProcessesNull { @@ -815,7 +815,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the debugging version of User.e } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"Maximum number of process contexts the operating system can support. If there is no fixed maximum, the value should be 0. On systems that have a fixed maximum, this object can help diagnose failures that occur when the maximum is reached. If unknown, enter -1.")] @@ -828,7 +828,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the debugging version of User.e return ((uint)(curObj["MaxNumberOfProcesses"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsMaxProcessMemorySizeNull { @@ -841,7 +841,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the debugging version of User.e } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"Maximum number of kilobytes of memory that can be allocated to a process. For operating systems with no virtual memory, this value is typically equal to the total amount of physical memory minus memory used by the BIOS and OS. For some operating systems, this value may be infinity - in which case, 0 should be entered. In other cases, this value could be a constant - for example, 2G or 4G.")] @@ -854,7 +854,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the debugging version of User.e return ((ulong)(curObj["MaxProcessMemorySize"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The MUILanguages property indicates the MUI Languages installed in the system. \n " + @@ -864,7 +864,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the debugging version of User.e return ((string[])(curObj["MUILanguages"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("Name of the operating system instance within a computer system.")] @@ -873,7 +873,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the debugging version of User.e return ((string)(curObj["Name"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsNumberOfLicensedUsersNull { @@ -886,7 +886,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the debugging version of User.e } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("Number of user licenses for the operating system. If unlimited, enter 0. If unkno" + @@ -900,7 +900,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the debugging version of User.e return ((uint)(curObj["NumberOfLicensedUsers"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsNumberOfProcessesNull { @@ -913,7 +913,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the debugging version of User.e } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("Number of process contexts currently loaded or running on the operating system.")] @@ -926,7 +926,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the debugging version of User.e return ((uint)(curObj["NumberOfProcesses"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsNumberOfUsersNull { @@ -939,7 +939,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the debugging version of User.e } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("Number of user sessions for which the operating system is currently storing state" + @@ -953,7 +953,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the debugging version of User.e return ((uint)(curObj["NumberOfUsers"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsOperatingSystemSKUNull { @@ -966,7 +966,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the debugging version of User.e } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The OperatingSystemSKU property identifies the SKU of the operating system.")] @@ -979,7 +979,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the debugging version of User.e return ((uint)(curObj["OperatingSystemSKU"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The Organization property indicates the registered user\'s (of the operating syste" + @@ -989,7 +989,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the debugging version of User.e return ((string)(curObj["Organization"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The OSArchitecture property indicates the Architecture of the operating system.Ex" + @@ -999,7 +999,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the debugging version of User.e return ((string)(curObj["OSArchitecture"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsOSLanguageNull { @@ -1012,7 +1012,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the debugging version of User.e } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The OSLanguage property indicates which language version of the operating system " + @@ -1026,7 +1026,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the debugging version of User.e return ((uint)(curObj["OSLanguage"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsOSProductSuiteNull { @@ -1039,7 +1039,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the debugging version of User.e } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The OSProductSuite property identifies installed and licensed system product addi" + @@ -1053,7 +1053,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the debugging version of User.e return ((OSProductSuiteValues)(System.Convert.ToInt32(curObj["OSProductSuite"]))); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsOSTypeNull { @@ -1066,7 +1066,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the debugging version of User.e } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("A integer indicating the type of operating system.")] @@ -1079,7 +1079,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the debugging version of User.e return ((OSTypeValues)(System.Convert.ToInt32(curObj["OSType"]))); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"A string describing the manufacturer and operating system type - used when the operating system property, OSType, is set to 1 (""Other""). The format of the string inserted in OtherTypeDescription should be similar in format to the Values strings defined for OSType. OtherTypeDescription should be set to NULL when OSType is any value other than 1.")] @@ -1088,7 +1088,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the debugging version of User.e return ((string)(curObj["OtherTypeDescription"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPAEEnabledNull { @@ -1101,7 +1101,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the debugging version of User.e } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -1113,7 +1113,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the debugging version of User.e return ((bool)(curObj["PAEEnabled"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The PlusProductID property contains the product identification number for the Win" + @@ -1123,7 +1123,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the debugging version of User.e return ((string)(curObj["PlusProductID"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The PlusVersionNumber property contains the version number of the Windows Plus! o" + @@ -1133,7 +1133,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the debugging version of User.e return ((string)(curObj["PlusVersionNumber"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPortableOperatingSystemNull { @@ -1146,7 +1146,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the debugging version of User.e } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"The PortableOperatingSystem property indicates if theOperating System is booting from a supported locally connected storagedevice. @@ -1161,7 +1161,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the OperatingSystem was booted return ((bool)(curObj["PortableOperatingSystem"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPrimaryNull { @@ -1174,7 +1174,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the OperatingSystem was booted } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The Primary property determines whether this is the primary operating system.\nVal" + @@ -1189,7 +1189,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the OperatingSystem was booted return ((bool)(curObj["Primary"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsProductTypeNull { @@ -1202,7 +1202,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the OperatingSystem was booted } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The ProductType property indicates additional information about the system. This " + @@ -1217,7 +1217,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the OperatingSystem was booted return ((ProductTypeValues)(System.Convert.ToInt32(curObj["ProductType"]))); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The RegisteredUser property indicates the name of the registered user of the oper" + @@ -1227,7 +1227,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the OperatingSystem was booted return ((string)(curObj["RegisteredUser"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The SerialNumber property indicates the operating system product serial identific" + @@ -1237,7 +1237,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the OperatingSystem was booted return ((string)(curObj["SerialNumber"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsServicePackMajorVersionNull { @@ -1250,7 +1250,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the OperatingSystem was booted } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"The ServicePackMajorVersion property indicates the major version number of the service pack installed on the computer system. If no service pack has been installed, the value is zero. ServicePackMajorVersion is valid for computers running Windows 2000 and later (NULL otherwise).")] @@ -1263,7 +1263,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the OperatingSystem was booted return ((ushort)(curObj["ServicePackMajorVersion"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsServicePackMinorVersionNull { @@ -1276,7 +1276,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the OperatingSystem was booted } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"The ServicePackMinorVersion property indicates the minor version number of the service pack installed on the computer system. If no service pack has been installed, the value is zero. ServicePackMinorVersion is valid for computers running Windows 2000 and later (NULL otherwise).")] @@ -1289,7 +1289,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the OperatingSystem was booted return ((ushort)(curObj["ServicePackMinorVersion"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsSizeStoredInPagingFilesNull { @@ -1302,7 +1302,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the OperatingSystem was booted } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The total number of kilobytes that can be stored in the operating system\'s paging" + @@ -1317,7 +1317,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the OperatingSystem was booted return ((ulong)(curObj["SizeStoredInPagingFiles"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"The Status property is a string indicating the current status of the object. Various operational and non-operational statuses can be defined. Operational statuses are ""OK"", ""Degraded"" and ""Pred Fail"". ""Pred Fail"" indicates that an element may be functioning properly but predicting a failure in the near future. An example is a SMART-enabled hard drive. Non-operational statuses can also be specified. These are ""Error"", ""Starting"", ""Stopping"" and ""Service"". The latter, ""Service"", could apply during mirror-resilvering of a disk, reload of a user permissions list, or other administrative work. Not all such work is on-line, yet the managed element is neither ""OK"" nor in one of the other states.")] @@ -1326,7 +1326,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the OperatingSystem was booted return ((string)(curObj["Status"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsSuiteMaskNull { @@ -1339,20 +1339,20 @@ Values: TRUE or FALSE, A value of TRUE indicates the OperatingSystem was booted } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - [Description(@"The SuiteMask property indicates a set of bit flags that identify the product suites available on the system. This member can be a combination of the following values: -0 - Windows Server 2003, Small Business Edition -1 - Windows Server 2003, Enterprise Edition -2 - Windows Server 2003, Backoffice Edition -3 - Windows Server 2003, Communications Edition -4 - Microsoft Terminal Services -5 - Windows Server 2003, Small Business Edition Restricted -6 - Windows XP Embedded -7 - Windows Server 2003, Datacenter Edition -8 - Single User -9 - Windows XP Home Edition + [Description(@"The SuiteMask property indicates a set of bit flags that identify the product suites available on the system. This member can be a combination of the following values: +0 - Windows Server 2003, Small Business Edition +1 - Windows Server 2003, Enterprise Edition +2 - Windows Server 2003, Backoffice Edition +3 - Windows Server 2003, Communications Edition +4 - Microsoft Terminal Services +5 - Windows Server 2003, Small Business Edition Restricted +6 - Windows XP Embedded +7 - Windows Server 2003, Datacenter Edition +8 - Single User +9 - Windows XP Home Edition 10 - Windows Server 2003, Web Edition")] [TypeConverter(typeof(WMIValueTypeConverter))] public SuiteMaskValues SuiteMask { @@ -1363,7 +1363,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the OperatingSystem was booted return ((SuiteMaskValues)(System.Convert.ToInt32(curObj["SuiteMask"]))); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The SystemDevice property indicates the physical disk partition the operating sys" + @@ -1373,7 +1373,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the OperatingSystem was booted return ((string)(curObj["SystemDevice"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The SystemDirectory property indicates the system directory of the operating syst" + @@ -1383,7 +1383,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the OperatingSystem was booted return ((string)(curObj["SystemDirectory"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The SystemDrive property contains the letter of the disk drive that the operating" + @@ -1393,7 +1393,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the OperatingSystem was booted return ((string)(curObj["SystemDrive"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsTotalSwapSpaceSizeNull { @@ -1406,7 +1406,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the OperatingSystem was booted } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"Total swap space in kilobytes. This value may be NULL (unspecified) if swap space is not distinguished from page files. However, some operating systems distinguish these concepts. For example, in UNIX, whole processes can be 'swapped out' when the free page list falls and remains below a specified amount.")] @@ -1419,7 +1419,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the OperatingSystem was booted return ((ulong)(curObj["TotalSwapSpaceSize"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsTotalVirtualMemorySizeNull { @@ -1432,7 +1432,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the OperatingSystem was booted } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("Number of kilobytes of virtual memory. For example, this may be calculated by add" + @@ -1448,7 +1448,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the OperatingSystem was booted return ((ulong)(curObj["TotalVirtualMemorySize"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsTotalVisibleMemorySizeNull { @@ -1461,7 +1461,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the OperatingSystem was booted } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The total amount of physical memory (in Kbytes) available to the OperatingSystem." + @@ -1476,7 +1476,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the OperatingSystem was booted return ((ulong)(curObj["TotalVisibleMemorySize"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The Version property indicates the version number of the operating system.\nExampl" + @@ -1486,7 +1486,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the OperatingSystem was booted return ((string)(curObj["Version"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The WindowsDirectory property indicates the Windows directory of the operating sy" + @@ -1496,9 +1496,9 @@ Values: TRUE or FALSE, A value of TRUE indicates the OperatingSystem was booted return ((string)(curObj["WindowsDirectory"])); } } - + private bool CheckIfProperClass(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions OptionsParam) { - if (((path != null) + if (((path != null) && (string.Compare(path.ClassName, this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -1506,9 +1506,9 @@ Values: TRUE or FALSE, A value of TRUE indicates the OperatingSystem was booted return CheckIfProperClass(new System.Management.ManagementObject(mgmtScope, path, OptionsParam)); } } - + private bool CheckIfProperClass(System.Management.ManagementBaseObject theObj) { - if (((theObj != null) + if (((theObj != null) && (string.Compare(((string)(theObj["__CLASS"])), this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -1525,107 +1525,107 @@ Values: TRUE or FALSE, A value of TRUE indicates the OperatingSystem was booted } return false; } - + private bool ShouldSerializeCurrentTimeZone() { if ((this.IsCurrentTimeZoneNull == false)) { return true; } return false; } - + private bool ShouldSerializeDataExecutionPrevention_32BitApplications() { if ((this.IsDataExecutionPrevention_32BitApplicationsNull == false)) { return true; } return false; } - + private bool ShouldSerializeDataExecutionPrevention_Available() { if ((this.IsDataExecutionPrevention_AvailableNull == false)) { return true; } return false; } - + private bool ShouldSerializeDataExecutionPrevention_Drivers() { if ((this.IsDataExecutionPrevention_DriversNull == false)) { return true; } return false; } - + private bool ShouldSerializeDataExecutionPrevention_SupportPolicy() { if ((this.IsDataExecutionPrevention_SupportPolicyNull == false)) { return true; } return false; } - + private bool ShouldSerializeDebug() { if ((this.IsDebugNull == false)) { return true; } return false; } - + private void ResetDescription() { curObj["Description"] = null; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } - + private bool ShouldSerializeDistributed() { if ((this.IsDistributedNull == false)) { return true; } return false; } - + private bool ShouldSerializeEncryptionLevel() { if ((this.IsEncryptionLevelNull == false)) { return true; } return false; } - + private bool ShouldSerializeForegroundApplicationBoost() { if ((this.IsForegroundApplicationBoostNull == false)) { return true; } return false; } - + private void ResetForegroundApplicationBoost() { curObj["ForegroundApplicationBoost"] = null; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } - + private bool ShouldSerializeFreePhysicalMemory() { if ((this.IsFreePhysicalMemoryNull == false)) { return true; } return false; } - + private bool ShouldSerializeFreeSpaceInPagingFiles() { if ((this.IsFreeSpaceInPagingFilesNull == false)) { return true; } return false; } - + private bool ShouldSerializeFreeVirtualMemory() { if ((this.IsFreeVirtualMemoryNull == false)) { return true; } return false; } - + // Converts a given datetime in DMTF format to System.DateTime object. static System.DateTime ToDateTime(string dmtfDate) { System.DateTime initializer = System.DateTime.MinValue; @@ -1677,13 +1677,13 @@ Values: TRUE or FALSE, A value of TRUE indicates the OperatingSystem was booted if (("******" != tempString)) { ticks = (long.Parse(tempString) * ((long)((System.TimeSpan.TicksPerMillisecond / 1000)))); } - if (((((((((year < 0) - || (month < 0)) - || (day < 0)) - || (hour < 0)) - || (minute < 0)) - || (minute < 0)) - || (second < 0)) + if (((((((((year < 0) + || (month < 0)) + || (day < 0)) + || (hour < 0)) + || (minute < 0)) + || (minute < 0)) + || (second < 0)) || (ticks < 0))) { throw new System.ArgumentOutOfRangeException(); } @@ -1711,7 +1711,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the OperatingSystem was booted } return datetime; } - + // Converts a given System.DateTime object to DMTF datetime format. static string ToDmtfDateTime(System.DateTime date) { string utcString = string.Empty; @@ -1738,8 +1738,8 @@ Values: TRUE or FALSE, A value of TRUE indicates the OperatingSystem was booted dmtfDateTime = string.Concat(dmtfDateTime, ((int)(date.Second)).ToString().PadLeft(2, '0')); dmtfDateTime = string.Concat(dmtfDateTime, "."); System.DateTime dtTemp = new System.DateTime(date.Year, date.Month, date.Day, date.Hour, date.Minute, date.Second, 0); - long microsec = ((long)((((date.Ticks - dtTemp.Ticks) - * 1000) + long microsec = ((long)((((date.Ticks - dtTemp.Ticks) + * 1000) / System.TimeSpan.TicksPerMillisecond))); string strMicrosec = ((long)(microsec)).ToString(); if ((strMicrosec.Length > 6)) { @@ -1749,198 +1749,198 @@ Values: TRUE or FALSE, A value of TRUE indicates the OperatingSystem was booted dmtfDateTime = string.Concat(dmtfDateTime, utcString); return dmtfDateTime; } - + private bool ShouldSerializeInstallDate() { if ((this.IsInstallDateNull == false)) { return true; } return false; } - + private bool ShouldSerializeLargeSystemCache() { if ((this.IsLargeSystemCacheNull == false)) { return true; } return false; } - + private bool ShouldSerializeLastBootUpTime() { if ((this.IsLastBootUpTimeNull == false)) { return true; } return false; } - + private bool ShouldSerializeLocalDateTime() { if ((this.IsLocalDateTimeNull == false)) { return true; } return false; } - + private bool ShouldSerializeMaxNumberOfProcesses() { if ((this.IsMaxNumberOfProcessesNull == false)) { return true; } return false; } - + private bool ShouldSerializeMaxProcessMemorySize() { if ((this.IsMaxProcessMemorySizeNull == false)) { return true; } return false; } - + private bool ShouldSerializeNumberOfLicensedUsers() { if ((this.IsNumberOfLicensedUsersNull == false)) { return true; } return false; } - + private bool ShouldSerializeNumberOfProcesses() { if ((this.IsNumberOfProcessesNull == false)) { return true; } return false; } - + private bool ShouldSerializeNumberOfUsers() { if ((this.IsNumberOfUsersNull == false)) { return true; } return false; } - + private bool ShouldSerializeOperatingSystemSKU() { if ((this.IsOperatingSystemSKUNull == false)) { return true; } return false; } - + private bool ShouldSerializeOSLanguage() { if ((this.IsOSLanguageNull == false)) { return true; } return false; } - + private bool ShouldSerializeOSProductSuite() { if ((this.IsOSProductSuiteNull == false)) { return true; } return false; } - + private bool ShouldSerializeOSType() { if ((this.IsOSTypeNull == false)) { return true; } return false; } - + private bool ShouldSerializePAEEnabled() { if ((this.IsPAEEnabledNull == false)) { return true; } return false; } - + private bool ShouldSerializePortableOperatingSystem() { if ((this.IsPortableOperatingSystemNull == false)) { return true; } return false; } - + private bool ShouldSerializePrimary() { if ((this.IsPrimaryNull == false)) { return true; } return false; } - + private bool ShouldSerializeProductType() { if ((this.IsProductTypeNull == false)) { return true; } return false; } - + private bool ShouldSerializeServicePackMajorVersion() { if ((this.IsServicePackMajorVersionNull == false)) { return true; } return false; } - + private bool ShouldSerializeServicePackMinorVersion() { if ((this.IsServicePackMinorVersionNull == false)) { return true; } return false; } - + private bool ShouldSerializeSizeStoredInPagingFiles() { if ((this.IsSizeStoredInPagingFilesNull == false)) { return true; } return false; } - + private bool ShouldSerializeSuiteMask() { if ((this.IsSuiteMaskNull == false)) { return true; } return false; } - + private bool ShouldSerializeTotalSwapSpaceSize() { if ((this.IsTotalSwapSpaceSizeNull == false)) { return true; } return false; } - + private bool ShouldSerializeTotalVirtualMemorySize() { if ((this.IsTotalVirtualMemorySizeNull == false)) { return true; } return false; } - + private bool ShouldSerializeTotalVisibleMemorySize() { if ((this.IsTotalVisibleMemorySizeNull == false)) { return true; } return false; } - + [Browsable(true)] public void CommitObject() { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(); } } - + [Browsable(true)] public void CommitObject(System.Management.PutOptions putOptions) { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(putOptions); } } - + private void Initialize() { AutoCommitProp = true; isEmbedded = false; } - + private static string ConstructPath() { return "ROOT\\CIMV2:Win32_OperatingSystem=@"; } - + private void InitializeObject(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { Initialize(); if ((path != null)) { @@ -1952,7 +1952,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the OperatingSystem was booted PrivateSystemProperties = new ManagementSystemProperties(PrivateLateBoundObject); curObj = PrivateLateBoundObject; } - + [Browsable(true)] public static OperatingSystem0 CreateInstance() { System.Management.ManagementScope mgmtScope = null; @@ -1967,12 +1967,12 @@ Values: TRUE or FALSE, A value of TRUE indicates the OperatingSystem was booted System.Management.ManagementClass tmpMgmtClass = new System.Management.ManagementClass(mgmtScope, mgmtPath, null); return new OperatingSystem0(tmpMgmtClass.CreateInstance()); } - + [Browsable(true)] public void Delete() { PrivateLateBoundObject.Delete(); } - + public uint Reboot() { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1986,7 +1986,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the OperatingSystem was booted return System.Convert.ToUInt32(0); } } - + public uint SetDateTime(System.DateTime LocalDateTime) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -2002,7 +2002,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the OperatingSystem was booted return System.Convert.ToUInt32(0); } } - + public uint Shutdown() { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -2016,7 +2016,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the OperatingSystem was booted return System.Convert.ToUInt32(0); } } - + public uint Win32Shutdown(int Flags, int Reserved) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -2033,7 +2033,7 @@ Values: TRUE or FALSE, A value of TRUE indicates the OperatingSystem was booted return System.Convert.ToUInt32(0); } } - + public uint Win32ShutdownTracker(string Comment, int Flags, uint ReasonCode, uint Timeout) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -2052,395 +2052,395 @@ Values: TRUE or FALSE, A value of TRUE indicates the OperatingSystem was booted return System.Convert.ToUInt32(0); } } - + public enum DataExecutionPrevention_SupportPolicyValues { - + Always_Off = 0, - + Always_On = 1, - + Opt_In = 2, - + Opt_Out = 3, - + NULL_ENUM_VALUE = 4, } - + public enum EncryptionLevelValues { - + Val_40_bit = 0, - + Val_128_bit = 1, - + N_bit = 2, - + NULL_ENUM_VALUE = 3, } - + public enum ForegroundApplicationBoostValues { - + None = 0, - + Minimum = 1, - + Maximum = 2, - + NULL_ENUM_VALUE = 3, } - + public enum LargeSystemCacheValues { - + Optimize_for_Applications = 0, - + Optimize_for_System_Performance = 1, - + NULL_ENUM_VALUE = 2, } - + public enum OSProductSuiteValues { - + Small_Business = 1, - + Enterprise = 2, - + BackOffice = 4, - + Communication_Server = 8, - + Terminal_Server = 16, - + Small_Business_Restricted_ = 32, - + Embedded_NT = 64, - + Data_Center = 128, - + NULL_ENUM_VALUE = 256, } - + public enum OSTypeValues { - + Unknown0 = 0, - + Other0 = 1, - + MACOS = 2, - + ATTUNIX = 3, - + DGUX = 4, - + DECNT = 5, - + Digital_Unix = 6, - + OpenVMS = 7, - + HPUX = 8, - + AIX = 9, - + MVS = 10, - + OS400 = 11, - + OS_2 = 12, - + JavaVM = 13, - + MSDOS = 14, - + WIN3x = 15, - + WIN95 = 16, - + WIN98 = 17, - + WINNT = 18, - + WINCE = 19, - + NCR3000 = 20, - + NetWare = 21, - + OSF = 22, - + DC_OS = 23, - + Reliant_UNIX = 24, - + SCO_UnixWare = 25, - + SCO_OpenServer = 26, - + Sequent = 27, - + IRIX = 28, - + Solaris = 29, - + SunOS = 30, - + U6000 = 31, - + ASERIES = 32, - + TandemNSK = 33, - + TandemNT = 34, - + BS2000 = 35, - + LINUX = 36, - + Lynx = 37, - + XENIX = 38, - + VM_ESA = 39, - + Interactive_UNIX = 40, - + BSDUNIX = 41, - + FreeBSD = 42, - + NetBSD = 43, - + GNU_Hurd = 44, - + OS9 = 45, - + MACH_Kernel = 46, - + Inferno = 47, - + QNX = 48, - + EPOC = 49, - + IxWorks = 50, - + VxWorks = 51, - + MiNT = 52, - + BeOS = 53, - + HP_MPE = 54, - + NextStep = 55, - + PalmPilot = 56, - + Rhapsody = 57, - + Windows_2000 = 58, - + Dedicated = 59, - + OS_390 = 60, - + VSE = 61, - + TPF = 62, - + NULL_ENUM_VALUE = 63, } - + public enum ProductTypeValues { - + Work_Station = 1, - + Domain_Controller = 2, - + Server = 3, - + NULL_ENUM_VALUE = 0, } - + public enum SuiteMaskValues { - + Windows_Server_2003_Small_Business_Edition = 0, - + Windows_Server_2003_Enterprise_Edition = 1, - + Windows_Server_2003_Backoffice_Edition = 2, - + Windows_Server_2003_Communications_Edition = 3, - + Microsoft_Terminal_Services = 4, - + Windows_Server_2003_Small_Business_Edition_Restricted = 5, - + Windows_XP_Embedded = 6, - + Windows_Server_2003_Datacenter_Edition = 7, - + Single_User = 8, - + Windows_XP_Home_Edition = 9, - + Windows_Server_2003_Web_Edition = 10, - + NULL_ENUM_VALUE = 20, } - + // TypeConverter to handle null values for ValueType properties public class WMIValueTypeConverter : TypeConverter { - + private TypeConverter baseConverter; - + private System.Type baseType; - + public WMIValueTypeConverter(System.Type inBaseType) { baseConverter = TypeDescriptor.GetConverter(inBaseType); baseType = inBaseType; } - + 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 ((baseType.BaseType == typeof(System.Enum))) { if ((value.GetType() == destinationType)) { return value; } - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return "NULL_ENUM_VALUE" ; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((baseType == typeof(bool)) + if (((baseType == typeof(bool)) && (baseType.BaseType == typeof(System.ValueType)))) { - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((context != null) + if (((context != null) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } } - + // Embedded class to represent WMI system Properties. [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 { diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.CIMV2.Win32_Processor.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.CIMV2.Win32_Processor.cs index 09ef22b4288..48e7ecec50a 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.CIMV2.Win32_Processor.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.CIMV2.Win32_Processor.cs @@ -24,8 +24,8 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 using System.Globalization; using System.ComponentModel.Design.Serialization; using System.Reflection; - - + + // Functions ShouldSerialize are functions used by VS property browser to check if a particular property has to be serialized. These functions are added for all ValueType properties ( properties of type Int32, BOOL etc.. which cannot be set to null). These functions use IsNull function. These functions are also used in the TypeConverter implementation for the properties to check for NULL value of property so that an empty value can be shown in Property browser in case of Drag and Drop in Visual studio. // Functions IsNull() are used to check if a property is NULL. // Functions Reset are added for Nullable Read/Write properties. These functions are used by VS designer in property browser to set a property to NULL. @@ -33,62 +33,62 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 // Datetime conversion functions ToDateTime and ToDmtfDateTime are added to the class to convert DMTF datetime to System.DateTime and vice-versa. // An Early Bound class generated for the WMI class.Win32_Processor public class Processor : System.ComponentModel.Component { - + // Private property to hold the WMI namespace in which the class resides. private static string CreatedWmiNamespace = "ROOT\\CIMV2"; - + // Private property to hold the name of WMI class which created this class. private static string CreatedClassName = "Win32_Processor"; - + // Private member variable to hold the ManagementScope which is used by the various methods. private static System.Management.ManagementScope statMgmtScope = null; - + private ManagementSystemProperties PrivateSystemProperties; - + // Underlying lateBound WMI object. private System.Management.ManagementObject PrivateLateBoundObject; - + // Member variable to store the 'automatic commit' behavior for the class. private bool AutoCommitProp; - + // Private variable to hold the embedded property representing the instance. private System.Management.ManagementBaseObject embeddedObj; - + // The current WMI object used private System.Management.ManagementBaseObject curObj; - + // Flag to indicate if the instance is an embedded object. private bool isEmbedded; - + // Below are different overloads of constructors to initialize an instance of the class with a WMI object. public Processor() { this.InitializeObject(null, null, null); } - + public Processor(string keyDeviceID) { this.InitializeObject(null, new System.Management.ManagementPath(Processor.ConstructPath(keyDeviceID)), null); } - + public Processor(System.Management.ManagementScope mgmtScope, string keyDeviceID) { this.InitializeObject(((System.Management.ManagementScope)(mgmtScope)), new System.Management.ManagementPath(Processor.ConstructPath(keyDeviceID)), null); } - + public Processor(System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(null, path, getOptions); } - + public Processor(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path) { this.InitializeObject(mgmtScope, path, null); } - + public Processor(System.Management.ManagementPath path) { this.InitializeObject(null, path, null); } - + public Processor(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(mgmtScope, path, getOptions); } - + public Processor(System.Management.ManagementObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -100,7 +100,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 throw new System.ArgumentException("Class name does not match."); } } - + public Processor(System.Management.ManagementBaseObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -113,7 +113,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 throw new System.ArgumentException("Class name does not match."); } } - + // Property returns the namespace of the WMI class. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -122,7 +122,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 return "ROOT\\CIMV2"; } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ManagementClassName { @@ -131,7 +131,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 if ((curObj != null)) { if ((curObj.ClassPath != null)) { strRet = ((string)(curObj["__CLASS"])); - if (((strRet == null) + if (((strRet == null) || (strRet == string.Empty))) { strRet = CreatedClassName; } @@ -140,7 +140,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 return strRet; } } - + // Property pointing to an embedded object to get System properties of the WMI object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -149,7 +149,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 return PrivateSystemProperties; } } - + // Property returning the underlying lateBound object. [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -158,7 +158,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 return curObj; } } - + // ManagementScope of the object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -177,7 +177,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 } } } - + // Property to show the commit behavior for the WMI object. If true, WMI object will be automatically saved after each property modification.(ie. Put() is called after modification of a property). [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -189,7 +189,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 AutoCommitProp = value; } } - + // The ManagementPath of the underlying WMI object. [Browsable(true)] public System.Management.ManagementPath Path { @@ -210,7 +210,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 } } } - + // Public static scope property which is used by the various methods. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -222,7 +222,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 statMgmtScope = value; } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsAddressWidthNull { @@ -235,7 +235,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("Processor address width in bits.")] @@ -248,7 +248,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 return ((ushort)(curObj["AddressWidth"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsArchitectureNull { @@ -261,7 +261,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The Architecture property specifies the processor architecture used by this platf" + @@ -276,7 +276,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 return ((ArchitectureValues)(System.Convert.ToInt32(curObj["Architecture"]))); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsAvailabilityNull { @@ -289,7 +289,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"The availability and status of the device. For example, the Availability property indicates that the device is running and has full power (value=3), or is in a warning (4), test (5), degraded (10) or power save state (values 13-15 and 17). Regarding the power saving states, these are defined as follows: Value 13 (""Power Save - Unknown"") indicates that the device is known to be in a power save mode, but its exact status in this mode is unknown; 14 (""Power Save - Low Power Mode"") indicates that the device is in a power save state but still functioning, and may exhibit degraded performance; 15 (""Power Save - Standby"") describes that the device is not functioning but could be brought to full power 'quickly'; and value 17 (""Power Save - Warning"") indicates that the device is in a warning state, though also in a power save mode.")] @@ -302,7 +302,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 return ((AvailabilityValues)(System.Convert.ToInt32(curObj["Availability"]))); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The Caption property is a short textual description (one-line string) of the obje" + @@ -312,7 +312,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 return ((string)(curObj["Caption"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsConfigManagerErrorCodeNull { @@ -325,7 +325,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("Indicates the Win32 Configuration Manager error code. The following values may b" + @@ -367,7 +367,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 return ((ConfigManagerErrorCodeValues)(System.Convert.ToInt32(curObj["ConfigManagerErrorCode"]))); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsConfigManagerUserConfigNull { @@ -380,7 +380,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("Indicates whether the device is using a user-defined configuration.")] @@ -393,7 +393,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 return ((bool)(curObj["ConfigManagerUserConfig"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsCpuStatusNull { @@ -406,7 +406,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The CpuStatus property specifies the current status of the processor. Changes in " + @@ -420,7 +420,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 return ((CpuStatusValues)(System.Convert.ToInt32(curObj["CpuStatus"]))); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("CreationClassName indicates the name of the class or the subclass used in the cre" + @@ -432,7 +432,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 return ((string)(curObj["CreationClassName"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsCurrentClockSpeedNull { @@ -445,7 +445,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The current speed (in MHz) of this processor.")] @@ -458,7 +458,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 return ((uint)(curObj["CurrentClockSpeed"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsCurrentVoltageNull { @@ -471,7 +471,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"The CurrentVoltage specifies the voltage of the processor. bits 0-6 of the field contain the processor's current voltage times 10. This value is only set when SMBIOS designates a voltage value. For specific values, see VoltageCaps. @@ -485,7 +485,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( return ((ushort)(curObj["CurrentVoltage"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsDataWidthNull { @@ -498,7 +498,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("Processor data width in bits.")] @@ -511,7 +511,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( return ((ushort)(curObj["DataWidth"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The Description property provides a textual description of the object. ")] @@ -520,7 +520,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( return ((string)(curObj["Description"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The DeviceID property contains a string uniquely identifying the processor with o" + @@ -530,7 +530,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( return ((string)(curObj["DeviceID"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsErrorClearedNull { @@ -543,7 +543,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("ErrorCleared is a boolean property indicating that the error reported in LastErro" + @@ -557,7 +557,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( return ((bool)(curObj["ErrorCleared"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("ErrorDescription is a free-form string supplying more information about the error" + @@ -568,7 +568,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( return ((string)(curObj["ErrorDescription"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsExtClockNull { @@ -581,7 +581,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The ExtClock property specifies the external clock frequency. If the frequency is" + @@ -595,7 +595,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( return ((uint)(curObj["ExtClock"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsFamilyNull { @@ -608,7 +608,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The processor family type. For example, values include \"Pentium(R) processor with" + @@ -622,7 +622,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( return ((FamilyValues)(System.Convert.ToInt32(curObj["Family"]))); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsInstallDateNull { @@ -635,7 +635,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The InstallDate property is datetime value indicating when the object was install" + @@ -651,7 +651,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsL2CacheSizeNull { @@ -664,7 +664,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The L2CacheSize property specifies the size of the processor\'s Level 2 cache. A L" + @@ -679,7 +679,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( return ((uint)(curObj["L2CacheSize"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsL2CacheSpeedNull { @@ -692,7 +692,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The L2CacheSpeed property specifies the clockspeed of the processor\'s Level 2 cac" + @@ -707,7 +707,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( return ((uint)(curObj["L2CacheSpeed"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsL3CacheSizeNull { @@ -720,7 +720,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The L3CacheSize property specifies the size of the processor\'s Level 3 cache. A L" + @@ -735,7 +735,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( return ((uint)(curObj["L3CacheSize"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsL3CacheSpeedNull { @@ -748,7 +748,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The L3CacheSpeed property specifies the clockspeed of the processor\'s Level 3 cac" + @@ -763,7 +763,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( return ((uint)(curObj["L3CacheSpeed"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsLastErrorCodeNull { @@ -776,7 +776,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("LastErrorCode captures the last error code reported by the logical device.")] @@ -789,7 +789,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( return ((uint)(curObj["LastErrorCode"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsLevelNull { @@ -802,7 +802,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The Level property further defines the processor type. The value depends on the " + @@ -816,7 +816,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( return ((ushort)(curObj["Level"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsLoadPercentageNull { @@ -829,7 +829,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The LoadPercentage property specifies each processor\'s load capacity averaged ove" + @@ -844,7 +844,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( return ((ushort)(curObj["LoadPercentage"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The Manufacturer property specifies the name of the processor\'s manufacturer.\nExa" + @@ -854,7 +854,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( return ((string)(curObj["Manufacturer"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsMaxClockSpeedNull { @@ -867,7 +867,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The maximum speed (in MHz) of this processor.")] @@ -880,7 +880,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( return ((uint)(curObj["MaxClockSpeed"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The Name property defines the label by which the object is known. When subclassed" + @@ -890,7 +890,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( return ((string)(curObj["Name"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsNumberOfCoresNull { @@ -903,7 +903,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The NumberOfCores property contains a Processor\'s total number of cores. e.g dual" + @@ -917,7 +917,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( return ((uint)(curObj["NumberOfCores"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsNumberOfLogicalProcessorsNull { @@ -930,7 +930,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The NumberOfLogicalProcessors property specifies the total number of logical proc" + @@ -944,7 +944,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( return ((uint)(curObj["NumberOfLogicalProcessors"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("A string describing the processor family type - used when the family property is " + @@ -955,7 +955,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( return ((string)(curObj["OtherFamilyDescription"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("Indicates the Win32 Plug and Play device ID of the logical device. Example: *PNP" + @@ -965,7 +965,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( return ((string)(curObj["PNPDeviceID"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"Indicates the specific power-related capabilities of the logical device. The array values, 0=""Unknown"", 1=""Not Supported"" and 2=""Disabled"" are self-explanatory. The value, 3=""Enabled"" indicates that the power management features are currently enabled but the exact feature set is unknown or the information is unavailable. ""Power Saving Modes Entered Automatically"" (4) describes that a device can change its power state based on usage or other criteria. ""Power State Settable"" (5) indicates that the SetPowerState method is supported. ""Power Cycling Supported"" (6) indicates that the SetPowerState method can be invoked with the PowerState input variable set to 5 (""Power Cycle""). ""Timed Power On Supported"" (7) indicates that the SetPowerState method can be invoked with the PowerState input variable set to 5 (""Power Cycle"") and the Time parameter set to a specific date and time, or interval, for power-on.")] @@ -980,7 +980,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( return enumToRet; } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPowerManagementSupportedNull { @@ -993,7 +993,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"Boolean indicating that the Device can be power managed - ie, put into a power save state. This boolean does not indicate that power management features are currently enabled, or if enabled, what features are supported. Refer to the PowerManagementCapabilities array for this information. If this boolean is false, the integer value 1, for the string, ""Not Supported"", should be the only entry in the PowerManagementCapabilities array.")] @@ -1006,7 +1006,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( return ((bool)(curObj["PowerManagementSupported"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"The ProcessorId property contains processor-specific information that describes the processor's features. For x86 class CPUs, the field's format depends on the processor's support of the CPUID instruction. If the instruction is supported, the ProcessorId property contains two DWORD-formatted values. The first (offsets 08h-0Bh) is the EAX value returned by a CPUID instruction with input EAX set to 1. The second (offsets 0Ch-0Fh) is the EDX value returned by that instruction. Only the first two bytes of the ProcessorID property are significant (all others are set to 0) and contain (in WORD-format) the contents of the DX register at CPU reset.")] @@ -1015,7 +1015,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( return ((string)(curObj["ProcessorId"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsProcessorTypeNull { @@ -1028,7 +1028,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The ProcessorType property specifies the processor\'s primary function.")] @@ -1041,7 +1041,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( return ((ProcessorTypeValues)(System.Convert.ToInt32(curObj["ProcessorType"]))); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsRevisionNull { @@ -1054,7 +1054,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The Revision property specifies the system\'s architecture-dependent revision leve" + @@ -1069,7 +1069,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( return ((ushort)(curObj["Revision"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("A free form string describing the role of the processor - for example, \"Central P" + @@ -1079,7 +1079,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( return ((string)(curObj["Role"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsSecondLevelAddressTranslationExtensionsNull { @@ -1092,7 +1092,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The SecondLevelAddressTranslationExtensions property determines whether the proce" + @@ -1106,7 +1106,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( return ((bool)(curObj["SecondLevelAddressTranslationExtensions"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The SocketDesignation property contains the type of chip socket used on the circu" + @@ -1116,7 +1116,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( return ((string)(curObj["SocketDesignation"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"The Status property is a string indicating the current status of the object. Various operational and non-operational statuses can be defined. Operational statuses are ""OK"", ""Degraded"" and ""Pred Fail"". ""Pred Fail"" indicates that an element may be functioning properly but predicting a failure in the near future. An example is a SMART-enabled hard drive. Non-operational statuses can also be specified. These are ""Error"", ""Starting"", ""Stopping"" and ""Service"". The latter, ""Service"", could apply during mirror-resilvering of a disk, reload of a user permissions list, or other administrative work. Not all such work is on-line, yet the managed element is neither ""OK"" nor in one of the other states.")] @@ -1125,7 +1125,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( return ((string)(curObj["Status"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsStatusInfoNull { @@ -1138,7 +1138,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("StatusInfo is a string indicating whether the logical device is in an enabled (va" + @@ -1154,7 +1154,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( return ((StatusInfoValues)(System.Convert.ToInt32(curObj["StatusInfo"]))); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("Stepping is a free-form string indicating the revision level of the processor wit" + @@ -1164,7 +1164,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( return ((string)(curObj["Stepping"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The scoping System\'s CreationClassName.")] @@ -1173,7 +1173,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( return ((string)(curObj["SystemCreationClassName"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The scoping System\'s Name.")] @@ -1182,7 +1182,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( return ((string)(curObj["SystemName"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("A globally unique identifier for the processor. This identifier may only be uniq" + @@ -1192,7 +1192,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( return ((string)(curObj["UniqueId"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsUpgradeMethodNull { @@ -1205,7 +1205,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("CPU socket information including data on how this Processor can be upgraded (if u" + @@ -1219,7 +1219,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( return ((UpgradeMethodValues)(System.Convert.ToInt32(curObj["UpgradeMethod"]))); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The Version property specifies an architecture-dependent processor revision numbe" + @@ -1229,7 +1229,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( return ((string)(curObj["Version"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsVirtualizationFirmwareEnabledNull { @@ -1242,7 +1242,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The VirtualizationFirmwareEnabled property determines whether the Firmware has en" + @@ -1256,7 +1256,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( return ((bool)(curObj["VirtualizationFirmwareEnabled"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsVMMonitorModeExtensionsNull { @@ -1269,7 +1269,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The VMMonitorModeExtensions property determines whether the processor supports In" + @@ -1283,7 +1283,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( return ((bool)(curObj["VMMonitorModeExtensions"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsVoltageCapsNull { @@ -1296,7 +1296,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"The VoltageCaps property specifies the voltage capabilities of the processor. Bits 0-3 of the field represent specific voltages that the processor socket can accept. All other bits should be set to zero. The socket is configurable if multiple bits are being set. For a range of voltages see CurrentVoltage. If the property is NULL, then the voltage capabilities are unknown.")] @@ -1309,9 +1309,9 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( return ((VoltageCapsValues)(System.Convert.ToInt32(curObj["VoltageCaps"]))); } } - + private bool CheckIfProperClass(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions OptionsParam) { - if (((path != null) + if (((path != null) && (string.Compare(path.ClassName, this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -1319,9 +1319,9 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( return CheckIfProperClass(new System.Management.ManagementObject(mgmtScope, path, OptionsParam)); } } - + private bool CheckIfProperClass(System.Management.ManagementBaseObject theObj) { - if (((theObj != null) + if (((theObj != null) && (string.Compare(((string)(theObj["__CLASS"])), this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -1338,91 +1338,91 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( } return false; } - + private bool ShouldSerializeAddressWidth() { if ((this.IsAddressWidthNull == false)) { return true; } return false; } - + private bool ShouldSerializeArchitecture() { if ((this.IsArchitectureNull == false)) { return true; } return false; } - + private bool ShouldSerializeAvailability() { if ((this.IsAvailabilityNull == false)) { return true; } return false; } - + private bool ShouldSerializeConfigManagerErrorCode() { if ((this.IsConfigManagerErrorCodeNull == false)) { return true; } return false; } - + private bool ShouldSerializeConfigManagerUserConfig() { if ((this.IsConfigManagerUserConfigNull == false)) { return true; } return false; } - + private bool ShouldSerializeCpuStatus() { if ((this.IsCpuStatusNull == false)) { return true; } return false; } - + private bool ShouldSerializeCurrentClockSpeed() { if ((this.IsCurrentClockSpeedNull == false)) { return true; } return false; } - + private bool ShouldSerializeCurrentVoltage() { if ((this.IsCurrentVoltageNull == false)) { return true; } return false; } - + private bool ShouldSerializeDataWidth() { if ((this.IsDataWidthNull == false)) { return true; } return false; } - + private bool ShouldSerializeErrorCleared() { if ((this.IsErrorClearedNull == false)) { return true; } return false; } - + private bool ShouldSerializeExtClock() { if ((this.IsExtClockNull == false)) { return true; } return false; } - + private bool ShouldSerializeFamily() { if ((this.IsFamilyNull == false)) { return true; } return false; } - + // Converts a given datetime in DMTF format to System.DateTime object. static System.DateTime ToDateTime(string dmtfDate) { System.DateTime initializer = System.DateTime.MinValue; @@ -1474,13 +1474,13 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( if (("******" != tempString)) { ticks = (long.Parse(tempString) * ((long)((System.TimeSpan.TicksPerMillisecond / 1000)))); } - if (((((((((year < 0) - || (month < 0)) - || (day < 0)) - || (hour < 0)) - || (minute < 0)) - || (minute < 0)) - || (second < 0)) + if (((((((((year < 0) + || (month < 0)) + || (day < 0)) + || (hour < 0)) + || (minute < 0)) + || (minute < 0)) + || (second < 0)) || (ticks < 0))) { throw new System.ArgumentOutOfRangeException(); } @@ -1508,7 +1508,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( } return datetime; } - + // Converts a given System.DateTime object to DMTF datetime format. static string ToDmtfDateTime(System.DateTime date) { string utcString = string.Empty; @@ -1535,8 +1535,8 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( dmtfDateTime = string.Concat(dmtfDateTime, ((int)(date.Second)).ToString().PadLeft(2, '0')); dmtfDateTime = string.Concat(dmtfDateTime, "."); System.DateTime dtTemp = new System.DateTime(date.Year, date.Month, date.Day, date.Hour, date.Minute, date.Second, 0); - long microsec = ((long)((((date.Ticks - dtTemp.Ticks) - * 1000) + long microsec = ((long)((((date.Ticks - dtTemp.Ticks) + * 1000) / System.TimeSpan.TicksPerMillisecond))); string strMicrosec = ((long)(microsec)).ToString(); if ((strMicrosec.Length > 6)) { @@ -1546,172 +1546,172 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( dmtfDateTime = string.Concat(dmtfDateTime, utcString); return dmtfDateTime; } - + private bool ShouldSerializeInstallDate() { if ((this.IsInstallDateNull == false)) { return true; } return false; } - + private bool ShouldSerializeL2CacheSize() { if ((this.IsL2CacheSizeNull == false)) { return true; } return false; } - + private bool ShouldSerializeL2CacheSpeed() { if ((this.IsL2CacheSpeedNull == false)) { return true; } return false; } - + private bool ShouldSerializeL3CacheSize() { if ((this.IsL3CacheSizeNull == false)) { return true; } return false; } - + private bool ShouldSerializeL3CacheSpeed() { if ((this.IsL3CacheSpeedNull == false)) { return true; } return false; } - + private bool ShouldSerializeLastErrorCode() { if ((this.IsLastErrorCodeNull == false)) { return true; } return false; } - + private bool ShouldSerializeLevel() { if ((this.IsLevelNull == false)) { return true; } return false; } - + private bool ShouldSerializeLoadPercentage() { if ((this.IsLoadPercentageNull == false)) { return true; } return false; } - + private bool ShouldSerializeMaxClockSpeed() { if ((this.IsMaxClockSpeedNull == false)) { return true; } return false; } - + private bool ShouldSerializeNumberOfCores() { if ((this.IsNumberOfCoresNull == false)) { return true; } return false; } - + private bool ShouldSerializeNumberOfLogicalProcessors() { if ((this.IsNumberOfLogicalProcessorsNull == false)) { return true; } return false; } - + private bool ShouldSerializePowerManagementSupported() { if ((this.IsPowerManagementSupportedNull == false)) { return true; } return false; } - + private bool ShouldSerializeProcessorType() { if ((this.IsProcessorTypeNull == false)) { return true; } return false; } - + private bool ShouldSerializeRevision() { if ((this.IsRevisionNull == false)) { return true; } return false; } - + private bool ShouldSerializeSecondLevelAddressTranslationExtensions() { if ((this.IsSecondLevelAddressTranslationExtensionsNull == false)) { return true; } return false; } - + private bool ShouldSerializeStatusInfo() { if ((this.IsStatusInfoNull == false)) { return true; } return false; } - + private bool ShouldSerializeUpgradeMethod() { if ((this.IsUpgradeMethodNull == false)) { return true; } return false; } - + private bool ShouldSerializeVirtualizationFirmwareEnabled() { if ((this.IsVirtualizationFirmwareEnabledNull == false)) { return true; } return false; } - + private bool ShouldSerializeVMMonitorModeExtensions() { if ((this.IsVMMonitorModeExtensionsNull == false)) { return true; } return false; } - + private bool ShouldSerializeVoltageCaps() { if ((this.IsVoltageCapsNull == false)) { return true; } return false; } - + [Browsable(true)] public void CommitObject() { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(); } } - + [Browsable(true)] public void CommitObject(System.Management.PutOptions putOptions) { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(putOptions); } } - + private void Initialize() { AutoCommitProp = true; isEmbedded = false; } - + private static string ConstructPath(string keyDeviceID) { string strPath = "ROOT\\CIMV2:Win32_Processor"; strPath = string.Concat(strPath, string.Concat(".DeviceID=", string.Concat("\"", string.Concat(keyDeviceID, "\"")))); return strPath; } - + private void InitializeObject(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { Initialize(); if ((path != null)) { @@ -1723,24 +1723,24 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( PrivateSystemProperties = new ManagementSystemProperties(PrivateLateBoundObject); curObj = PrivateLateBoundObject; } - + // Different overloads of GetInstances() help in enumerating instances of the WMI class. public static ProcessorCollection GetInstances() { return GetInstances(null, null, null); } - + public static ProcessorCollection GetInstances(string condition) { return GetInstances(null, condition, null); } - + public static ProcessorCollection GetInstances(string[] selectedProperties) { return GetInstances(null, null, selectedProperties); } - + public static ProcessorCollection GetInstances(string condition, string[] selectedProperties) { return GetInstances(null, condition, selectedProperties); } - + public static ProcessorCollection GetInstances(System.Management.ManagementScope mgmtScope, System.Management.EnumerationOptions enumOptions) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -1761,15 +1761,15 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( } return new ProcessorCollection(clsObject.GetInstances(enumOptions)); } - + public static ProcessorCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition) { return GetInstances(mgmtScope, condition, null); } - + public static ProcessorCollection GetInstances(System.Management.ManagementScope mgmtScope, string[] selectedProperties) { return GetInstances(mgmtScope, null, selectedProperties); } - + public static ProcessorCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition, string[] selectedProperties) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -1786,7 +1786,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( ObjectSearcher.Options = enumOptions; return new ProcessorCollection(ObjectSearcher.Get()); } - + [Browsable(true)] public static Processor CreateInstance() { System.Management.ManagementScope mgmtScope = null; @@ -1801,12 +1801,12 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( System.Management.ManagementClass tmpMgmtClass = new System.Management.ManagementClass(mgmtScope, mgmtPath, null); return new Processor(tmpMgmtClass.CreateInstance()); } - + [Browsable(true)] public void Delete() { PrivateLateBoundObject.Delete(); } - + public uint Reset() { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1817,7 +1817,7 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( return System.Convert.ToUInt32(0); } } - + public uint SetPowerState(ushort PowerState, System.DateTime Time) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1831,514 +1831,514 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( return System.Convert.ToUInt32(0); } } - + public enum ArchitectureValues { - + X86 = 0, - + MIPS = 1, - + Alpha = 2, - + PowerPC = 3, - + Ia64 = 6, - + X64 = 9, - + NULL_ENUM_VALUE = 10, } - + public enum AvailabilityValues { - + Other0 = 1, - + Unknown0 = 2, - + Running_Full_Power = 3, - + Warning = 4, - + In_Test = 5, - + Not_Applicable = 6, - + Power_Off = 7, - + Off_Line = 8, - + Off_Duty = 9, - + Degraded = 10, - + Not_Installed = 11, - + Install_Error = 12, - + Power_Save_Unknown = 13, - + Power_Save_Low_Power_Mode = 14, - + Power_Save_Standby = 15, - + Power_Cycle = 16, - + Power_Save_Warning = 17, - + Paused = 18, - + Not_Ready = 19, - + Not_Configured = 20, - + Quiesced = 21, - + NULL_ENUM_VALUE = 0, } - + public enum ConfigManagerErrorCodeValues { - + This_device_is_working_properly_ = 0, - + This_device_is_not_configured_correctly_ = 1, - + Windows_cannot_load_the_driver_for_this_device_ = 2, - + The_driver_for_this_device_might_be_corrupted_or_your_system_may_be_running_low_on_memory_or_other_resources_ = 3, - + This_device_is_not_working_properly_One_of_its_drivers_or_your_registry_might_be_corrupted_ = 4, - + The_driver_for_this_device_needs_a_resource_that_Windows_cannot_manage_ = 5, - + The_boot_configuration_for_this_device_conflicts_with_other_devices_ = 6, - + Cannot_filter_ = 7, - + The_driver_loader_for_the_device_is_missing_ = 8, - + This_device_is_not_working_properly_because_the_controlling_firmware_is_reporting_the_resources_for_the_device_incorrectly_ = 9, - + This_device_cannot_start_ = 10, - + This_device_failed_ = 11, - + This_device_cannot_find_enough_free_resources_that_it_can_use_ = 12, - + Windows_cannot_verify_this_device_s_resources_ = 13, - + This_device_cannot_work_properly_until_you_restart_your_computer_ = 14, - + This_device_is_not_working_properly_because_there_is_probably_a_re_enumeration_problem_ = 15, - + Windows_cannot_identify_all_the_resources_this_device_uses_ = 16, - + This_device_is_asking_for_an_unknown_resource_type_ = 17, - + Reinstall_the_drivers_for_this_device_ = 18, - + Failure_using_the_VxD_loader_ = 19, - + Your_registry_might_be_corrupted_ = 20, - + System_failure_Try_changing_the_driver_for_this_device_If_that_does_not_work_see_your_hardware_documentation_Windows_is_removing_this_device_ = 21, - + This_device_is_disabled_ = 22, - + System_failure_Try_changing_the_driver_for_this_device_If_that_doesn_t_work_see_your_hardware_documentation_ = 23, - + This_device_is_not_present_is_not_working_properly_or_does_not_have_all_its_drivers_installed_ = 24, - + Windows_is_still_setting_up_this_device_ = 25, - + Windows_is_still_setting_up_this_device_0 = 26, - + This_device_does_not_have_valid_log_configuration_ = 27, - + The_drivers_for_this_device_are_not_installed_ = 28, - + This_device_is_disabled_because_the_firmware_of_the_device_did_not_give_it_the_required_resources_ = 29, - + This_device_is_using_an_Interrupt_Request_IRQ_resource_that_another_device_is_using_ = 30, - + This_device_is_not_working_properly_because_Windows_cannot_load_the_drivers_required_for_this_device_ = 31, - + NULL_ENUM_VALUE = 32, } - + public enum CpuStatusValues { - + Unknown0 = 0, - + CPU_Enabled = 1, - + CPU_Disabled_by_User_via_BIOS_Setup = 2, - + CPU_Disabled_By_BIOS_POST_Error_ = 3, - + CPU_is_Idle = 4, - + Reserved = 5, - + Reserved0 = 6, - + Other0 = 7, - + NULL_ENUM_VALUE = 8, } - + public enum FamilyValues { - + Other0 = 1, - + Unknown0 = 2, - + Val_8086 = 3, - + Val_80286 = 4, - + Val_80386 = 5, - + Val_80486 = 6, - + Val_8087 = 7, - + Val_80287 = 8, - + Val_80387 = 9, - + Val_80487 = 10, - + Pentium_R_brand = 11, - + Pentium_R_Pro = 12, - + Pentium_R_II = 13, - + Pentium_R_processor_with_MMX_TM_technology = 14, - + Celeron_TM_ = 15, - + Pentium_R_II_Xeon_TM_ = 16, - + Pentium_R_III = 17, - + M1_Family = 18, - + M2_Family = 19, - + K5_Family = 24, - + K6_Family = 25, - + K6_2 = 26, - + K6_3 = 27, - + AMD_Athlon_TM_Processor_Family = 28, - + AMD_R_Duron_TM_Processor = 29, - + AMD29000_Family = 30, - + K6_2_ = 31, - + Power_PC_Family = 32, - + Power_PC_601 = 33, - + Power_PC_603 = 34, - + Power_PC_603_ = 35, - + Power_PC_604 = 36, - + Power_PC_620 = 37, - + Power_PC_X704 = 38, - + Power_PC_750 = 39, - + Alpha_Family = 48, - + Alpha_21064 = 49, - + Alpha_21066 = 50, - + Alpha_21164 = 51, - + Alpha_21164PC = 52, - + Alpha_21164a = 53, - + Alpha_21264 = 54, - + Alpha_21364 = 55, - + MIPS_Family = 64, - + MIPS_R4000 = 65, - + MIPS_R4200 = 66, - + MIPS_R4400 = 67, - + MIPS_R4600 = 68, - + MIPS_R10000 = 69, - + SPARC_Family = 80, - + SuperSPARC = 81, - + MicroSPARC_II = 82, - + MicroSPARC_IIep = 83, - + UltraSPARC = 84, - + UltraSPARC_II = 85, - + UltraSPARC_IIi = 86, - + UltraSPARC_III0 = 87, - + UltraSPARC_IIIi = 88, - + Val_68040 = 96, - + Val_68xxx_Family = 97, - + Val_68000 = 98, - + Val_68010 = 99, - + Val_68020 = 100, - + Val_68030 = 101, - + Hobbit_Family = 112, - + Crusoe_TM_TM5000_Family = 120, - + Crusoe_TM_TM3000_Family = 121, - + Efficeon_TM_TM8000_Family = 122, - + Weitek = 128, - + Itanium_TM_Processor = 130, - + AMD_Athlon_TM_64_Processor_Family = 131, - + AMD_Opteron_TM_Family = 132, - + PA_RISC_Family = 144, - + PA_RISC_8500 = 145, - + PA_RISC_8000 = 146, - + PA_RISC_7300LC = 147, - + PA_RISC_7200 = 148, - + PA_RISC_7100LC = 149, - + PA_RISC_7100 = 150, - + V30_Family = 160, - + Pentium_R_III_Xeon_TM_ = 176, - + Pentium_R_III_Processor_with_Intel_R_SpeedStep_TM_Technology = 177, - + Pentium_R_4 = 178, - + Intel_R_Xeon_TM_ = 179, - + AS400_Family = 180, - + Intel_R_Xeon_TM_processor_MP = 181, - + AMD_AthlonXP_TM_Family = 182, - + AMD_AthlonMP_TM_Family = 183, - + Intel_R_Itanium_R_2 = 184, - + Intel_Pentium_M_Processor = 185, - + K7 = 190, - + IBM390_Family = 200, - + G4 = 201, - + G5 = 202, - + G6 = 203, - + Z_Architecture_base = 204, - + I860 = 250, - + I960 = 251, - + SH_3 = 260, - + SH_4 = 261, - + ARM = 280, - + StrongARM = 281, - + Val_6x86 = 300, - + MediaGX = 301, - + MII = 302, - + WinChip = 320, - + DSP = 350, - + Video_Processor = 500, - + NULL_ENUM_VALUE = 0, } - + public enum PowerManagementCapabilitiesValues { - + Unknown0 = 0, - + Not_Supported = 1, - + Disabled = 2, - + Enabled = 3, - + Power_Saving_Modes_Entered_Automatically = 4, - + Power_State_Settable = 5, - + Power_Cycling_Supported = 6, - + Timed_Power_On_Supported = 7, - + NULL_ENUM_VALUE = 8, } - + public enum ProcessorTypeValues { - + Other0 = 1, - + Unknown0 = 2, - + Central_Processor = 3, - + Math_Processor = 4, - + DSP_Processor = 5, - + Video_Processor = 6, - + NULL_ENUM_VALUE = 0, } - + public enum StatusInfoValues { - + Other0 = 1, - + Unknown0 = 2, - + Enabled = 3, - + Disabled = 4, - + Not_Applicable = 5, - + NULL_ENUM_VALUE = 0, } - + public enum UpgradeMethodValues { - + Other0 = 1, - + Unknown0 = 2, - + Daughter_Board = 3, - + ZIF_Socket = 4, - + Replacement_Piggy_Back = 5, - + None = 6, - + LIF_Socket = 7, - + Slot_1 = 8, - + Slot_2 = 9, - + Val_370_Pin_Socket = 10, - + Slot_A = 11, - + Slot_M = 12, - + Socket_423 = 13, - + Socket_A_Socket_462_ = 14, - + Socket_478 = 15, - + Socket_754 = 16, - + Socket_940 = 17, - + Socket_939 = 18, - + NULL_ENUM_VALUE = 0, } - + public enum VoltageCapsValues { - + Val_5 = 1, - + Val_3_3 = 2, - + Val_2_9 = 4, - + NULL_ENUM_VALUE = 8, } - + // Enumerator implementation for enumerating instances of the class. public class ProcessorCollection : object, ICollection { - + private ManagementObjectCollection privColObj; - + public ProcessorCollection(ManagementObjectCollection objCollection) { privColObj = objCollection; } - + public virtual int Count { get { return privColObj.Count; } } - + public virtual bool IsSynchronized { get { return privColObj.IsSynchronized; } } - + public virtual object SyncRoot { get { return this; } } - + public virtual void CopyTo(System.Array array, int index) { privColObj.CopyTo(array, index); int nCtr; @@ -2346,189 +2346,189 @@ Example: field value for a processor voltage of 1.8 volts would be 92h = 80h + ( array.SetValue(new Processor(((System.Management.ManagementObject)(array.GetValue(nCtr)))), nCtr); } } - + public virtual System.Collections.IEnumerator GetEnumerator() { return new ProcessorEnumerator(privColObj.GetEnumerator()); } - + public class ProcessorEnumerator : object, System.Collections.IEnumerator { - + private ManagementObjectCollection.ManagementObjectEnumerator privObjEnum; - + public ProcessorEnumerator(ManagementObjectCollection.ManagementObjectEnumerator objEnum) { privObjEnum = objEnum; } - + public virtual object Current { get { return new Processor(((System.Management.ManagementObject)(privObjEnum.Current))); } } - + public virtual bool MoveNext() { return privObjEnum.MoveNext(); } - + public virtual void Reset() { privObjEnum.Reset(); } } } - + // TypeConverter to handle null values for ValueType properties public class WMIValueTypeConverter : TypeConverter { - + private TypeConverter baseConverter; - + private System.Type baseType; - + public WMIValueTypeConverter(System.Type inBaseType) { baseConverter = TypeDescriptor.GetConverter(inBaseType); baseType = inBaseType; } - + 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 ((baseType.BaseType == typeof(System.Enum))) { if ((value.GetType() == destinationType)) { return value; } - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return "NULL_ENUM_VALUE" ; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((baseType == typeof(bool)) + if (((baseType == typeof(bool)) && (baseType.BaseType == typeof(System.ValueType)))) { - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((context != null) + if (((context != null) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } } - + // Embedded class to represent WMI system Properties. [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 { diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_ComputerSystem.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_ComputerSystem.cs index 76057138f71..012b33bc67f 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_ComputerSystem.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_ComputerSystem.cs @@ -23,8 +23,8 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { using System.Globalization; using System.ComponentModel.Design.Serialization; using System.Reflection; - - + + // Functions ShouldSerialize are functions used by VS property browser to check if a particular property has to be serialized. These functions are added for all ValueType properties ( properties of type Int32, BOOL etc.. which cannot be set to null). These functions use IsNull function. These functions are also used in the TypeConverter implementation for the properties to check for NULL value of property so that an empty value can be shown in Property browser in case of Drag and Drop in Visual studio. // Functions IsNull() are used to check if a property is NULL. // Functions Reset are added for Nullable Read/Write properties. These functions are used by VS designer in property browser to set a property to NULL. @@ -32,62 +32,62 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { // Datetime conversion functions ToDateTime and ToDmtfDateTime are added to the class to convert DMTF datetime to System.DateTime and vice-versa. // An Early Bound class generated for the WMI class.Msvm_ComputerSystem public class ComputerSystem : System.ComponentModel.Component { - + // Private property to hold the WMI namespace in which the class resides. private static string CreatedWmiNamespace = "ROOT\\virtualization\\v2"; - + // Private property to hold the name of WMI class which created this class. private static string CreatedClassName = "Msvm_ComputerSystem"; - + // Private member variable to hold the ManagementScope which is used by the various methods. private static System.Management.ManagementScope statMgmtScope = null; - + private ManagementSystemProperties PrivateSystemProperties; - + // Underlying lateBound WMI object. private System.Management.ManagementObject PrivateLateBoundObject; - + // Member variable to store the 'automatic commit' behavior for the class. private bool AutoCommitProp; - + // Private variable to hold the embedded property representing the instance. private System.Management.ManagementBaseObject embeddedObj; - + // The current WMI object used private System.Management.ManagementBaseObject curObj; - + // Flag to indicate if the instance is an embedded object. private bool isEmbedded; - + // Below are different overloads of constructors to initialize an instance of the class with a WMI object. public ComputerSystem() { this.InitializeObject(null, null, null); } - + public ComputerSystem(string keyCreationClassName, string keyName) { this.InitializeObject(null, new System.Management.ManagementPath(ComputerSystem.ConstructPath(keyCreationClassName, keyName)), null); } - + public ComputerSystem(System.Management.ManagementScope mgmtScope, string keyCreationClassName, string keyName) { this.InitializeObject(((System.Management.ManagementScope)(mgmtScope)), new System.Management.ManagementPath(ComputerSystem.ConstructPath(keyCreationClassName, keyName)), null); } - + public ComputerSystem(System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(null, path, getOptions); } - + public ComputerSystem(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path) { this.InitializeObject(mgmtScope, path, null); } - + public ComputerSystem(System.Management.ManagementPath path) { this.InitializeObject(null, path, null); } - + public ComputerSystem(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(mgmtScope, path, getOptions); } - + public ComputerSystem(System.Management.ManagementObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -99,7 +99,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { throw new System.ArgumentException("Class name does not match."); } } - + public ComputerSystem(System.Management.ManagementBaseObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -112,7 +112,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { throw new System.ArgumentException("Class name does not match."); } } - + // Property returns the namespace of the WMI class. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -121,7 +121,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return "ROOT\\virtualization\\v2"; } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ManagementClassName { @@ -130,7 +130,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { if ((curObj != null)) { if ((curObj.ClassPath != null)) { strRet = ((string)(curObj["__CLASS"])); - if (((strRet == null) + if (((strRet == null) || (strRet == string.Empty))) { strRet = CreatedClassName; } @@ -139,7 +139,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return strRet; } } - + // Property pointing to an embedded object to get System properties of the WMI object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -148,7 +148,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return PrivateSystemProperties; } } - + // Property returning the underlying lateBound object. [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -157,7 +157,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return curObj; } } - + // ManagementScope of the object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -176,7 +176,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + // Property to show the commit behavior for the WMI object. If true, WMI object will be automatically saved after each property modification.(ie. Put() is called after modification of a property). [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -188,7 +188,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { AutoCommitProp = value; } } - + // The ManagementPath of the underlying WMI object. [Browsable(true)] public System.Management.ManagementPath Path { @@ -209,7 +209,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + // Public static scope property which is used by the various methods. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -221,7 +221,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { statMgmtScope = value; } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public ushort[] AvailableRequestedStates { @@ -229,7 +229,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort[])(curObj["AvailableRequestedStates"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Caption { @@ -237,7 +237,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Caption"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsCommunicationStatusNull { @@ -250,7 +250,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -262,7 +262,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["CommunicationStatus"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string CreationClassName { @@ -270,7 +270,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["CreationClassName"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public ushort[] Dedicated { @@ -278,7 +278,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort[])(curObj["Dedicated"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Description { @@ -286,7 +286,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Description"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsDetailedStatusNull { @@ -299,7 +299,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -311,7 +311,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["DetailedStatus"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ElementName { @@ -319,7 +319,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["ElementName"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsEnabledDefaultNull { @@ -332,7 +332,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -344,7 +344,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["EnabledDefault"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsEnabledStateNull { @@ -357,7 +357,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -369,7 +369,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["EnabledState"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsFailedOverReplicationTypeNull { @@ -382,7 +382,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("Type of failover that was performed for the virtual machine.")] @@ -395,7 +395,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((FailedOverReplicationTypeValues)(System.Convert.ToInt32(curObj["FailedOverReplicationType"]))); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsHealthStateNull { @@ -408,7 +408,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -420,7 +420,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["HealthState"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string[] IdentifyingDescriptions { @@ -428,7 +428,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string[])(curObj["IdentifyingDescriptions"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsInstallDateNull { @@ -441,7 +441,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -455,7 +455,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string InstanceID { @@ -463,7 +463,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["InstanceID"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsLastApplicationConsistentReplicationTimeNull { @@ -476,7 +476,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The time at which the last application consistent replication is received on reco" + @@ -492,7 +492,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsLastReplicationTimeNull { @@ -505,7 +505,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The time at which the last replication is received on recovery for the virtual ma" + @@ -521,7 +521,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsLastReplicationTypeNull { @@ -534,7 +534,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("Type of the last replication that was received for the virtual machine.")] @@ -547,7 +547,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((LastReplicationTypeValues)(System.Convert.ToInt32(curObj["LastReplicationType"]))); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsLastSuccessfulBackupTimeNull { @@ -560,7 +560,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The time at which the last successful backup has completed for the virtual machin" + @@ -576,7 +576,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Name { @@ -584,7 +584,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Name"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string NameFormat { @@ -592,7 +592,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["NameFormat"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsNumberOfNumaNodesNull { @@ -605,7 +605,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"The number of non-uniform memory access (NUMA) nodes of the computer system. When Msvm_ComputerSystem represents the hosting computer system, this property contains the count of physical NUMA nodes. When Msvm_ComputerSystem represents a virtual computer system, this property contains the number of virtual NUMA nodes that are presented to the guest OS through the ACPI System Resource Affinity Table (SRAT).")] @@ -618,7 +618,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["NumberOfNumaNodes"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsOnTimeInMillisecondsNull { @@ -631,7 +631,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"For the virtual system, this property describes the total up time, in milliseconds, since the machine was last turned on, reset, or restored. This time excludes the time the virtual system was in the paused state. For the host system, this property is set to NULL.")] @@ -644,7 +644,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ulong)(curObj["OnTimeInMilliseconds"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsOperatingStatusNull { @@ -657,7 +657,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -669,7 +669,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["OperatingStatus"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public ushort[] OperationalStatus { @@ -677,7 +677,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort[])(curObj["OperationalStatus"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string[] OtherDedicatedDescriptions { @@ -685,7 +685,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string[])(curObj["OtherDedicatedDescriptions"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string OtherEnabledState { @@ -693,7 +693,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["OtherEnabledState"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string[] OtherIdentifyingInfo { @@ -701,7 +701,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string[])(curObj["OtherIdentifyingInfo"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public ushort[] PowerManagementCapabilities { @@ -709,7 +709,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort[])(curObj["PowerManagementCapabilities"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string PrimaryOwnerContact { @@ -717,7 +717,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["PrimaryOwnerContact"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string PrimaryOwnerName { @@ -725,7 +725,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["PrimaryOwnerName"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPrimaryStatusNull { @@ -738,7 +738,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -750,7 +750,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["PrimaryStatus"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsProcessIDNull { @@ -763,7 +763,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The identifier of the process under which this virtual machine is running. This v" + @@ -778,7 +778,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((uint)(curObj["ProcessID"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsReplicationHealthNull { @@ -791,7 +791,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("Replication health for the virtual machine.")] @@ -804,7 +804,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ReplicationHealthValues)(System.Convert.ToInt32(curObj["ReplicationHealth"]))); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsReplicationModeNull { @@ -817,7 +817,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("Identifies replication type for the virtual machine.")] @@ -830,7 +830,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ReplicationModeValues)(System.Convert.ToInt32(curObj["ReplicationMode"]))); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsReplicationStateNull { @@ -843,7 +843,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("Replication state for the virtual machine.")] @@ -856,7 +856,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ReplicationStateValues)(System.Convert.ToInt32(curObj["ReplicationState"]))); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsRequestedStateNull { @@ -869,7 +869,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -881,7 +881,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["RequestedState"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsResetCapabilityNull { @@ -894,7 +894,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -906,7 +906,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["ResetCapability"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string[] Roles { @@ -914,7 +914,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string[])(curObj["Roles"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Status { @@ -922,7 +922,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Status"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string[] StatusDescriptions { @@ -930,7 +930,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string[])(curObj["StatusDescriptions"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsTimeOfLastConfigurationChangeNull { @@ -943,7 +943,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The date and time when the virtual machine configuration file was last modified. " + @@ -961,7 +961,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsTimeOfLastStateChangeNull { @@ -974,7 +974,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -988,7 +988,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsTransitioningToStateNull { @@ -1001,7 +1001,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -1013,9 +1013,9 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["TransitioningToState"])); } } - + private bool CheckIfProperClass(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions OptionsParam) { - if (((path != null) + if (((path != null) && (string.Compare(path.ClassName, this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -1023,9 +1023,9 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return CheckIfProperClass(new System.Management.ManagementObject(mgmtScope, path, OptionsParam)); } } - + private bool CheckIfProperClass(System.Management.ManagementBaseObject theObj) { - if (((theObj != null) + if (((theObj != null) && (string.Compare(((string)(theObj["__CLASS"])), this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -1042,49 +1042,49 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } return false; } - + private bool ShouldSerializeCommunicationStatus() { if ((this.IsCommunicationStatusNull == false)) { return true; } return false; } - + private bool ShouldSerializeDetailedStatus() { if ((this.IsDetailedStatusNull == false)) { return true; } return false; } - + private bool ShouldSerializeEnabledDefault() { if ((this.IsEnabledDefaultNull == false)) { return true; } return false; } - + private bool ShouldSerializeEnabledState() { if ((this.IsEnabledStateNull == false)) { return true; } return false; } - + private bool ShouldSerializeFailedOverReplicationType() { if ((this.IsFailedOverReplicationTypeNull == false)) { return true; } return false; } - + private bool ShouldSerializeHealthState() { if ((this.IsHealthStateNull == false)) { return true; } return false; } - + // Converts a given datetime in DMTF format to System.DateTime object. static System.DateTime ToDateTime(string dmtfDate) { System.DateTime initializer = System.DateTime.MinValue; @@ -1136,13 +1136,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { if (("******" != tempString)) { ticks = (long.Parse(tempString) * ((long)((System.TimeSpan.TicksPerMillisecond / 1000)))); } - if (((((((((year < 0) - || (month < 0)) - || (day < 0)) - || (hour < 0)) - || (minute < 0)) - || (minute < 0)) - || (second < 0)) + if (((((((((year < 0) + || (month < 0)) + || (day < 0)) + || (hour < 0)) + || (minute < 0)) + || (minute < 0)) + || (second < 0)) || (ticks < 0))) { throw new System.ArgumentOutOfRangeException(); } @@ -1170,7 +1170,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } return datetime; } - + // Converts a given System.DateTime object to DMTF datetime format. static string ToDmtfDateTime(System.DateTime date) { string utcString = string.Empty; @@ -1197,8 +1197,8 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { dmtfDateTime = string.Concat(dmtfDateTime, ((int)(date.Second)).ToString().PadLeft(2, '0')); dmtfDateTime = string.Concat(dmtfDateTime, "."); System.DateTime dtTemp = new System.DateTime(date.Year, date.Month, date.Day, date.Hour, date.Minute, date.Second, 0); - long microsec = ((long)((((date.Ticks - dtTemp.Ticks) - * 1000) + long microsec = ((long)((((date.Ticks - dtTemp.Ticks) + * 1000) / System.TimeSpan.TicksPerMillisecond))); string strMicrosec = ((long)(microsec)).ToString(); if ((strMicrosec.Length > 6)) { @@ -1208,159 +1208,159 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { dmtfDateTime = string.Concat(dmtfDateTime, utcString); return dmtfDateTime; } - + private bool ShouldSerializeInstallDate() { if ((this.IsInstallDateNull == false)) { return true; } return false; } - + private bool ShouldSerializeLastApplicationConsistentReplicationTime() { if ((this.IsLastApplicationConsistentReplicationTimeNull == false)) { return true; } return false; } - + private bool ShouldSerializeLastReplicationTime() { if ((this.IsLastReplicationTimeNull == false)) { return true; } return false; } - + private bool ShouldSerializeLastReplicationType() { if ((this.IsLastReplicationTypeNull == false)) { return true; } return false; } - + private bool ShouldSerializeLastSuccessfulBackupTime() { if ((this.IsLastSuccessfulBackupTimeNull == false)) { return true; } return false; } - + private bool ShouldSerializeNumberOfNumaNodes() { if ((this.IsNumberOfNumaNodesNull == false)) { return true; } return false; } - + private bool ShouldSerializeOnTimeInMilliseconds() { if ((this.IsOnTimeInMillisecondsNull == false)) { return true; } return false; } - + private bool ShouldSerializeOperatingStatus() { if ((this.IsOperatingStatusNull == false)) { return true; } return false; } - + private bool ShouldSerializePrimaryStatus() { if ((this.IsPrimaryStatusNull == false)) { return true; } return false; } - + private bool ShouldSerializeProcessID() { if ((this.IsProcessIDNull == false)) { return true; } return false; } - + private bool ShouldSerializeReplicationHealth() { if ((this.IsReplicationHealthNull == false)) { return true; } return false; } - + private bool ShouldSerializeReplicationMode() { if ((this.IsReplicationModeNull == false)) { return true; } return false; } - + private bool ShouldSerializeReplicationState() { if ((this.IsReplicationStateNull == false)) { return true; } return false; } - + private bool ShouldSerializeRequestedState() { if ((this.IsRequestedStateNull == false)) { return true; } return false; } - + private bool ShouldSerializeResetCapability() { if ((this.IsResetCapabilityNull == false)) { return true; } return false; } - + private bool ShouldSerializeTimeOfLastConfigurationChange() { if ((this.IsTimeOfLastConfigurationChangeNull == false)) { return true; } return false; } - + private bool ShouldSerializeTimeOfLastStateChange() { if ((this.IsTimeOfLastStateChangeNull == false)) { return true; } return false; } - + private bool ShouldSerializeTransitioningToState() { if ((this.IsTransitioningToStateNull == false)) { return true; } return false; } - + [Browsable(true)] public void CommitObject() { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(); } } - + [Browsable(true)] public void CommitObject(System.Management.PutOptions putOptions) { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(putOptions); } } - + private void Initialize() { AutoCommitProp = true; isEmbedded = false; } - + private static string ConstructPath(string keyCreationClassName, string keyName) { string strPath = "ROOT\\virtualization\\v2:Msvm_ComputerSystem"; strPath = string.Concat(strPath, string.Concat(".CreationClassName=", string.Concat("\"", string.Concat(keyCreationClassName, "\"")))); strPath = string.Concat(strPath, string.Concat(",Name=", string.Concat("\"", string.Concat(keyName, "\"")))); return strPath; } - + private void InitializeObject(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { Initialize(); if ((path != null)) { @@ -1372,24 +1372,24 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { PrivateSystemProperties = new ManagementSystemProperties(PrivateLateBoundObject); curObj = PrivateLateBoundObject; } - + // Different overloads of GetInstances() help in enumerating instances of the WMI class. public static ComputerSystemCollection GetInstances() { return GetInstances(null, null, null); } - + public static ComputerSystemCollection GetInstances(string condition) { return GetInstances(null, condition, null); } - + public static ComputerSystemCollection GetInstances(string[] selectedProperties) { return GetInstances(null, null, selectedProperties); } - + public static ComputerSystemCollection GetInstances(string condition, string[] selectedProperties) { return GetInstances(null, condition, selectedProperties); } - + public static ComputerSystemCollection GetInstances(System.Management.ManagementScope mgmtScope, System.Management.EnumerationOptions enumOptions) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -1410,15 +1410,15 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } return new ComputerSystemCollection(clsObject.GetInstances(enumOptions)); } - + public static ComputerSystemCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition) { return GetInstances(mgmtScope, condition, null); } - + public static ComputerSystemCollection GetInstances(System.Management.ManagementScope mgmtScope, string[] selectedProperties) { return GetInstances(mgmtScope, null, selectedProperties); } - + public static ComputerSystemCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition, string[] selectedProperties) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -1435,7 +1435,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { ObjectSearcher.Options = enumOptions; return new ComputerSystemCollection(ObjectSearcher.Get()); } - + [Browsable(true)] public static ComputerSystem CreateInstance() { System.Management.ManagementScope mgmtScope = null; @@ -1450,12 +1450,12 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { System.Management.ManagementClass tmpMgmtClass = new System.Management.ManagementClass(mgmtScope, mgmtPath, null); return new ComputerSystem(tmpMgmtClass.CreateInstance()); } - + [Browsable(true)] public void Delete() { PrivateLateBoundObject.Delete(); } - + public uint RequestReplicationStateChange(ushort RequestedState, System.DateTime TimeoutPeriod, out System.Management.ManagementPath Job) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1474,7 +1474,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint RequestStateChange(ushort RequestedState, System.DateTime TimeoutPeriod, out System.Management.ManagementPath Job) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1494,7 +1494,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint SetPowerState(uint PowerState, System.DateTime Time) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1508,115 +1508,115 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public enum FailedOverReplicationTypeValues { - + None = 0, - + Regular = 1, - + Application_consistent = 2, - + Planned = 3, - + NULL_ENUM_VALUE = 4, } - + public enum LastReplicationTypeValues { - + None = 0, - + Regular = 1, - + Application_consistent = 2, - + Planned = 3, - + NULL_ENUM_VALUE = 4, } - + public enum ReplicationHealthValues { - + Not_applicable = 0, - + Ok = 1, - + Warning = 2, - + Critical = 3, - + NULL_ENUM_VALUE = 4, } - + public enum ReplicationModeValues { - + None = 0, - + Primary = 1, - + Recovery = 2, - + Test_Replica = 3, - + NULL_ENUM_VALUE = 4, } - + public enum ReplicationStateValues { - + Disabled = 0, - + Ready_for_replication = 1, - + Waiting_to_complete_initial_replication = 2, - + Replicating = 3, - + Synced_replication_complete = 4, - + Recovered = 5, - + Committed = 6, - + Suspended = 7, - + Critical = 8, - + Waiting_to_start_resynchronization = 9, - + Resynchronizing = 10, - + Resynchronization_suspended = 11, - + NULL_ENUM_VALUE = 12, } - + // Enumerator implementation for enumerating instances of the class. public class ComputerSystemCollection : object, ICollection { - + private ManagementObjectCollection privColObj; - + public ComputerSystemCollection(ManagementObjectCollection objCollection) { privColObj = objCollection; } - + public virtual int Count { get { return privColObj.Count; } } - + public virtual bool IsSynchronized { get { return privColObj.IsSynchronized; } } - + public virtual object SyncRoot { get { return this; } } - + public virtual void CopyTo(System.Array array, int index) { privColObj.CopyTo(array, index); int nCtr; @@ -1624,189 +1624,189 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { array.SetValue(new ComputerSystem(((System.Management.ManagementObject)(array.GetValue(nCtr)))), nCtr); } } - + public virtual System.Collections.IEnumerator GetEnumerator() { return new ComputerSystemEnumerator(privColObj.GetEnumerator()); } - + public class ComputerSystemEnumerator : object, System.Collections.IEnumerator { - + private ManagementObjectCollection.ManagementObjectEnumerator privObjEnum; - + public ComputerSystemEnumerator(ManagementObjectCollection.ManagementObjectEnumerator objEnum) { privObjEnum = objEnum; } - + public virtual object Current { get { return new ComputerSystem(((System.Management.ManagementObject)(privObjEnum.Current))); } } - + public virtual bool MoveNext() { return privObjEnum.MoveNext(); } - + public virtual void Reset() { privObjEnum.Reset(); } } } - + // TypeConverter to handle null values for ValueType properties public class WMIValueTypeConverter : TypeConverter { - + private TypeConverter baseConverter; - + private System.Type baseType; - + public WMIValueTypeConverter(System.Type inBaseType) { baseConverter = TypeDescriptor.GetConverter(inBaseType); baseType = inBaseType; } - + 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 ((baseType.BaseType == typeof(System.Enum))) { if ((value.GetType() == destinationType)) { return value; } - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return "NULL_ENUM_VALUE" ; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((baseType == typeof(bool)) + if (((baseType == typeof(bool)) && (baseType.BaseType == typeof(System.ValueType)))) { - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((context != null) + if (((context != null) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } } - + // Embedded class to represent WMI system Properties. [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 { diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_ConcreteJob.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_ConcreteJob.cs index 823e41482bc..931d7a648eb 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_ConcreteJob.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_ConcreteJob.cs @@ -23,8 +23,8 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { using System.Globalization; using System.ComponentModel.Design.Serialization; using System.Reflection; - - + + // Functions ShouldSerialize are functions used by VS property browser to check if a particular property has to be serialized. These functions are added for all ValueType properties ( properties of type Int32, BOOL etc.. which cannot be set to null). These functions use IsNull function. These functions are also used in the TypeConverter implementation for the properties to check for NULL value of property so that an empty value can be shown in Property browser in case of Drag and Drop in Visual studio. // Functions IsNull() are used to check if a property is NULL. // Functions Reset are added for Nullable Read/Write properties. These functions are used by VS designer in property browser to set a property to NULL. @@ -33,62 +33,62 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { // Datetime conversion functions ToDateTime and ToDmtfDateTime are added to the class to convert DMTF datetime to System.DateTime and vice-versa. // An Early Bound class generated for the WMI class.Msvm_ConcreteJob public class ConcreteJob : System.ComponentModel.Component { - + // Private property to hold the WMI namespace in which the class resides. private static string CreatedWmiNamespace = "ROOT\\virtualization\\v2"; - + // Private property to hold the name of WMI class which created this class. private static string CreatedClassName = "Msvm_ConcreteJob"; - + // Private member variable to hold the ManagementScope which is used by the various methods. private static System.Management.ManagementScope statMgmtScope = null; - + private ManagementSystemProperties PrivateSystemProperties; - + // Underlying lateBound WMI object. private System.Management.ManagementObject PrivateLateBoundObject; - + // Member variable to store the 'automatic commit' behavior for the class. private bool AutoCommitProp; - + // Private variable to hold the embedded property representing the instance. private System.Management.ManagementBaseObject embeddedObj; - + // The current WMI object used private System.Management.ManagementBaseObject curObj; - + // Flag to indicate if the instance is an embedded object. private bool isEmbedded; - + // Below are different overloads of constructors to initialize an instance of the class with a WMI object. public ConcreteJob() { this.InitializeObject(null, null, null); } - + public ConcreteJob(string keyInstanceID) { this.InitializeObject(null, new System.Management.ManagementPath(ConcreteJob.ConstructPath(keyInstanceID)), null); } - + public ConcreteJob(System.Management.ManagementScope mgmtScope, string keyInstanceID) { this.InitializeObject(((System.Management.ManagementScope)(mgmtScope)), new System.Management.ManagementPath(ConcreteJob.ConstructPath(keyInstanceID)), null); } - + public ConcreteJob(System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(null, path, getOptions); } - + public ConcreteJob(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path) { this.InitializeObject(mgmtScope, path, null); } - + public ConcreteJob(System.Management.ManagementPath path) { this.InitializeObject(null, path, null); } - + public ConcreteJob(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(mgmtScope, path, getOptions); } - + public ConcreteJob(System.Management.ManagementObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -100,7 +100,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { throw new System.ArgumentException("Class name does not match."); } } - + public ConcreteJob(System.Management.ManagementBaseObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -113,7 +113,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { throw new System.ArgumentException("Class name does not match."); } } - + // Property returns the namespace of the WMI class. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -122,7 +122,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return "ROOT\\virtualization\\v2"; } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ManagementClassName { @@ -131,7 +131,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { if ((curObj != null)) { if ((curObj.ClassPath != null)) { strRet = ((string)(curObj["__CLASS"])); - if (((strRet == null) + if (((strRet == null) || (strRet == string.Empty))) { strRet = CreatedClassName; } @@ -140,7 +140,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return strRet; } } - + // Property pointing to an embedded object to get System properties of the WMI object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -149,7 +149,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return PrivateSystemProperties; } } - + // Property returning the underlying lateBound object. [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -158,7 +158,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return curObj; } } - + // ManagementScope of the object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -177,7 +177,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + // Property to show the commit behavior for the WMI object. If true, WMI object will be automatically saved after each property modification.(ie. Put() is called after modification of a property). [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -189,7 +189,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { AutoCommitProp = value; } } - + // The ManagementPath of the underlying WMI object. [Browsable(true)] public System.Management.ManagementPath Path { @@ -210,7 +210,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + // Public static scope property which is used by the various methods. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -222,7 +222,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { statMgmtScope = value; } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsCancellableNull { @@ -235,7 +235,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("Indicates whether the job can be cancelled. The value of this property does not g" + @@ -249,7 +249,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((bool)(curObj["Cancellable"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Caption { @@ -257,7 +257,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Caption"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsCommunicationStatusNull { @@ -270,7 +270,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -282,7 +282,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["CommunicationStatus"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsDeleteOnCompletionNull { @@ -295,7 +295,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -307,7 +307,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((bool)(curObj["DeleteOnCompletion"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Description { @@ -315,7 +315,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Description"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsDetailedStatusNull { @@ -328,7 +328,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -340,7 +340,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["DetailedStatus"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsElapsedTimeNull { @@ -353,7 +353,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -367,7 +367,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ElementName { @@ -375,7 +375,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["ElementName"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsErrorCodeNull { @@ -388,7 +388,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -400,7 +400,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["ErrorCode"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ErrorDescription { @@ -408,7 +408,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["ErrorDescription"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ErrorSummaryDescription { @@ -416,7 +416,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["ErrorSummaryDescription"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsHealthStateNull { @@ -429,7 +429,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -441,7 +441,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["HealthState"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsInstallDateNull { @@ -454,7 +454,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -468,7 +468,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string InstanceID { @@ -476,7 +476,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["InstanceID"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsJobRunTimesNull { @@ -489,7 +489,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -501,7 +501,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((uint)(curObj["JobRunTimes"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsJobStateNull { @@ -514,7 +514,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -526,7 +526,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["JobState"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string JobStatus { @@ -534,7 +534,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["JobStatus"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsJobTypeNull { @@ -547,7 +547,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("Indicates the type of Job being tracked by this object.")] @@ -560,7 +560,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["JobType"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsLocalOrUtcTimeNull { @@ -573,7 +573,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -585,7 +585,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["LocalOrUtcTime"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Name { @@ -593,7 +593,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Name"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Notify { @@ -601,7 +601,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Notify"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsOperatingStatusNull { @@ -614,7 +614,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -626,7 +626,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["OperatingStatus"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public ushort[] OperationalStatus { @@ -634,7 +634,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort[])(curObj["OperationalStatus"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string OtherRecoveryAction { @@ -642,7 +642,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["OtherRecoveryAction"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Owner { @@ -650,7 +650,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Owner"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPercentCompleteNull { @@ -663,7 +663,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -675,7 +675,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["PercentComplete"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPrimaryStatusNull { @@ -688,7 +688,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -700,7 +700,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["PrimaryStatus"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPriorityNull { @@ -713,7 +713,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -725,7 +725,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((uint)(curObj["Priority"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsRecoveryActionNull { @@ -738,7 +738,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -750,7 +750,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["RecoveryAction"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsRunDayNull { @@ -763,7 +763,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -775,7 +775,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((sbyte)(curObj["RunDay"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsRunDayOfWeekNull { @@ -788,7 +788,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -800,7 +800,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((sbyte)(curObj["RunDayOfWeek"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsRunMonthNull { @@ -813,7 +813,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -825,7 +825,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((byte)(curObj["RunMonth"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsRunStartIntervalNull { @@ -838,7 +838,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -852,7 +852,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsScheduledStartTimeNull { @@ -865,7 +865,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -879,7 +879,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsStartTimeNull { @@ -892,7 +892,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -906,7 +906,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Status { @@ -914,7 +914,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Status"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string[] StatusDescriptions { @@ -922,7 +922,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string[])(curObj["StatusDescriptions"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsTimeBeforeRemovalNull { @@ -935,7 +935,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -949,7 +949,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsTimeOfLastStateChangeNull { @@ -962,7 +962,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -976,7 +976,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsTimeSubmittedNull { @@ -989,7 +989,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -1003,7 +1003,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsUntilTimeNull { @@ -1016,7 +1016,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -1030,9 +1030,9 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + private bool CheckIfProperClass(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions OptionsParam) { - if (((path != null) + if (((path != null) && (string.Compare(path.ClassName, this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -1040,9 +1040,9 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return CheckIfProperClass(new System.Management.ManagementObject(mgmtScope, path, OptionsParam)); } } - + private bool CheckIfProperClass(System.Management.ManagementBaseObject theObj) { - if (((theObj != null) + if (((theObj != null) && (string.Compare(((string)(theObj["__CLASS"])), this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -1059,21 +1059,21 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } return false; } - + private bool ShouldSerializeCancellable() { if ((this.IsCancellableNull == false)) { return true; } return false; } - + private bool ShouldSerializeCommunicationStatus() { if ((this.IsCommunicationStatusNull == false)) { return true; } return false; } - + // Converts a given time interval in DMTF format to System.TimeSpan object. static System.TimeSpan ToTimeSpan(string dmtfTimespan) { int days = 0; @@ -1114,7 +1114,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { timespan = timespan.Add(tsTemp); return timespan; } - + // Converts a given System.TimeSpan object to DMTF Time interval format. static string ToDmtfTimeInterval(System.TimeSpan timespan) { string dmtftimespan = ((int)(timespan.Days)).ToString().PadLeft(8, '0'); @@ -1131,8 +1131,8 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { dmtftimespan = string.Concat(dmtftimespan, ((int)(timespan.Seconds)).ToString().PadLeft(2, '0')); dmtftimespan = string.Concat(dmtftimespan, "."); System.TimeSpan tsTemp = new System.TimeSpan(timespan.Days, timespan.Hours, timespan.Minutes, timespan.Seconds, 0); - long microsec = ((long)((((timespan.Ticks - tsTemp.Ticks) - * 1000) + long microsec = ((long)((((timespan.Ticks - tsTemp.Ticks) + * 1000) / System.TimeSpan.TicksPerMillisecond))); string strMicroSec = ((long)(microsec)).ToString(); if ((strMicroSec.Length > 6)) { @@ -1142,21 +1142,21 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { dmtftimespan = string.Concat(dmtftimespan, ":000"); return dmtftimespan; } - + private bool ShouldSerializeDeleteOnCompletion() { if ((this.IsDeleteOnCompletionNull == false)) { return true; } return false; } - + private bool ShouldSerializeDetailedStatus() { if ((this.IsDetailedStatusNull == false)) { return true; } return false; } - + // Converts a given datetime in DMTF format to System.DateTime object. static System.DateTime ToDateTime(string dmtfDate) { System.DateTime initializer = System.DateTime.MinValue; @@ -1208,13 +1208,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { if (("******" != tempString)) { ticks = (long.Parse(tempString) * ((long)((System.TimeSpan.TicksPerMillisecond / 1000)))); } - if (((((((((year < 0) - || (month < 0)) - || (day < 0)) - || (hour < 0)) - || (minute < 0)) - || (minute < 0)) - || (second < 0)) + if (((((((((year < 0) + || (month < 0)) + || (day < 0)) + || (hour < 0)) + || (minute < 0)) + || (minute < 0)) + || (second < 0)) || (ticks < 0))) { throw new System.ArgumentOutOfRangeException(); } @@ -1242,7 +1242,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } return datetime; } - + // Converts a given System.DateTime object to DMTF datetime format. static string ToDmtfDateTime(System.DateTime date) { string utcString = string.Empty; @@ -1269,8 +1269,8 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { dmtfDateTime = string.Concat(dmtfDateTime, ((int)(date.Second)).ToString().PadLeft(2, '0')); dmtfDateTime = string.Concat(dmtfDateTime, "."); System.DateTime dtTemp = new System.DateTime(date.Year, date.Month, date.Day, date.Hour, date.Minute, date.Second, 0); - long microsec = ((long)((((date.Ticks - dtTemp.Ticks) - * 1000) + long microsec = ((long)((((date.Ticks - dtTemp.Ticks) + * 1000) / System.TimeSpan.TicksPerMillisecond))); string strMicrosec = ((long)(microsec)).ToString(); if ((strMicrosec.Length > 6)) { @@ -1280,193 +1280,193 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { dmtfDateTime = string.Concat(dmtfDateTime, utcString); return dmtfDateTime; } - + private bool ShouldSerializeElapsedTime() { if ((this.IsElapsedTimeNull == false)) { return true; } return false; } - + private bool ShouldSerializeErrorCode() { if ((this.IsErrorCodeNull == false)) { return true; } return false; } - + private bool ShouldSerializeHealthState() { if ((this.IsHealthStateNull == false)) { return true; } return false; } - + private bool ShouldSerializeInstallDate() { if ((this.IsInstallDateNull == false)) { return true; } return false; } - + private bool ShouldSerializeJobRunTimes() { if ((this.IsJobRunTimesNull == false)) { return true; } return false; } - + private bool ShouldSerializeJobState() { if ((this.IsJobStateNull == false)) { return true; } return false; } - + private bool ShouldSerializeJobType() { if ((this.IsJobTypeNull == false)) { return true; } return false; } - + private bool ShouldSerializeLocalOrUtcTime() { if ((this.IsLocalOrUtcTimeNull == false)) { return true; } return false; } - + private bool ShouldSerializeOperatingStatus() { if ((this.IsOperatingStatusNull == false)) { return true; } return false; } - + private bool ShouldSerializePercentComplete() { if ((this.IsPercentCompleteNull == false)) { return true; } return false; } - + private bool ShouldSerializePrimaryStatus() { if ((this.IsPrimaryStatusNull == false)) { return true; } return false; } - + private bool ShouldSerializePriority() { if ((this.IsPriorityNull == false)) { return true; } return false; } - + private bool ShouldSerializeRecoveryAction() { if ((this.IsRecoveryActionNull == false)) { return true; } return false; } - + private bool ShouldSerializeRunDay() { if ((this.IsRunDayNull == false)) { return true; } return false; } - + private bool ShouldSerializeRunDayOfWeek() { if ((this.IsRunDayOfWeekNull == false)) { return true; } return false; } - + private bool ShouldSerializeRunMonth() { if ((this.IsRunMonthNull == false)) { return true; } return false; } - + private bool ShouldSerializeRunStartInterval() { if ((this.IsRunStartIntervalNull == false)) { return true; } return false; } - + private bool ShouldSerializeScheduledStartTime() { if ((this.IsScheduledStartTimeNull == false)) { return true; } return false; } - + private bool ShouldSerializeStartTime() { if ((this.IsStartTimeNull == false)) { return true; } return false; } - + private bool ShouldSerializeTimeBeforeRemoval() { if ((this.IsTimeBeforeRemovalNull == false)) { return true; } return false; } - + private bool ShouldSerializeTimeOfLastStateChange() { if ((this.IsTimeOfLastStateChangeNull == false)) { return true; } return false; } - + private bool ShouldSerializeTimeSubmitted() { if ((this.IsTimeSubmittedNull == false)) { return true; } return false; } - + private bool ShouldSerializeUntilTime() { if ((this.IsUntilTimeNull == false)) { return true; } return false; } - + [Browsable(true)] public void CommitObject() { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(); } } - + [Browsable(true)] public void CommitObject(System.Management.PutOptions putOptions) { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(putOptions); } } - + private void Initialize() { AutoCommitProp = true; isEmbedded = false; } - + private static string ConstructPath(string keyInstanceID) { string strPath = "ROOT\\virtualization\\v2:Msvm_ConcreteJob"; strPath = string.Concat(strPath, string.Concat(".InstanceID=", string.Concat("\"", string.Concat(keyInstanceID, "\"")))); return strPath; } - + private void InitializeObject(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { Initialize(); if ((path != null)) { @@ -1478,24 +1478,24 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { PrivateSystemProperties = new ManagementSystemProperties(PrivateLateBoundObject); curObj = PrivateLateBoundObject; } - + // Different overloads of GetInstances() help in enumerating instances of the WMI class. public static ConcreteJobCollection GetInstances() { return GetInstances(null, null, null); } - + public static ConcreteJobCollection GetInstances(string condition) { return GetInstances(null, condition, null); } - + public static ConcreteJobCollection GetInstances(string[] selectedProperties) { return GetInstances(null, null, selectedProperties); } - + public static ConcreteJobCollection GetInstances(string condition, string[] selectedProperties) { return GetInstances(null, condition, selectedProperties); } - + public static ConcreteJobCollection GetInstances(System.Management.ManagementScope mgmtScope, System.Management.EnumerationOptions enumOptions) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -1516,15 +1516,15 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } return new ConcreteJobCollection(clsObject.GetInstances(enumOptions)); } - + public static ConcreteJobCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition) { return GetInstances(mgmtScope, condition, null); } - + public static ConcreteJobCollection GetInstances(System.Management.ManagementScope mgmtScope, string[] selectedProperties) { return GetInstances(mgmtScope, null, selectedProperties); } - + public static ConcreteJobCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition, string[] selectedProperties) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -1541,7 +1541,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { ObjectSearcher.Options = enumOptions; return new ConcreteJobCollection(ObjectSearcher.Get()); } - + [Browsable(true)] public static ConcreteJob CreateInstance() { System.Management.ManagementScope mgmtScope = null; @@ -1556,12 +1556,12 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { System.Management.ManagementClass tmpMgmtClass = new System.Management.ManagementClass(mgmtScope, mgmtPath, null); return new ConcreteJob(tmpMgmtClass.CreateInstance()); } - + [Browsable(true)] public void Delete() { PrivateLateBoundObject.Delete(); } - + public uint GetError(out string Error) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1574,7 +1574,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint GetErrorEx(out string[] Errors) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1587,7 +1587,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint KillJob(bool DeleteOnKill) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1600,7 +1600,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint RequestStateChange(ushort RequestedState, System.TimeSpan TimeoutPeriod) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1614,34 +1614,34 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + // Enumerator implementation for enumerating instances of the class. public class ConcreteJobCollection : object, ICollection { - + private ManagementObjectCollection privColObj; - + public ConcreteJobCollection(ManagementObjectCollection objCollection) { privColObj = objCollection; } - + public virtual int Count { get { return privColObj.Count; } } - + public virtual bool IsSynchronized { get { return privColObj.IsSynchronized; } } - + public virtual object SyncRoot { get { return this; } } - + public virtual void CopyTo(System.Array array, int index) { privColObj.CopyTo(array, index); int nCtr; @@ -1649,189 +1649,189 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { array.SetValue(new ConcreteJob(((System.Management.ManagementObject)(array.GetValue(nCtr)))), nCtr); } } - + public virtual System.Collections.IEnumerator GetEnumerator() { return new ConcreteJobEnumerator(privColObj.GetEnumerator()); } - + public class ConcreteJobEnumerator : object, System.Collections.IEnumerator { - + private ManagementObjectCollection.ManagementObjectEnumerator privObjEnum; - + public ConcreteJobEnumerator(ManagementObjectCollection.ManagementObjectEnumerator objEnum) { privObjEnum = objEnum; } - + public virtual object Current { get { return new ConcreteJob(((System.Management.ManagementObject)(privObjEnum.Current))); } } - + public virtual bool MoveNext() { return privObjEnum.MoveNext(); } - + public virtual void Reset() { privObjEnum.Reset(); } } } - + // TypeConverter to handle null values for ValueType properties public class WMIValueTypeConverter : TypeConverter { - + private TypeConverter baseConverter; - + private System.Type baseType; - + public WMIValueTypeConverter(System.Type inBaseType) { baseConverter = TypeDescriptor.GetConverter(inBaseType); baseType = inBaseType; } - + 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 ((baseType.BaseType == typeof(System.Enum))) { if ((value.GetType() == destinationType)) { return value; } - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return "NULL_ENUM_VALUE" ; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((baseType == typeof(bool)) + if (((baseType == typeof(bool)) && (baseType.BaseType == typeof(System.ValueType)))) { - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((context != null) + if (((context != null) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } } - + // Embedded class to represent WMI system Properties. [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 { diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_EthernetPortAllocationSettingData.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_EthernetPortAllocationSettingData.cs index f281def4b10..680a57f53c3 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_EthernetPortAllocationSettingData.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_EthernetPortAllocationSettingData.cs @@ -23,70 +23,70 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { using System.Globalization; using System.ComponentModel.Design.Serialization; using System.Reflection; - - + + // Functions ShouldSerialize are functions used by VS property browser to check if a particular property has to be serialized. These functions are added for all ValueType properties ( properties of type Int32, BOOL etc.. which cannot be set to null). These functions use IsNull function. These functions are also used in the TypeConverter implementation for the properties to check for NULL value of property so that an empty value can be shown in Property browser in case of Drag and Drop in Visual studio. // Functions IsNull() are used to check if a property is NULL. // Functions Reset are added for Nullable Read/Write properties. These functions are used by VS designer in property browser to set a property to NULL. // Every property added to the class for WMI property has attributes set to define its behavior in Visual Studio designer and also to define a TypeConverter to be used. // An Early Bound class generated for the WMI class.Msvm_EthernetPortAllocationSettingData public class EthernetPortAllocationSettingData : System.ComponentModel.Component { - + // Private property to hold the WMI namespace in which the class resides. private static string CreatedWmiNamespace = "ROOT\\virtualization\\v2"; - + // Private property to hold the name of WMI class which created this class. public static string CreatedClassName = "Msvm_EthernetPortAllocationSettingData"; - + // Private member variable to hold the ManagementScope which is used by the various methods. private static System.Management.ManagementScope statMgmtScope = null; - + private ManagementSystemProperties PrivateSystemProperties; - + // Underlying lateBound WMI object. private System.Management.ManagementObject PrivateLateBoundObject; - + // Member variable to store the 'automatic commit' behavior for the class. private bool AutoCommitProp; - + // Private variable to hold the embedded property representing the instance. private System.Management.ManagementBaseObject embeddedObj; - + // The current WMI object used private System.Management.ManagementBaseObject curObj; - + // Flag to indicate if the instance is an embedded object. private bool isEmbedded; - + // Below are different overloads of constructors to initialize an instance of the class with a WMI object. public EthernetPortAllocationSettingData() { this.InitializeObject(null, null, null); } - + public EthernetPortAllocationSettingData(string keyInstanceID) { this.InitializeObject(null, new System.Management.ManagementPath(EthernetPortAllocationSettingData.ConstructPath(keyInstanceID)), null); } - + public EthernetPortAllocationSettingData(System.Management.ManagementScope mgmtScope, string keyInstanceID) { this.InitializeObject(((System.Management.ManagementScope)(mgmtScope)), new System.Management.ManagementPath(EthernetPortAllocationSettingData.ConstructPath(keyInstanceID)), null); } - + public EthernetPortAllocationSettingData(System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(null, path, getOptions); } - + public EthernetPortAllocationSettingData(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path) { this.InitializeObject(mgmtScope, path, null); } - + public EthernetPortAllocationSettingData(System.Management.ManagementPath path) { this.InitializeObject(null, path, null); } - + public EthernetPortAllocationSettingData(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(mgmtScope, path, getOptions); } - + public EthernetPortAllocationSettingData(System.Management.ManagementObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -98,7 +98,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { throw new System.ArgumentException("Class name does not match."); } } - + public EthernetPortAllocationSettingData(System.Management.ManagementBaseObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -111,7 +111,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { throw new System.ArgumentException("Class name does not match."); } } - + // Property returns the namespace of the WMI class. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -120,7 +120,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return "ROOT\\virtualization\\v2"; } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ManagementClassName { @@ -129,7 +129,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { if ((curObj != null)) { if ((curObj.ClassPath != null)) { strRet = ((string)(curObj["__CLASS"])); - if (((strRet == null) + if (((strRet == null) || (strRet == string.Empty))) { strRet = CreatedClassName; } @@ -138,7 +138,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return strRet; } } - + // Property pointing to an embedded object to get System properties of the WMI object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -147,7 +147,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return PrivateSystemProperties; } } - + // Property returning the underlying lateBound object. [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -156,7 +156,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return curObj; } } - + // ManagementScope of the object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -175,7 +175,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + // Property to show the commit behavior for the WMI object. If true, WMI object will be automatically saved after each property modification.(ie. Put() is called after modification of a property). [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -187,7 +187,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { AutoCommitProp = value; } } - + // The ManagementPath of the underlying WMI object. [Browsable(true)] public System.Management.ManagementPath Path { @@ -208,7 +208,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + // Public static scope property which is used by the various methods. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -220,7 +220,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { statMgmtScope = value; } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Address { @@ -228,7 +228,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Address"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string AddressOnParent { @@ -236,7 +236,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["AddressOnParent"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string AllocationUnits { @@ -244,7 +244,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["AllocationUnits"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsAutomaticAllocationNull { @@ -257,7 +257,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -269,7 +269,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((bool)(curObj["AutomaticAllocation"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsAutomaticDeallocationNull { @@ -282,7 +282,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -294,7 +294,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((bool)(curObj["AutomaticDeallocation"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Caption { @@ -302,7 +302,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Caption"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string[] Connection { @@ -310,7 +310,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string[])(curObj["Connection"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsConsumerVisibilityNull { @@ -323,7 +323,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -335,7 +335,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["ConsumerVisibility"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Description { @@ -343,7 +343,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Description"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsDesiredVLANEndpointModeNull { @@ -356,7 +356,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -368,7 +368,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["DesiredVLANEndpointMode"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ElementName { @@ -376,7 +376,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["ElementName"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsEnabledStateNull { @@ -389,7 +389,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"EnabledState is an integer enumeration that indicates whether the allocation request is enabled or disabled. When an allocation request is marked as Disabled (3), then the allocation is not processed. The EnabledState for an active configuration is always marked as Enabled (2).")] @@ -402,7 +402,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((EnabledStateValues)(System.Convert.ToInt32(curObj["EnabledState"]))); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string[] HostResource { @@ -410,7 +410,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string[])(curObj["HostResource"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string InstanceID { @@ -418,7 +418,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["InstanceID"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsLimitNull { @@ -431,7 +431,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -443,7 +443,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ulong)(curObj["Limit"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsMappingBehaviorNull { @@ -456,7 +456,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -468,7 +468,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["MappingBehavior"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string OtherEndpointMode { @@ -476,7 +476,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["OtherEndpointMode"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string OtherResourceType { @@ -484,7 +484,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["OtherResourceType"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Parent { @@ -492,7 +492,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Parent"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string PoolID { @@ -500,7 +500,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["PoolID"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The list of friendly names corresponding to each entry in the RequiredFeatures.")] @@ -509,7 +509,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string[])(curObj["RequiredFeatureHints"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The list of feature identifers representing all the features that are required fo" + @@ -520,13 +520,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } set { curObj["RequiredFeatures"] = value; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsReservationNull { @@ -539,7 +539,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -551,7 +551,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ulong)(curObj["Reservation"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ResourceSubType { @@ -559,7 +559,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["ResourceSubType"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsResourceTypeNull { @@ -572,7 +572,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -584,7 +584,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["ResourceType"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("This property specifies the network resource pool from which a connection will be" + @@ -595,13 +595,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } set { curObj["TestReplicaPoolID"] = value; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("This property specifies the friendly name of the virtual network switch to which " + @@ -612,13 +612,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } set { curObj["TestReplicaSwitchName"] = value; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsVirtualQuantityNull { @@ -631,7 +631,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -643,7 +643,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ulong)(curObj["VirtualQuantity"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string VirtualQuantityUnits { @@ -651,7 +651,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["VirtualQuantityUnits"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsWeightNull { @@ -664,7 +664,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -676,9 +676,9 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((uint)(curObj["Weight"])); } } - + private bool CheckIfProperClass(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions OptionsParam) { - if (((path != null) + if (((path != null) && (string.Compare(path.ClassName, this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -686,9 +686,9 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return CheckIfProperClass(new System.Management.ManagementObject(mgmtScope, path, OptionsParam)); } } - + private bool CheckIfProperClass(System.Management.ManagementBaseObject theObj) { - if (((theObj != null) + if (((theObj != null) && (string.Compare(((string)(theObj["__CLASS"])), this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -705,133 +705,133 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } return false; } - + private bool ShouldSerializeAutomaticAllocation() { if ((this.IsAutomaticAllocationNull == false)) { return true; } return false; } - + private bool ShouldSerializeAutomaticDeallocation() { if ((this.IsAutomaticDeallocationNull == false)) { return true; } return false; } - + private bool ShouldSerializeConsumerVisibility() { if ((this.IsConsumerVisibilityNull == false)) { return true; } return false; } - + private bool ShouldSerializeDesiredVLANEndpointMode() { if ((this.IsDesiredVLANEndpointModeNull == false)) { return true; } return false; } - + private bool ShouldSerializeEnabledState() { if ((this.IsEnabledStateNull == false)) { return true; } return false; } - + private bool ShouldSerializeLimit() { if ((this.IsLimitNull == false)) { return true; } return false; } - + private bool ShouldSerializeMappingBehavior() { if ((this.IsMappingBehaviorNull == false)) { return true; } return false; } - + private void ResetRequiredFeatures() { curObj["RequiredFeatures"] = null; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } - + private bool ShouldSerializeReservation() { if ((this.IsReservationNull == false)) { return true; } return false; } - + private bool ShouldSerializeResourceType() { if ((this.IsResourceTypeNull == false)) { return true; } return false; } - + private void ResetTestReplicaPoolID() { curObj["TestReplicaPoolID"] = null; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } - + private void ResetTestReplicaSwitchName() { curObj["TestReplicaSwitchName"] = null; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } - + private bool ShouldSerializeVirtualQuantity() { if ((this.IsVirtualQuantityNull == false)) { return true; } return false; } - + private bool ShouldSerializeWeight() { if ((this.IsWeightNull == false)) { return true; } return false; } - + [Browsable(true)] public void CommitObject() { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(); } } - + [Browsable(true)] public void CommitObject(System.Management.PutOptions putOptions) { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(putOptions); } } - + private void Initialize() { AutoCommitProp = true; isEmbedded = false; } - + private static string ConstructPath(string keyInstanceID) { string strPath = "ROOT\\virtualization\\v2:Msvm_EthernetPortAllocationSettingData"; strPath = string.Concat(strPath, string.Concat(".InstanceID=", string.Concat("\"", string.Concat(keyInstanceID, "\"")))); return strPath; } - + private void InitializeObject(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { Initialize(); if ((path != null)) { @@ -843,24 +843,24 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { PrivateSystemProperties = new ManagementSystemProperties(PrivateLateBoundObject); curObj = PrivateLateBoundObject; } - + // Different overloads of GetInstances() help in enumerating instances of the WMI class. public static EthernetPortAllocationSettingDataCollection GetInstances() { return GetInstances(null, null, null); } - + public static EthernetPortAllocationSettingDataCollection GetInstances(string condition) { return GetInstances(null, condition, null); } - + public static EthernetPortAllocationSettingDataCollection GetInstances(string[] selectedProperties) { return GetInstances(null, null, selectedProperties); } - + public static EthernetPortAllocationSettingDataCollection GetInstances(string condition, string[] selectedProperties) { return GetInstances(null, condition, selectedProperties); } - + public static EthernetPortAllocationSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, System.Management.EnumerationOptions enumOptions) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -881,15 +881,15 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } return new EthernetPortAllocationSettingDataCollection(clsObject.GetInstances(enumOptions)); } - + public static EthernetPortAllocationSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition) { return GetInstances(mgmtScope, condition, null); } - + public static EthernetPortAllocationSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string[] selectedProperties) { return GetInstances(mgmtScope, null, selectedProperties); } - + public static EthernetPortAllocationSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition, string[] selectedProperties) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -906,7 +906,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { ObjectSearcher.Options = enumOptions; return new EthernetPortAllocationSettingDataCollection(ObjectSearcher.Get()); } - + [Browsable(true)] public static EthernetPortAllocationSettingData CreateInstance() { System.Management.ManagementScope mgmtScope = null; @@ -921,48 +921,48 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { System.Management.ManagementClass tmpMgmtClass = new System.Management.ManagementClass(mgmtScope, mgmtPath, null); return new EthernetPortAllocationSettingData(tmpMgmtClass.CreateInstance()); } - + [Browsable(true)] public void Delete() { PrivateLateBoundObject.Delete(); } - + public enum EnabledStateValues { - + Enabled = 2, - + Disabled = 3, - + NULL_ENUM_VALUE = 0, } - + // Enumerator implementation for enumerating instances of the class. public class EthernetPortAllocationSettingDataCollection : object, ICollection { - + private ManagementObjectCollection privColObj; - + public EthernetPortAllocationSettingDataCollection(ManagementObjectCollection objCollection) { privColObj = objCollection; } - + public virtual int Count { get { return privColObj.Count; } } - + public virtual bool IsSynchronized { get { return privColObj.IsSynchronized; } } - + public virtual object SyncRoot { get { return this; } } - + public virtual void CopyTo(System.Array array, int index) { privColObj.CopyTo(array, index); int nCtr; @@ -970,189 +970,189 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { array.SetValue(new EthernetPortAllocationSettingData(((System.Management.ManagementObject)(array.GetValue(nCtr)))), nCtr); } } - + public virtual System.Collections.IEnumerator GetEnumerator() { return new EthernetPortAllocationSettingDataEnumerator(privColObj.GetEnumerator()); } - + public class EthernetPortAllocationSettingDataEnumerator : object, System.Collections.IEnumerator { - + private ManagementObjectCollection.ManagementObjectEnumerator privObjEnum; - + public EthernetPortAllocationSettingDataEnumerator(ManagementObjectCollection.ManagementObjectEnumerator objEnum) { privObjEnum = objEnum; } - + public virtual object Current { get { return new EthernetPortAllocationSettingData(((System.Management.ManagementObject)(privObjEnum.Current))); } } - + public virtual bool MoveNext() { return privObjEnum.MoveNext(); } - + public virtual void Reset() { privObjEnum.Reset(); } } } - + // TypeConverter to handle null values for ValueType properties public class WMIValueTypeConverter : TypeConverter { - + private TypeConverter baseConverter; - + private System.Type baseType; - + public WMIValueTypeConverter(System.Type inBaseType) { baseConverter = TypeDescriptor.GetConverter(inBaseType); baseType = inBaseType; } - + 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 ((baseType.BaseType == typeof(System.Enum))) { if ((value.GetType() == destinationType)) { return value; } - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return "NULL_ENUM_VALUE" ; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((baseType == typeof(bool)) + if (((baseType == typeof(bool)) && (baseType.BaseType == typeof(System.ValueType)))) { - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((context != null) + if (((context != null) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } } - + // Embedded class to represent WMI system Properties. [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 { diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_EthernetSwitchPort.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_EthernetSwitchPort.cs index 5bc97f864bb..b33b3a5890a 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_EthernetSwitchPort.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_EthernetSwitchPort.cs @@ -23,8 +23,8 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { using System.Globalization; using System.ComponentModel.Design.Serialization; using System.Reflection; - - + + // Functions ShouldSerialize are functions used by VS property browser to check if a particular property has to be serialized. These functions are added for all ValueType properties ( properties of type Int32, BOOL etc.. which cannot be set to null). These functions use IsNull function. These functions are also used in the TypeConverter implementation for the properties to check for NULL value of property so that an empty value can be shown in Property browser in case of Drag and Drop in Visual studio. // Functions IsNull() are used to check if a property is NULL. // Functions Reset are added for Nullable Read/Write properties. These functions are used by VS designer in property browser to set a property to NULL. @@ -32,62 +32,62 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { // Datetime conversion functions ToDateTime and ToDmtfDateTime are added to the class to convert DMTF datetime to System.DateTime and vice-versa. // An Early Bound class generated for the WMI class.Msvm_EthernetSwitchPort public class EthernetSwitchPort : System.ComponentModel.Component { - + // Private property to hold the WMI namespace in which the class resides. private static string CreatedWmiNamespace = "ROOT\\virtualization\\v2"; - + // Private property to hold the name of WMI class which created this class. public static string CreatedClassName = "Msvm_EthernetSwitchPort"; - + // Private member variable to hold the ManagementScope which is used by the various methods. private static System.Management.ManagementScope statMgmtScope = null; - + private ManagementSystemProperties PrivateSystemProperties; - + // Underlying lateBound WMI object. private System.Management.ManagementObject PrivateLateBoundObject; - + // Member variable to store the 'automatic commit' behavior for the class. private bool AutoCommitProp; - + // Private variable to hold the embedded property representing the instance. private System.Management.ManagementBaseObject embeddedObj; - + // The current WMI object used private System.Management.ManagementBaseObject curObj; - + // Flag to indicate if the instance is an embedded object. private bool isEmbedded; - + // Below are different overloads of constructors to initialize an instance of the class with a WMI object. public EthernetSwitchPort() { this.InitializeObject(null, null, null); } - + public EthernetSwitchPort(string keyCreationClassName, string keyDeviceID, string keySystemCreationClassName, string keySystemName) { this.InitializeObject(null, new System.Management.ManagementPath(EthernetSwitchPort.ConstructPath(keyCreationClassName, keyDeviceID, keySystemCreationClassName, keySystemName)), null); } - + public EthernetSwitchPort(System.Management.ManagementScope mgmtScope, string keyCreationClassName, string keyDeviceID, string keySystemCreationClassName, string keySystemName) { this.InitializeObject(((System.Management.ManagementScope)(mgmtScope)), new System.Management.ManagementPath(EthernetSwitchPort.ConstructPath(keyCreationClassName, keyDeviceID, keySystemCreationClassName, keySystemName)), null); } - + public EthernetSwitchPort(System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(null, path, getOptions); } - + public EthernetSwitchPort(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path) { this.InitializeObject(mgmtScope, path, null); } - + public EthernetSwitchPort(System.Management.ManagementPath path) { this.InitializeObject(null, path, null); } - + public EthernetSwitchPort(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(mgmtScope, path, getOptions); } - + public EthernetSwitchPort(System.Management.ManagementObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -99,7 +99,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { throw new System.ArgumentException("Class name does not match."); } } - + public EthernetSwitchPort(System.Management.ManagementBaseObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -112,7 +112,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { throw new System.ArgumentException("Class name does not match."); } } - + // Property returns the namespace of the WMI class. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -121,7 +121,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return "ROOT\\virtualization\\v2"; } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ManagementClassName { @@ -130,7 +130,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { if ((curObj != null)) { if ((curObj.ClassPath != null)) { strRet = ((string)(curObj["__CLASS"])); - if (((strRet == null) + if (((strRet == null) || (strRet == string.Empty))) { strRet = CreatedClassName; } @@ -139,7 +139,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return strRet; } } - + // Property pointing to an embedded object to get System properties of the WMI object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -148,7 +148,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return PrivateSystemProperties; } } - + // Property returning the underlying lateBound object. [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -157,7 +157,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return curObj; } } - + // ManagementScope of the object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -176,7 +176,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + // Property to show the commit behavior for the WMI object. If true, WMI object will be automatically saved after each property modification.(ie. Put() is called after modification of a property). [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -188,7 +188,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { AutoCommitProp = value; } } - + // The ManagementPath of the underlying WMI object. [Browsable(true)] public System.Management.ManagementPath Path { @@ -209,7 +209,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + // Public static scope property which is used by the various methods. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -221,7 +221,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { statMgmtScope = value; } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsActiveMaximumTransmissionUnitNull { @@ -234,7 +234,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -246,7 +246,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ulong)(curObj["ActiveMaximumTransmissionUnit"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public ushort[] AdditionalAvailability { @@ -254,7 +254,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort[])(curObj["AdditionalAvailability"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsAutoSenseNull { @@ -267,7 +267,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -279,7 +279,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((bool)(curObj["AutoSense"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsAvailabilityNull { @@ -292,7 +292,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -304,7 +304,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["Availability"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public ushort[] AvailableRequestedStates { @@ -312,7 +312,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort[])(curObj["AvailableRequestedStates"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public ushort[] Capabilities { @@ -320,7 +320,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort[])(curObj["Capabilities"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string[] CapabilityDescriptions { @@ -328,7 +328,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string[])(curObj["CapabilityDescriptions"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Caption { @@ -336,7 +336,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Caption"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsCommunicationStatusNull { @@ -349,7 +349,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -361,7 +361,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["CommunicationStatus"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string CreationClassName { @@ -369,7 +369,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["CreationClassName"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Description { @@ -377,7 +377,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Description"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsDetailedStatusNull { @@ -390,7 +390,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -402,7 +402,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["DetailedStatus"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string DeviceID { @@ -410,7 +410,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["DeviceID"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ElementName { @@ -418,7 +418,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["ElementName"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public ushort[] EnabledCapabilities { @@ -426,7 +426,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort[])(curObj["EnabledCapabilities"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsEnabledDefaultNull { @@ -439,7 +439,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -451,7 +451,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["EnabledDefault"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsEnabledStateNull { @@ -464,7 +464,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -476,7 +476,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["EnabledState"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsErrorClearedNull { @@ -489,7 +489,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -501,7 +501,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((bool)(curObj["ErrorCleared"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ErrorDescription { @@ -509,7 +509,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["ErrorDescription"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsFullDuplexNull { @@ -522,7 +522,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -534,7 +534,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((bool)(curObj["FullDuplex"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsHealthStateNull { @@ -547,7 +547,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -559,7 +559,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["HealthState"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string[] IdentifyingDescriptions { @@ -567,7 +567,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string[])(curObj["IdentifyingDescriptions"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsInstallDateNull { @@ -580,7 +580,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -594,7 +594,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string InstanceID { @@ -602,7 +602,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["InstanceID"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsIOVOffloadUsageNull { @@ -615,7 +615,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The current I/O virtualization (IOV) offload usage on this port. The usage is the" + @@ -629,7 +629,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((uint)(curObj["IOVOffloadUsage"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsLastErrorCodeNull { @@ -642,7 +642,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -654,7 +654,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((uint)(curObj["LastErrorCode"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsLinkTechnologyNull { @@ -667,7 +667,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -679,7 +679,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["LinkTechnology"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsMaxDataSizeNull { @@ -692,7 +692,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -704,7 +704,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((uint)(curObj["MaxDataSize"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsMaxQuiesceTimeNull { @@ -717,7 +717,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -729,7 +729,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ulong)(curObj["MaxQuiesceTime"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsMaxSpeedNull { @@ -742,7 +742,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -754,7 +754,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ulong)(curObj["MaxSpeed"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Name { @@ -762,7 +762,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Name"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string[] NetworkAddresses { @@ -770,7 +770,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string[])(curObj["NetworkAddresses"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsOperatingStatusNull { @@ -783,7 +783,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -795,7 +795,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["OperatingStatus"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public ushort[] OperationalStatus { @@ -803,7 +803,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort[])(curObj["OperationalStatus"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string[] OtherEnabledCapabilities { @@ -811,7 +811,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string[])(curObj["OtherEnabledCapabilities"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string OtherEnabledState { @@ -819,7 +819,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["OtherEnabledState"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string[] OtherIdentifyingInfo { @@ -827,7 +827,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string[])(curObj["OtherIdentifyingInfo"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string OtherLinkTechnology { @@ -835,7 +835,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["OtherLinkTechnology"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string OtherNetworkPortType { @@ -843,7 +843,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["OtherNetworkPortType"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string OtherPortType { @@ -851,7 +851,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["OtherPortType"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string PermanentAddress { @@ -859,7 +859,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["PermanentAddress"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPortNumberNull { @@ -872,7 +872,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -884,7 +884,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["PortNumber"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPortTypeNull { @@ -897,7 +897,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -909,7 +909,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["PortType"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public ushort[] PowerManagementCapabilities { @@ -917,7 +917,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort[])(curObj["PowerManagementCapabilities"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPowerManagementSupportedNull { @@ -930,7 +930,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -942,7 +942,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((bool)(curObj["PowerManagementSupported"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPowerOnHoursNull { @@ -955,7 +955,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -967,7 +967,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ulong)(curObj["PowerOnHours"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPrimaryStatusNull { @@ -980,7 +980,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -992,7 +992,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["PrimaryStatus"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsRequestedSpeedNull { @@ -1005,7 +1005,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -1017,7 +1017,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ulong)(curObj["RequestedSpeed"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsRequestedStateNull { @@ -1030,7 +1030,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -1042,7 +1042,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["RequestedState"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsSpeedNull { @@ -1055,7 +1055,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -1067,7 +1067,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ulong)(curObj["Speed"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Status { @@ -1075,7 +1075,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Status"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string[] StatusDescriptions { @@ -1083,7 +1083,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string[])(curObj["StatusDescriptions"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsStatusInfoNull { @@ -1096,7 +1096,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -1108,7 +1108,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["StatusInfo"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsSupportedMaximumTransmissionUnitNull { @@ -1121,7 +1121,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -1133,7 +1133,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ulong)(curObj["SupportedMaximumTransmissionUnit"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string SystemCreationClassName { @@ -1141,7 +1141,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["SystemCreationClassName"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string SystemName { @@ -1149,7 +1149,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["SystemName"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsTimeOfLastStateChangeNull { @@ -1162,7 +1162,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -1176,7 +1176,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsTotalPowerOnHoursNull { @@ -1189,7 +1189,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -1201,7 +1201,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ulong)(curObj["TotalPowerOnHours"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsTransitioningToStateNull { @@ -1214,7 +1214,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -1226,7 +1226,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["TransitioningToState"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsUsageRestrictionNull { @@ -1239,7 +1239,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -1251,7 +1251,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["UsageRestriction"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsVMQOffloadUsageNull { @@ -1264,7 +1264,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The current VMQ offloading usage on this port. The usage is the amount of VMQ res" + @@ -1278,9 +1278,9 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((uint)(curObj["VMQOffloadUsage"])); } } - + private bool CheckIfProperClass(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions OptionsParam) { - if (((path != null) + if (((path != null) && (string.Compare(path.ClassName, this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -1288,9 +1288,9 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return CheckIfProperClass(new System.Management.ManagementObject(mgmtScope, path, OptionsParam)); } } - + private bool CheckIfProperClass(System.Management.ManagementBaseObject theObj) { - if (((theObj != null) + if (((theObj != null) && (string.Compare(((string)(theObj["__CLASS"])), this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -1307,77 +1307,77 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } return false; } - + private bool ShouldSerializeActiveMaximumTransmissionUnit() { if ((this.IsActiveMaximumTransmissionUnitNull == false)) { return true; } return false; } - + private bool ShouldSerializeAutoSense() { if ((this.IsAutoSenseNull == false)) { return true; } return false; } - + private bool ShouldSerializeAvailability() { if ((this.IsAvailabilityNull == false)) { return true; } return false; } - + private bool ShouldSerializeCommunicationStatus() { if ((this.IsCommunicationStatusNull == false)) { return true; } return false; } - + private bool ShouldSerializeDetailedStatus() { if ((this.IsDetailedStatusNull == false)) { return true; } return false; } - + private bool ShouldSerializeEnabledDefault() { if ((this.IsEnabledDefaultNull == false)) { return true; } return false; } - + private bool ShouldSerializeEnabledState() { if ((this.IsEnabledStateNull == false)) { return true; } return false; } - + private bool ShouldSerializeErrorCleared() { if ((this.IsErrorClearedNull == false)) { return true; } return false; } - + private bool ShouldSerializeFullDuplex() { if ((this.IsFullDuplexNull == false)) { return true; } return false; } - + private bool ShouldSerializeHealthState() { if ((this.IsHealthStateNull == false)) { return true; } return false; } - + // Converts a given datetime in DMTF format to System.DateTime object. static System.DateTime ToDateTime(string dmtfDate) { System.DateTime initializer = System.DateTime.MinValue; @@ -1429,13 +1429,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { if (("******" != tempString)) { ticks = (long.Parse(tempString) * ((long)((System.TimeSpan.TicksPerMillisecond / 1000)))); } - if (((((((((year < 0) - || (month < 0)) - || (day < 0)) - || (hour < 0)) - || (minute < 0)) - || (minute < 0)) - || (second < 0)) + if (((((((((year < 0) + || (month < 0)) + || (day < 0)) + || (hour < 0)) + || (minute < 0)) + || (minute < 0)) + || (second < 0)) || (ticks < 0))) { throw new System.ArgumentOutOfRangeException(); } @@ -1463,7 +1463,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } return datetime; } - + // Converts a given System.DateTime object to DMTF datetime format. static string ToDmtfDateTime(System.DateTime date) { string utcString = string.Empty; @@ -1490,8 +1490,8 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { dmtfDateTime = string.Concat(dmtfDateTime, ((int)(date.Second)).ToString().PadLeft(2, '0')); dmtfDateTime = string.Concat(dmtfDateTime, "."); System.DateTime dtTemp = new System.DateTime(date.Year, date.Month, date.Day, date.Hour, date.Minute, date.Second, 0); - long microsec = ((long)((((date.Ticks - dtTemp.Ticks) - * 1000) + long microsec = ((long)((((date.Ticks - dtTemp.Ticks) + * 1000) / System.TimeSpan.TicksPerMillisecond))); string strMicrosec = ((long)(microsec)).ToString(); if ((strMicrosec.Length > 6)) { @@ -1501,187 +1501,187 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { dmtfDateTime = string.Concat(dmtfDateTime, utcString); return dmtfDateTime; } - + private bool ShouldSerializeInstallDate() { if ((this.IsInstallDateNull == false)) { return true; } return false; } - + private bool ShouldSerializeIOVOffloadUsage() { if ((this.IsIOVOffloadUsageNull == false)) { return true; } return false; } - + private bool ShouldSerializeLastErrorCode() { if ((this.IsLastErrorCodeNull == false)) { return true; } return false; } - + private bool ShouldSerializeLinkTechnology() { if ((this.IsLinkTechnologyNull == false)) { return true; } return false; } - + private bool ShouldSerializeMaxDataSize() { if ((this.IsMaxDataSizeNull == false)) { return true; } return false; } - + private bool ShouldSerializeMaxQuiesceTime() { if ((this.IsMaxQuiesceTimeNull == false)) { return true; } return false; } - + private bool ShouldSerializeMaxSpeed() { if ((this.IsMaxSpeedNull == false)) { return true; } return false; } - + private bool ShouldSerializeOperatingStatus() { if ((this.IsOperatingStatusNull == false)) { return true; } return false; } - + private bool ShouldSerializePortNumber() { if ((this.IsPortNumberNull == false)) { return true; } return false; } - + private bool ShouldSerializePortType() { if ((this.IsPortTypeNull == false)) { return true; } return false; } - + private bool ShouldSerializePowerManagementSupported() { if ((this.IsPowerManagementSupportedNull == false)) { return true; } return false; } - + private bool ShouldSerializePowerOnHours() { if ((this.IsPowerOnHoursNull == false)) { return true; } return false; } - + private bool ShouldSerializePrimaryStatus() { if ((this.IsPrimaryStatusNull == false)) { return true; } return false; } - + private bool ShouldSerializeRequestedSpeed() { if ((this.IsRequestedSpeedNull == false)) { return true; } return false; } - + private bool ShouldSerializeRequestedState() { if ((this.IsRequestedStateNull == false)) { return true; } return false; } - + private bool ShouldSerializeSpeed() { if ((this.IsSpeedNull == false)) { return true; } return false; } - + private bool ShouldSerializeStatusInfo() { if ((this.IsStatusInfoNull == false)) { return true; } return false; } - + private bool ShouldSerializeSupportedMaximumTransmissionUnit() { if ((this.IsSupportedMaximumTransmissionUnitNull == false)) { return true; } return false; } - + private bool ShouldSerializeTimeOfLastStateChange() { if ((this.IsTimeOfLastStateChangeNull == false)) { return true; } return false; } - + private bool ShouldSerializeTotalPowerOnHours() { if ((this.IsTotalPowerOnHoursNull == false)) { return true; } return false; } - + private bool ShouldSerializeTransitioningToState() { if ((this.IsTransitioningToStateNull == false)) { return true; } return false; } - + private bool ShouldSerializeUsageRestriction() { if ((this.IsUsageRestrictionNull == false)) { return true; } return false; } - + private bool ShouldSerializeVMQOffloadUsage() { if ((this.IsVMQOffloadUsageNull == false)) { return true; } return false; } - + [Browsable(true)] public void CommitObject() { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(); } } - + [Browsable(true)] public void CommitObject(System.Management.PutOptions putOptions) { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(putOptions); } } - + private void Initialize() { AutoCommitProp = true; isEmbedded = false; } - + private static string ConstructPath(string keyCreationClassName, string keyDeviceID, string keySystemCreationClassName, string keySystemName) { string strPath = "ROOT\\virtualization\\v2:Msvm_EthernetSwitchPort"; strPath = string.Concat(strPath, string.Concat(".CreationClassName=", string.Concat("\"", string.Concat(keyCreationClassName, "\"")))); @@ -1690,7 +1690,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { strPath = string.Concat(strPath, string.Concat(",SystemName=", string.Concat("\"", string.Concat(keySystemName, "\"")))); return strPath; } - + private void InitializeObject(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { Initialize(); if ((path != null)) { @@ -1702,24 +1702,24 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { PrivateSystemProperties = new ManagementSystemProperties(PrivateLateBoundObject); curObj = PrivateLateBoundObject; } - + // Different overloads of GetInstances() help in enumerating instances of the WMI class. public static EthernetSwitchPortCollection GetInstances() { return GetInstances(null, null, null); } - + public static EthernetSwitchPortCollection GetInstances(string condition) { return GetInstances(null, condition, null); } - + public static EthernetSwitchPortCollection GetInstances(string[] selectedProperties) { return GetInstances(null, null, selectedProperties); } - + public static EthernetSwitchPortCollection GetInstances(string condition, string[] selectedProperties) { return GetInstances(null, condition, selectedProperties); } - + public static EthernetSwitchPortCollection GetInstances(System.Management.ManagementScope mgmtScope, System.Management.EnumerationOptions enumOptions) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -1740,15 +1740,15 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } return new EthernetSwitchPortCollection(clsObject.GetInstances(enumOptions)); } - + public static EthernetSwitchPortCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition) { return GetInstances(mgmtScope, condition, null); } - + public static EthernetSwitchPortCollection GetInstances(System.Management.ManagementScope mgmtScope, string[] selectedProperties) { return GetInstances(mgmtScope, null, selectedProperties); } - + public static EthernetSwitchPortCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition, string[] selectedProperties) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -1765,7 +1765,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { ObjectSearcher.Options = enumOptions; return new EthernetSwitchPortCollection(ObjectSearcher.Get()); } - + [Browsable(true)] public static EthernetSwitchPort CreateInstance() { System.Management.ManagementScope mgmtScope = null; @@ -1780,12 +1780,12 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { System.Management.ManagementClass tmpMgmtClass = new System.Management.ManagementClass(mgmtScope, mgmtPath, null); return new EthernetSwitchPort(tmpMgmtClass.CreateInstance()); } - + [Browsable(true)] public void Delete() { PrivateLateBoundObject.Delete(); } - + public uint EnableDevice(bool Enabled) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1798,7 +1798,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint OnlineDevice(bool Online) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1811,7 +1811,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint QuiesceDevice(bool Quiesce) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1824,7 +1824,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint RequestStateChange(ushort RequestedState, System.DateTime TimeoutPeriod, out System.Management.ManagementPath Job) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1843,7 +1843,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint Reset() { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1854,7 +1854,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint RestoreProperties() { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1865,7 +1865,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint SaveProperties() { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1876,7 +1876,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint SetPowerState(ushort PowerState, System.DateTime Time) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1890,34 +1890,34 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + // Enumerator implementation for enumerating instances of the class. public class EthernetSwitchPortCollection : object, ICollection { - + private ManagementObjectCollection privColObj; - + public EthernetSwitchPortCollection(ManagementObjectCollection objCollection) { privColObj = objCollection; } - + public virtual int Count { get { return privColObj.Count; } } - + public virtual bool IsSynchronized { get { return privColObj.IsSynchronized; } } - + public virtual object SyncRoot { get { return this; } } - + public virtual void CopyTo(System.Array array, int index) { privColObj.CopyTo(array, index); int nCtr; @@ -1925,189 +1925,189 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { array.SetValue(new EthernetSwitchPort(((System.Management.ManagementObject)(array.GetValue(nCtr)))), nCtr); } } - + public virtual System.Collections.IEnumerator GetEnumerator() { return new EthernetSwitchPortEnumerator(privColObj.GetEnumerator()); } - + public class EthernetSwitchPortEnumerator : object, System.Collections.IEnumerator { - + private ManagementObjectCollection.ManagementObjectEnumerator privObjEnum; - + public EthernetSwitchPortEnumerator(ManagementObjectCollection.ManagementObjectEnumerator objEnum) { privObjEnum = objEnum; } - + public virtual object Current { get { return new EthernetSwitchPort(((System.Management.ManagementObject)(privObjEnum.Current))); } } - + public virtual bool MoveNext() { return privObjEnum.MoveNext(); } - + public virtual void Reset() { privObjEnum.Reset(); } } } - + // TypeConverter to handle null values for ValueType properties public class WMIValueTypeConverter : TypeConverter { - + private TypeConverter baseConverter; - + private System.Type baseType; - + public WMIValueTypeConverter(System.Type inBaseType) { baseConverter = TypeDescriptor.GetConverter(inBaseType); baseType = inBaseType; } - + 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 ((baseType.BaseType == typeof(System.Enum))) { if ((value.GetType() == destinationType)) { return value; } - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return "NULL_ENUM_VALUE" ; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((baseType == typeof(bool)) + if (((baseType == typeof(bool)) && (baseType.BaseType == typeof(System.ValueType)))) { - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((context != null) + if (((context != null) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } } - + // Embedded class to represent WMI system Properties. [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 { diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_EthernetSwitchPortBandwidthSettingData.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_EthernetSwitchPortBandwidthSettingData.cs index 482c4d2fa86..6085ac5aecc 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_EthernetSwitchPortBandwidthSettingData.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_EthernetSwitchPortBandwidthSettingData.cs @@ -23,70 +23,70 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { using System.Globalization; using System.ComponentModel.Design.Serialization; using System.Reflection; - - + + // Functions ShouldSerialize are functions used by VS property browser to check if a particular property has to be serialized. These functions are added for all ValueType properties ( properties of type Int32, BOOL etc.. which cannot be set to null). These functions use IsNull function. These functions are also used in the TypeConverter implementation for the properties to check for NULL value of property so that an empty value can be shown in Property browser in case of Drag and Drop in Visual studio. // Functions IsNull() are used to check if a property is NULL. // Functions Reset are added for Nullable Read/Write properties. These functions are used by VS designer in property browser to set a property to NULL. // Every property added to the class for WMI property has attributes set to define its behavior in Visual Studio designer and also to define a TypeConverter to be used. // An Early Bound class generated for the WMI class.Msvm_EthernetSwitchPortBandwidthSettingData public class EthernetSwitchPortBandwidthSettingData : System.ComponentModel.Component { - + // Private property to hold the WMI namespace in which the class resides. private static string CreatedWmiNamespace = "ROOT\\virtualization\\v2"; - + // Private property to hold the name of WMI class which created this class. private static string CreatedClassName = "Msvm_EthernetSwitchPortBandwidthSettingData"; - + // Private member variable to hold the ManagementScope which is used by the various methods. private static System.Management.ManagementScope statMgmtScope = null; - + private ManagementSystemProperties PrivateSystemProperties; - + // Underlying lateBound WMI object. private System.Management.ManagementObject PrivateLateBoundObject; - + // Member variable to store the 'automatic commit' behavior for the class. private bool AutoCommitProp; - + // Private variable to hold the embedded property representing the instance. private System.Management.ManagementBaseObject embeddedObj; - + // The current WMI object used private System.Management.ManagementBaseObject curObj; - + // Flag to indicate if the instance is an embedded object. private bool isEmbedded; - + // Below are different overloads of constructors to initialize an instance of the class with a WMI object. public EthernetSwitchPortBandwidthSettingData() { this.InitializeObject(null, null, null); } - + public EthernetSwitchPortBandwidthSettingData(string keyInstanceID) { this.InitializeObject(null, new System.Management.ManagementPath(EthernetSwitchPortBandwidthSettingData.ConstructPath(keyInstanceID)), null); } - + public EthernetSwitchPortBandwidthSettingData(System.Management.ManagementScope mgmtScope, string keyInstanceID) { this.InitializeObject(((System.Management.ManagementScope)(mgmtScope)), new System.Management.ManagementPath(EthernetSwitchPortBandwidthSettingData.ConstructPath(keyInstanceID)), null); } - + public EthernetSwitchPortBandwidthSettingData(System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(null, path, getOptions); } - + public EthernetSwitchPortBandwidthSettingData(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path) { this.InitializeObject(mgmtScope, path, null); } - + public EthernetSwitchPortBandwidthSettingData(System.Management.ManagementPath path) { this.InitializeObject(null, path, null); } - + public EthernetSwitchPortBandwidthSettingData(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(mgmtScope, path, getOptions); } - + public EthernetSwitchPortBandwidthSettingData(System.Management.ManagementObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -98,7 +98,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { throw new System.ArgumentException("Class name does not match."); } } - + public EthernetSwitchPortBandwidthSettingData(System.Management.ManagementBaseObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -111,7 +111,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { throw new System.ArgumentException("Class name does not match."); } } - + // Property returns the namespace of the WMI class. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -120,7 +120,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return "ROOT\\virtualization\\v2"; } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ManagementClassName { @@ -129,7 +129,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { if ((curObj != null)) { if ((curObj.ClassPath != null)) { strRet = ((string)(curObj["__CLASS"])); - if (((strRet == null) + if (((strRet == null) || (strRet == string.Empty))) { strRet = CreatedClassName; } @@ -138,7 +138,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return strRet; } } - + // Property pointing to an embedded object to get System properties of the WMI object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -147,7 +147,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return PrivateSystemProperties; } } - + // Property returning the underlying lateBound object. [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -156,7 +156,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return curObj; } } - + // ManagementScope of the object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -175,7 +175,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + // Property to show the commit behavior for the WMI object. If true, WMI object will be automatically saved after each property modification.(ie. Put() is called after modification of a property). [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -187,7 +187,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { AutoCommitProp = value; } } - + // The ManagementPath of the underlying WMI object. [Browsable(true)] public System.Management.ManagementPath Path { @@ -208,7 +208,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + // Public static scope property which is used by the various methods. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -220,7 +220,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { statMgmtScope = value; } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsBurstLimitNull { @@ -233,7 +233,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The peak bandwidth allowed from the port during bursts.")] @@ -247,13 +247,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } set { curObj["BurstLimit"] = value; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsBurstSizeNull { @@ -266,7 +266,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The maximum burst size allowed.")] @@ -280,13 +280,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } set { curObj["BurstSize"] = value; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Caption { @@ -294,7 +294,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Caption"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Description { @@ -302,7 +302,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Description"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ElementName { @@ -310,7 +310,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["ElementName"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string InstanceID { @@ -318,7 +318,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["InstanceID"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsLimitNull { @@ -331,7 +331,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The bandwidth limit allowed for the port.")] @@ -345,13 +345,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } set { curObj["Limit"] = value; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsReservationNull { @@ -364,7 +364,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The minimum absolute bandwidth guaranteed for the port.")] @@ -378,13 +378,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } set { curObj["Reservation"] = value; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsWeightNull { @@ -397,7 +397,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The minimum bandwidth in weight guaranteed for the port.")] @@ -411,15 +411,15 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } set { curObj["Weight"] = value; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } } - + private bool CheckIfProperClass(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions OptionsParam) { - if (((path != null) + if (((path != null) && (string.Compare(path.ClassName, this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -427,9 +427,9 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return CheckIfProperClass(new System.Management.ManagementObject(mgmtScope, path, OptionsParam)); } } - + private bool CheckIfProperClass(System.Management.ManagementBaseObject theObj) { - if (((theObj != null) + if (((theObj != null) && (string.Compare(((string)(theObj["__CLASS"])), this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -446,107 +446,107 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } return false; } - + private bool ShouldSerializeBurstLimit() { if ((this.IsBurstLimitNull == false)) { return true; } return false; } - + private void ResetBurstLimit() { curObj["BurstLimit"] = null; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } - + private bool ShouldSerializeBurstSize() { if ((this.IsBurstSizeNull == false)) { return true; } return false; } - + private void ResetBurstSize() { curObj["BurstSize"] = null; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } - + private bool ShouldSerializeLimit() { if ((this.IsLimitNull == false)) { return true; } return false; } - + private void ResetLimit() { curObj["Limit"] = null; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } - + private bool ShouldSerializeReservation() { if ((this.IsReservationNull == false)) { return true; } return false; } - + private void ResetReservation() { curObj["Reservation"] = null; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } - + private bool ShouldSerializeWeight() { if ((this.IsWeightNull == false)) { return true; } return false; } - + private void ResetWeight() { curObj["Weight"] = null; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } - + [Browsable(true)] public void CommitObject() { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(); } } - + [Browsable(true)] public void CommitObject(System.Management.PutOptions putOptions) { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(putOptions); } } - + private void Initialize() { AutoCommitProp = true; isEmbedded = false; } - + private static string ConstructPath(string keyInstanceID) { string strPath = "ROOT\\virtualization\\v2:Msvm_EthernetSwitchPortBandwidthSettingData"; strPath = string.Concat(strPath, string.Concat(".InstanceID=", string.Concat("\"", string.Concat(keyInstanceID, "\"")))); return strPath; } - + private void InitializeObject(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { Initialize(); if ((path != null)) { @@ -558,24 +558,24 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { PrivateSystemProperties = new ManagementSystemProperties(PrivateLateBoundObject); curObj = PrivateLateBoundObject; } - + // Different overloads of GetInstances() help in enumerating instances of the WMI class. public static EthernetSwitchPortBandwidthSettingDataCollection GetInstances() { return GetInstances(null, null, null); } - + public static EthernetSwitchPortBandwidthSettingDataCollection GetInstances(string condition) { return GetInstances(null, condition, null); } - + public static EthernetSwitchPortBandwidthSettingDataCollection GetInstances(string[] selectedProperties) { return GetInstances(null, null, selectedProperties); } - + public static EthernetSwitchPortBandwidthSettingDataCollection GetInstances(string condition, string[] selectedProperties) { return GetInstances(null, condition, selectedProperties); } - + public static EthernetSwitchPortBandwidthSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, System.Management.EnumerationOptions enumOptions) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -596,15 +596,15 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } return new EthernetSwitchPortBandwidthSettingDataCollection(clsObject.GetInstances(enumOptions)); } - + public static EthernetSwitchPortBandwidthSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition) { return GetInstances(mgmtScope, condition, null); } - + public static EthernetSwitchPortBandwidthSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string[] selectedProperties) { return GetInstances(mgmtScope, null, selectedProperties); } - + public static EthernetSwitchPortBandwidthSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition, string[] selectedProperties) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -621,7 +621,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { ObjectSearcher.Options = enumOptions; return new EthernetSwitchPortBandwidthSettingDataCollection(ObjectSearcher.Get()); } - + [Browsable(true)] public static EthernetSwitchPortBandwidthSettingData CreateInstance() { System.Management.ManagementScope mgmtScope = null; @@ -636,39 +636,39 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { System.Management.ManagementClass tmpMgmtClass = new System.Management.ManagementClass(mgmtScope, mgmtPath, null); return new EthernetSwitchPortBandwidthSettingData(tmpMgmtClass.CreateInstance()); } - + [Browsable(true)] public void Delete() { PrivateLateBoundObject.Delete(); } - + // Enumerator implementation for enumerating instances of the class. public class EthernetSwitchPortBandwidthSettingDataCollection : object, ICollection { - + private ManagementObjectCollection privColObj; - + public EthernetSwitchPortBandwidthSettingDataCollection(ManagementObjectCollection objCollection) { privColObj = objCollection; } - + public virtual int Count { get { return privColObj.Count; } } - + public virtual bool IsSynchronized { get { return privColObj.IsSynchronized; } } - + public virtual object SyncRoot { get { return this; } } - + public virtual void CopyTo(System.Array array, int index) { privColObj.CopyTo(array, index); int nCtr; @@ -676,189 +676,189 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { array.SetValue(new EthernetSwitchPortBandwidthSettingData(((System.Management.ManagementObject)(array.GetValue(nCtr)))), nCtr); } } - + public virtual System.Collections.IEnumerator GetEnumerator() { return new EthernetSwitchPortBandwidthSettingDataEnumerator(privColObj.GetEnumerator()); } - + public class EthernetSwitchPortBandwidthSettingDataEnumerator : object, System.Collections.IEnumerator { - + private ManagementObjectCollection.ManagementObjectEnumerator privObjEnum; - + public EthernetSwitchPortBandwidthSettingDataEnumerator(ManagementObjectCollection.ManagementObjectEnumerator objEnum) { privObjEnum = objEnum; } - + public virtual object Current { get { return new EthernetSwitchPortBandwidthSettingData(((System.Management.ManagementObject)(privObjEnum.Current))); } } - + public virtual bool MoveNext() { return privObjEnum.MoveNext(); } - + public virtual void Reset() { privObjEnum.Reset(); } } } - + // TypeConverter to handle null values for ValueType properties public class WMIValueTypeConverter : TypeConverter { - + private TypeConverter baseConverter; - + private System.Type baseType; - + public WMIValueTypeConverter(System.Type inBaseType) { baseConverter = TypeDescriptor.GetConverter(inBaseType); baseType = inBaseType; } - + 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 ((baseType.BaseType == typeof(System.Enum))) { if ((value.GetType() == destinationType)) { return value; } - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return "NULL_ENUM_VALUE" ; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((baseType == typeof(bool)) + if (((baseType == typeof(bool)) && (baseType.BaseType == typeof(System.ValueType)))) { - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((context != null) + if (((context != null) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } } - + // Embedded class to represent WMI system Properties. [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 { diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_EthernetSwitchPortVlanSettingData.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_EthernetSwitchPortVlanSettingData.cs index f95567cf954..e936f9e00dd 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_EthernetSwitchPortVlanSettingData.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_EthernetSwitchPortVlanSettingData.cs @@ -23,70 +23,70 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { using System.Globalization; using System.ComponentModel.Design.Serialization; using System.Reflection; - - + + // Functions ShouldSerialize are functions used by VS property browser to check if a particular property has to be serialized. These functions are added for all ValueType properties ( properties of type Int32, BOOL etc.. which cannot be set to null). These functions use IsNull function. These functions are also used in the TypeConverter implementation for the properties to check for NULL value of property so that an empty value can be shown in Property browser in case of Drag and Drop in Visual studio. // Functions IsNull() are used to check if a property is NULL. // Functions Reset are added for Nullable Read/Write properties. These functions are used by VS designer in property browser to set a property to NULL. // Every property added to the class for WMI property has attributes set to define its behavior in Visual Studio designer and also to define a TypeConverter to be used. // An Early Bound class generated for the WMI class.Msvm_EthernetSwitchPortVlanSettingData public class EthernetSwitchPortVlanSettingData : System.ComponentModel.Component { - + // Private property to hold the WMI namespace in which the class resides. private static string CreatedWmiNamespace = "ROOT\\virtualization\\v2"; - + // Private property to hold the name of WMI class which created this class. public static string CreatedClassName = "Msvm_EthernetSwitchPortVlanSettingData"; - + // Private member variable to hold the ManagementScope which is used by the various methods. private static System.Management.ManagementScope statMgmtScope = null; - + private ManagementSystemProperties PrivateSystemProperties; - + // Underlying lateBound WMI object. private System.Management.ManagementObject PrivateLateBoundObject; - + // Member variable to store the 'automatic commit' behavior for the class. private bool AutoCommitProp; - + // Private variable to hold the embedded property representing the instance. private System.Management.ManagementBaseObject embeddedObj; - + // The current WMI object used private System.Management.ManagementBaseObject curObj; - + // Flag to indicate if the instance is an embedded object. private bool isEmbedded; - + // Below are different overloads of constructors to initialize an instance of the class with a WMI object. public EthernetSwitchPortVlanSettingData() { this.InitializeObject(null, null, null); } - + public EthernetSwitchPortVlanSettingData(string keyInstanceID) { this.InitializeObject(null, new System.Management.ManagementPath(EthernetSwitchPortVlanSettingData.ConstructPath(keyInstanceID)), null); } - + public EthernetSwitchPortVlanSettingData(System.Management.ManagementScope mgmtScope, string keyInstanceID) { this.InitializeObject(((System.Management.ManagementScope)(mgmtScope)), new System.Management.ManagementPath(EthernetSwitchPortVlanSettingData.ConstructPath(keyInstanceID)), null); } - + public EthernetSwitchPortVlanSettingData(System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(null, path, getOptions); } - + public EthernetSwitchPortVlanSettingData(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path) { this.InitializeObject(mgmtScope, path, null); } - + public EthernetSwitchPortVlanSettingData(System.Management.ManagementPath path) { this.InitializeObject(null, path, null); } - + public EthernetSwitchPortVlanSettingData(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(mgmtScope, path, getOptions); } - + public EthernetSwitchPortVlanSettingData(System.Management.ManagementObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -98,7 +98,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { throw new System.ArgumentException("Class name does not match."); } } - + public EthernetSwitchPortVlanSettingData(System.Management.ManagementBaseObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -111,7 +111,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { throw new System.ArgumentException("Class name does not match."); } } - + // Property returns the namespace of the WMI class. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -120,7 +120,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return "ROOT\\virtualization\\v2"; } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ManagementClassName { @@ -129,7 +129,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { if ((curObj != null)) { if ((curObj.ClassPath != null)) { strRet = ((string)(curObj["__CLASS"])); - if (((strRet == null) + if (((strRet == null) || (strRet == string.Empty))) { strRet = CreatedClassName; } @@ -138,7 +138,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return strRet; } } - + // Property pointing to an embedded object to get System properties of the WMI object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -147,7 +147,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return PrivateSystemProperties; } } - + // Property returning the underlying lateBound object. [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -156,7 +156,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return curObj; } } - + // ManagementScope of the object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -175,7 +175,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + // Property to show the commit behavior for the WMI object. If true, WMI object will be automatically saved after each property modification.(ie. Put() is called after modification of a property). [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -187,7 +187,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { AutoCommitProp = value; } } - + // The ManagementPath of the underlying WMI object. [Browsable(true)] public System.Management.ManagementPath Path { @@ -208,7 +208,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + // Public static scope property which is used by the various methods. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -220,7 +220,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { statMgmtScope = value; } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsAccessVlanIdNull { @@ -233,7 +233,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The vlan ID in access mode.")] @@ -247,13 +247,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } set { curObj["AccessVlanId"] = value; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Caption { @@ -261,7 +261,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Caption"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Description { @@ -269,7 +269,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Description"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ElementName { @@ -277,7 +277,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["ElementName"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string InstanceID { @@ -285,7 +285,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["InstanceID"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsNativeVlanIdNull { @@ -298,7 +298,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The vlan ID in trunk mode.")] @@ -312,13 +312,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } set { curObj["NativeVlanId"] = value; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsOperationModeNull { @@ -331,7 +331,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The vlan operation modes.")] @@ -350,13 +350,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { else { curObj["OperationMode"] = value; } - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPrimaryVlanIdNull { @@ -369,7 +369,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The primary vlan ID in private mode.")] @@ -383,13 +383,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } set { curObj["PrimaryVlanId"] = value; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The prune vlan ID bitmap in trunk mode.")] @@ -399,13 +399,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } set { curObj["PruneVlanIdArray"] = value; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPvlanModeNull { @@ -418,7 +418,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The private vlan modes.")] @@ -437,13 +437,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { else { curObj["PvlanMode"] = value; } - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsSecondaryVlanIdNull { @@ -456,7 +456,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The secondary vlan ID in private mode.")] @@ -470,13 +470,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } set { curObj["SecondaryVlanId"] = value; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The secondary vlan ID bitmap in private mode.")] @@ -486,13 +486,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } set { curObj["SecondaryVlanIdArray"] = value; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The trunk vlan ID bitmap in trunk mode.")] @@ -502,15 +502,15 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } set { curObj["TrunkVlanIdArray"] = value; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } } - + private bool CheckIfProperClass(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions OptionsParam) { - if (((path != null) + if (((path != null) && (string.Compare(path.ClassName, this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -518,9 +518,9 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return CheckIfProperClass(new System.Management.ManagementObject(mgmtScope, path, OptionsParam)); } } - + private bool CheckIfProperClass(System.Management.ManagementBaseObject theObj) { - if (((theObj != null) + if (((theObj != null) && (string.Compare(((string)(theObj["__CLASS"])), this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -537,146 +537,146 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } return false; } - + private bool ShouldSerializeAccessVlanId() { if ((this.IsAccessVlanIdNull == false)) { return true; } return false; } - + private void ResetAccessVlanId() { curObj["AccessVlanId"] = null; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } - + private bool ShouldSerializeNativeVlanId() { if ((this.IsNativeVlanIdNull == false)) { return true; } return false; } - + private void ResetNativeVlanId() { curObj["NativeVlanId"] = null; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } - + private bool ShouldSerializeOperationMode() { if ((this.IsOperationModeNull == false)) { return true; } return false; } - + private void ResetOperationMode() { curObj["OperationMode"] = null; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } - + private bool ShouldSerializePrimaryVlanId() { if ((this.IsPrimaryVlanIdNull == false)) { return true; } return false; } - + private void ResetPrimaryVlanId() { curObj["PrimaryVlanId"] = null; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } - + private void ResetPruneVlanIdArray() { curObj["PruneVlanIdArray"] = null; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } - + private bool ShouldSerializePvlanMode() { if ((this.IsPvlanModeNull == false)) { return true; } return false; } - + private void ResetPvlanMode() { curObj["PvlanMode"] = null; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } - + private bool ShouldSerializeSecondaryVlanId() { if ((this.IsSecondaryVlanIdNull == false)) { return true; } return false; } - + private void ResetSecondaryVlanId() { curObj["SecondaryVlanId"] = null; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } - + private void ResetSecondaryVlanIdArray() { curObj["SecondaryVlanIdArray"] = null; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } - + private void ResetTrunkVlanIdArray() { curObj["TrunkVlanIdArray"] = null; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } - + [Browsable(true)] public void CommitObject() { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(); } } - + [Browsable(true)] public void CommitObject(System.Management.PutOptions putOptions) { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(putOptions); } } - + private void Initialize() { AutoCommitProp = true; isEmbedded = false; } - + private static string ConstructPath(string keyInstanceID) { string strPath = "ROOT\\virtualization\\v2:Msvm_EthernetSwitchPortVlanSettingData"; strPath = string.Concat(strPath, string.Concat(".InstanceID=", string.Concat("\"", string.Concat(keyInstanceID, "\"")))); return strPath; } - + private void InitializeObject(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { Initialize(); if ((path != null)) { @@ -688,24 +688,24 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { PrivateSystemProperties = new ManagementSystemProperties(PrivateLateBoundObject); curObj = PrivateLateBoundObject; } - + // Different overloads of GetInstances() help in enumerating instances of the WMI class. public static EthernetSwitchPortVlanSettingDataCollection GetInstances() { return GetInstances(null, null, null); } - + public static EthernetSwitchPortVlanSettingDataCollection GetInstances(string condition) { return GetInstances(null, condition, null); } - + public static EthernetSwitchPortVlanSettingDataCollection GetInstances(string[] selectedProperties) { return GetInstances(null, null, selectedProperties); } - + public static EthernetSwitchPortVlanSettingDataCollection GetInstances(string condition, string[] selectedProperties) { return GetInstances(null, condition, selectedProperties); } - + public static EthernetSwitchPortVlanSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, System.Management.EnumerationOptions enumOptions) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -726,15 +726,15 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } return new EthernetSwitchPortVlanSettingDataCollection(clsObject.GetInstances(enumOptions)); } - + public static EthernetSwitchPortVlanSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition) { return GetInstances(mgmtScope, condition, null); } - + public static EthernetSwitchPortVlanSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string[] selectedProperties) { return GetInstances(mgmtScope, null, selectedProperties); } - + public static EthernetSwitchPortVlanSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition, string[] selectedProperties) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -751,7 +751,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { ObjectSearcher.Options = enumOptions; return new EthernetSwitchPortVlanSettingDataCollection(ObjectSearcher.Get()); } - + [Browsable(true)] public static EthernetSwitchPortVlanSettingData CreateInstance() { System.Management.ManagementScope mgmtScope = null; @@ -766,61 +766,61 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { System.Management.ManagementClass tmpMgmtClass = new System.Management.ManagementClass(mgmtScope, mgmtPath, null); return new EthernetSwitchPortVlanSettingData(tmpMgmtClass.CreateInstance()); } - + [Browsable(true)] public void Delete() { PrivateLateBoundObject.Delete(); } - + public enum OperationModeValues { - + Access = 1, - + Trunk = 2, - + Private = 3, - + NULL_ENUM_VALUE = 0, } - + public enum PvlanModeValues { - + Isolated = 1, - + Community = 2, - + Promiscuous = 3, - + NULL_ENUM_VALUE = 0, } - + // Enumerator implementation for enumerating instances of the class. public class EthernetSwitchPortVlanSettingDataCollection : object, ICollection { - + private ManagementObjectCollection privColObj; - + public EthernetSwitchPortVlanSettingDataCollection(ManagementObjectCollection objCollection) { privColObj = objCollection; } - + public virtual int Count { get { return privColObj.Count; } } - + public virtual bool IsSynchronized { get { return privColObj.IsSynchronized; } } - + public virtual object SyncRoot { get { return this; } } - + public virtual void CopyTo(System.Array array, int index) { privColObj.CopyTo(array, index); int nCtr; @@ -828,189 +828,189 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { array.SetValue(new EthernetSwitchPortVlanSettingData(((System.Management.ManagementObject)(array.GetValue(nCtr)))), nCtr); } } - + public virtual System.Collections.IEnumerator GetEnumerator() { return new EthernetSwitchPortVlanSettingDataEnumerator(privColObj.GetEnumerator()); } - + public class EthernetSwitchPortVlanSettingDataEnumerator : object, System.Collections.IEnumerator { - + private ManagementObjectCollection.ManagementObjectEnumerator privObjEnum; - + public EthernetSwitchPortVlanSettingDataEnumerator(ManagementObjectCollection.ManagementObjectEnumerator objEnum) { privObjEnum = objEnum; } - + public virtual object Current { get { return new EthernetSwitchPortVlanSettingData(((System.Management.ManagementObject)(privObjEnum.Current))); } } - + public virtual bool MoveNext() { return privObjEnum.MoveNext(); } - + public virtual void Reset() { privObjEnum.Reset(); } } } - + // TypeConverter to handle null values for ValueType properties public class WMIValueTypeConverter : TypeConverter { - + private TypeConverter baseConverter; - + private System.Type baseType; - + public WMIValueTypeConverter(System.Type inBaseType) { baseConverter = TypeDescriptor.GetConverter(inBaseType); baseType = inBaseType; } - + 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 ((baseType.BaseType == typeof(System.Enum))) { if ((value.GetType() == destinationType)) { return value; } - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return "NULL_ENUM_VALUE" ; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((baseType == typeof(bool)) + if (((baseType == typeof(bool)) && (baseType.BaseType == typeof(System.ValueType)))) { - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((context != null) + if (((context != null) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } } - + // Embedded class to represent WMI system Properties. [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 { diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_ExternalEthernetPort.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_ExternalEthernetPort.cs index 1b6828621d0..e4b2fda9d48 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_ExternalEthernetPort.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_ExternalEthernetPort.cs @@ -23,8 +23,8 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { using System.Globalization; using System.ComponentModel.Design.Serialization; using System.Reflection; - - + + // Functions ShouldSerialize are functions used by VS property browser to check if a particular property has to be serialized. These functions are added for all ValueType properties ( properties of type Int32, BOOL etc.. which cannot be set to null). These functions use IsNull function. These functions are also used in the TypeConverter implementation for the properties to check for NULL value of property so that an empty value can be shown in Property browser in case of Drag and Drop in Visual studio. // Functions IsNull() are used to check if a property is NULL. // Functions Reset are added for Nullable Read/Write properties. These functions are used by VS designer in property browser to set a property to NULL. @@ -32,62 +32,62 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { // Datetime conversion functions ToDateTime and ToDmtfDateTime are added to the class to convert DMTF datetime to System.DateTime and vice-versa. // An Early Bound class generated for the WMI class.Msvm_ExternalEthernetPort public class ExternalEthernetPort : System.ComponentModel.Component { - + // Private property to hold the WMI namespace in which the class resides. private static string CreatedWmiNamespace = "ROOT\\virtualization\\v2"; - + // Private property to hold the name of WMI class which created this class. private static string CreatedClassName = "Msvm_ExternalEthernetPort"; - + // Private member variable to hold the ManagementScope which is used by the various methods. private static System.Management.ManagementScope statMgmtScope = null; - + private ManagementSystemProperties PrivateSystemProperties; - + // Underlying lateBound WMI object. private System.Management.ManagementObject PrivateLateBoundObject; - + // Member variable to store the 'automatic commit' behavior for the class. private bool AutoCommitProp; - + // Private variable to hold the embedded property representing the instance. private System.Management.ManagementBaseObject embeddedObj; - + // The current WMI object used private System.Management.ManagementBaseObject curObj; - + // Flag to indicate if the instance is an embedded object. private bool isEmbedded; - + // Below are different overloads of constructors to initialize an instance of the class with a WMI object. public ExternalEthernetPort() { this.InitializeObject(null, null, null); } - + public ExternalEthernetPort(string keyCreationClassName, string keyDeviceID, string keySystemCreationClassName, string keySystemName) { this.InitializeObject(null, new System.Management.ManagementPath(ExternalEthernetPort.ConstructPath(keyCreationClassName, keyDeviceID, keySystemCreationClassName, keySystemName)), null); } - + public ExternalEthernetPort(System.Management.ManagementScope mgmtScope, string keyCreationClassName, string keyDeviceID, string keySystemCreationClassName, string keySystemName) { this.InitializeObject(((System.Management.ManagementScope)(mgmtScope)), new System.Management.ManagementPath(ExternalEthernetPort.ConstructPath(keyCreationClassName, keyDeviceID, keySystemCreationClassName, keySystemName)), null); } - + public ExternalEthernetPort(System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(null, path, getOptions); } - + public ExternalEthernetPort(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path) { this.InitializeObject(mgmtScope, path, null); } - + public ExternalEthernetPort(System.Management.ManagementPath path) { this.InitializeObject(null, path, null); } - + public ExternalEthernetPort(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(mgmtScope, path, getOptions); } - + public ExternalEthernetPort(System.Management.ManagementObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -99,7 +99,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { throw new System.ArgumentException("Class name does not match."); } } - + public ExternalEthernetPort(System.Management.ManagementBaseObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -112,7 +112,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { throw new System.ArgumentException("Class name does not match."); } } - + // Property returns the namespace of the WMI class. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -121,7 +121,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return "ROOT\\virtualization\\v2"; } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ManagementClassName { @@ -130,7 +130,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { if ((curObj != null)) { if ((curObj.ClassPath != null)) { strRet = ((string)(curObj["__CLASS"])); - if (((strRet == null) + if (((strRet == null) || (strRet == string.Empty))) { strRet = CreatedClassName; } @@ -139,7 +139,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return strRet; } } - + // Property pointing to an embedded object to get System properties of the WMI object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -148,7 +148,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return PrivateSystemProperties; } } - + // Property returning the underlying lateBound object. [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -157,7 +157,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return curObj; } } - + // ManagementScope of the object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -176,7 +176,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + // Property to show the commit behavior for the WMI object. If true, WMI object will be automatically saved after each property modification.(ie. Put() is called after modification of a property). [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -188,7 +188,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { AutoCommitProp = value; } } - + // The ManagementPath of the underlying WMI object. [Browsable(true)] public System.Management.ManagementPath Path { @@ -209,7 +209,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + // Public static scope property which is used by the various methods. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -221,7 +221,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { statMgmtScope = value; } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsActiveMaximumTransmissionUnitNull { @@ -234,7 +234,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -246,7 +246,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ulong)(curObj["ActiveMaximumTransmissionUnit"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public ushort[] AdditionalAvailability { @@ -254,7 +254,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort[])(curObj["AdditionalAvailability"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsAutoSenseNull { @@ -267,7 +267,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -279,7 +279,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((bool)(curObj["AutoSense"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsAvailabilityNull { @@ -292,7 +292,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -304,7 +304,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["Availability"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public ushort[] AvailableRequestedStates { @@ -312,7 +312,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort[])(curObj["AvailableRequestedStates"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public ushort[] Capabilities { @@ -320,7 +320,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort[])(curObj["Capabilities"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string[] CapabilityDescriptions { @@ -328,7 +328,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string[])(curObj["CapabilityDescriptions"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Caption { @@ -336,7 +336,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Caption"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsCommunicationStatusNull { @@ -349,7 +349,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -361,7 +361,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["CommunicationStatus"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string CreationClassName { @@ -369,7 +369,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["CreationClassName"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Description { @@ -377,7 +377,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Description"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsDetailedStatusNull { @@ -390,7 +390,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -402,7 +402,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["DetailedStatus"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string DeviceID { @@ -410,7 +410,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["DeviceID"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ElementName { @@ -418,7 +418,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["ElementName"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public ushort[] EnabledCapabilities { @@ -426,7 +426,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort[])(curObj["EnabledCapabilities"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsEnabledDefaultNull { @@ -439,7 +439,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -451,7 +451,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["EnabledDefault"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsEnabledStateNull { @@ -464,7 +464,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -476,7 +476,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["EnabledState"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsErrorClearedNull { @@ -489,7 +489,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -501,7 +501,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((bool)(curObj["ErrorCleared"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ErrorDescription { @@ -509,7 +509,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["ErrorDescription"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsFullDuplexNull { @@ -522,7 +522,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -534,7 +534,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((bool)(curObj["FullDuplex"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsHealthStateNull { @@ -547,7 +547,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -559,7 +559,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["HealthState"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string[] IdentifyingDescriptions { @@ -567,7 +567,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string[])(curObj["IdentifyingDescriptions"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsInstallDateNull { @@ -580,7 +580,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -594,7 +594,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string InstanceID { @@ -602,7 +602,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["InstanceID"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsIsBoundNull { @@ -615,7 +615,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("If this property is true, then this Ethernet port can be connected to the switche" + @@ -631,7 +631,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((bool)(curObj["IsBound"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsLastErrorCodeNull { @@ -644,7 +644,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -656,7 +656,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((uint)(curObj["LastErrorCode"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsLinkTechnologyNull { @@ -669,7 +669,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -681,7 +681,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["LinkTechnology"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsMaxDataSizeNull { @@ -694,7 +694,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -706,7 +706,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((uint)(curObj["MaxDataSize"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsMaxQuiesceTimeNull { @@ -719,7 +719,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -731,7 +731,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ulong)(curObj["MaxQuiesceTime"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsMaxSpeedNull { @@ -744,7 +744,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -756,7 +756,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ulong)(curObj["MaxSpeed"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Name { @@ -764,7 +764,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Name"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string[] NetworkAddresses { @@ -772,7 +772,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string[])(curObj["NetworkAddresses"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsOperatingStatusNull { @@ -785,7 +785,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -797,7 +797,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["OperatingStatus"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public ushort[] OperationalStatus { @@ -805,7 +805,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort[])(curObj["OperationalStatus"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string[] OtherEnabledCapabilities { @@ -813,7 +813,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string[])(curObj["OtherEnabledCapabilities"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string OtherEnabledState { @@ -821,7 +821,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["OtherEnabledState"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string[] OtherIdentifyingInfo { @@ -829,7 +829,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string[])(curObj["OtherIdentifyingInfo"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string OtherLinkTechnology { @@ -837,7 +837,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["OtherLinkTechnology"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string OtherNetworkPortType { @@ -845,7 +845,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["OtherNetworkPortType"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string OtherPortType { @@ -853,7 +853,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["OtherPortType"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string PermanentAddress { @@ -861,7 +861,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["PermanentAddress"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPortNumberNull { @@ -874,7 +874,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -886,7 +886,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["PortNumber"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPortTypeNull { @@ -899,7 +899,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -911,7 +911,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["PortType"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public ushort[] PowerManagementCapabilities { @@ -919,7 +919,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort[])(curObj["PowerManagementCapabilities"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPowerManagementSupportedNull { @@ -932,7 +932,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -944,7 +944,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((bool)(curObj["PowerManagementSupported"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPowerOnHoursNull { @@ -957,7 +957,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -969,7 +969,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ulong)(curObj["PowerOnHours"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPrimaryStatusNull { @@ -982,7 +982,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -994,7 +994,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["PrimaryStatus"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsRequestedSpeedNull { @@ -1007,7 +1007,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -1019,7 +1019,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ulong)(curObj["RequestedSpeed"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsRequestedStateNull { @@ -1032,7 +1032,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -1044,7 +1044,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["RequestedState"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsSpeedNull { @@ -1057,7 +1057,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -1069,7 +1069,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ulong)(curObj["Speed"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Status { @@ -1077,7 +1077,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Status"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string[] StatusDescriptions { @@ -1085,7 +1085,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string[])(curObj["StatusDescriptions"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsStatusInfoNull { @@ -1098,7 +1098,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -1110,7 +1110,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["StatusInfo"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsSupportedMaximumTransmissionUnitNull { @@ -1123,7 +1123,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -1135,7 +1135,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ulong)(curObj["SupportedMaximumTransmissionUnit"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string SystemCreationClassName { @@ -1143,7 +1143,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["SystemCreationClassName"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string SystemName { @@ -1151,7 +1151,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["SystemName"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsTimeOfLastStateChangeNull { @@ -1164,7 +1164,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -1178,7 +1178,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsTotalPowerOnHoursNull { @@ -1191,7 +1191,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -1203,7 +1203,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ulong)(curObj["TotalPowerOnHours"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsTransitioningToStateNull { @@ -1216,7 +1216,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -1228,7 +1228,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["TransitioningToState"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsUsageRestrictionNull { @@ -1241,7 +1241,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -1253,9 +1253,9 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["UsageRestriction"])); } } - + private bool CheckIfProperClass(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions OptionsParam) { - if (((path != null) + if (((path != null) && (string.Compare(path.ClassName, this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -1263,9 +1263,9 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return CheckIfProperClass(new System.Management.ManagementObject(mgmtScope, path, OptionsParam)); } } - + private bool CheckIfProperClass(System.Management.ManagementBaseObject theObj) { - if (((theObj != null) + if (((theObj != null) && (string.Compare(((string)(theObj["__CLASS"])), this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -1282,77 +1282,77 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } return false; } - + private bool ShouldSerializeActiveMaximumTransmissionUnit() { if ((this.IsActiveMaximumTransmissionUnitNull == false)) { return true; } return false; } - + private bool ShouldSerializeAutoSense() { if ((this.IsAutoSenseNull == false)) { return true; } return false; } - + private bool ShouldSerializeAvailability() { if ((this.IsAvailabilityNull == false)) { return true; } return false; } - + private bool ShouldSerializeCommunicationStatus() { if ((this.IsCommunicationStatusNull == false)) { return true; } return false; } - + private bool ShouldSerializeDetailedStatus() { if ((this.IsDetailedStatusNull == false)) { return true; } return false; } - + private bool ShouldSerializeEnabledDefault() { if ((this.IsEnabledDefaultNull == false)) { return true; } return false; } - + private bool ShouldSerializeEnabledState() { if ((this.IsEnabledStateNull == false)) { return true; } return false; } - + private bool ShouldSerializeErrorCleared() { if ((this.IsErrorClearedNull == false)) { return true; } return false; } - + private bool ShouldSerializeFullDuplex() { if ((this.IsFullDuplexNull == false)) { return true; } return false; } - + private bool ShouldSerializeHealthState() { if ((this.IsHealthStateNull == false)) { return true; } return false; } - + // Converts a given datetime in DMTF format to System.DateTime object. static System.DateTime ToDateTime(string dmtfDate) { System.DateTime initializer = System.DateTime.MinValue; @@ -1404,13 +1404,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { if (("******" != tempString)) { ticks = (long.Parse(tempString) * ((long)((System.TimeSpan.TicksPerMillisecond / 1000)))); } - if (((((((((year < 0) - || (month < 0)) - || (day < 0)) - || (hour < 0)) - || (minute < 0)) - || (minute < 0)) - || (second < 0)) + if (((((((((year < 0) + || (month < 0)) + || (day < 0)) + || (hour < 0)) + || (minute < 0)) + || (minute < 0)) + || (second < 0)) || (ticks < 0))) { throw new System.ArgumentOutOfRangeException(); } @@ -1438,7 +1438,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } return datetime; } - + // Converts a given System.DateTime object to DMTF datetime format. static string ToDmtfDateTime(System.DateTime date) { string utcString = string.Empty; @@ -1465,8 +1465,8 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { dmtfDateTime = string.Concat(dmtfDateTime, ((int)(date.Second)).ToString().PadLeft(2, '0')); dmtfDateTime = string.Concat(dmtfDateTime, "."); System.DateTime dtTemp = new System.DateTime(date.Year, date.Month, date.Day, date.Hour, date.Minute, date.Second, 0); - long microsec = ((long)((((date.Ticks - dtTemp.Ticks) - * 1000) + long microsec = ((long)((((date.Ticks - dtTemp.Ticks) + * 1000) / System.TimeSpan.TicksPerMillisecond))); string strMicrosec = ((long)(microsec)).ToString(); if ((strMicrosec.Length > 6)) { @@ -1476,180 +1476,180 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { dmtfDateTime = string.Concat(dmtfDateTime, utcString); return dmtfDateTime; } - + private bool ShouldSerializeInstallDate() { if ((this.IsInstallDateNull == false)) { return true; } return false; } - + private bool ShouldSerializeIsBound() { if ((this.IsIsBoundNull == false)) { return true; } return false; } - + private bool ShouldSerializeLastErrorCode() { if ((this.IsLastErrorCodeNull == false)) { return true; } return false; } - + private bool ShouldSerializeLinkTechnology() { if ((this.IsLinkTechnologyNull == false)) { return true; } return false; } - + private bool ShouldSerializeMaxDataSize() { if ((this.IsMaxDataSizeNull == false)) { return true; } return false; } - + private bool ShouldSerializeMaxQuiesceTime() { if ((this.IsMaxQuiesceTimeNull == false)) { return true; } return false; } - + private bool ShouldSerializeMaxSpeed() { if ((this.IsMaxSpeedNull == false)) { return true; } return false; } - + private bool ShouldSerializeOperatingStatus() { if ((this.IsOperatingStatusNull == false)) { return true; } return false; } - + private bool ShouldSerializePortNumber() { if ((this.IsPortNumberNull == false)) { return true; } return false; } - + private bool ShouldSerializePortType() { if ((this.IsPortTypeNull == false)) { return true; } return false; } - + private bool ShouldSerializePowerManagementSupported() { if ((this.IsPowerManagementSupportedNull == false)) { return true; } return false; } - + private bool ShouldSerializePowerOnHours() { if ((this.IsPowerOnHoursNull == false)) { return true; } return false; } - + private bool ShouldSerializePrimaryStatus() { if ((this.IsPrimaryStatusNull == false)) { return true; } return false; } - + private bool ShouldSerializeRequestedSpeed() { if ((this.IsRequestedSpeedNull == false)) { return true; } return false; } - + private bool ShouldSerializeRequestedState() { if ((this.IsRequestedStateNull == false)) { return true; } return false; } - + private bool ShouldSerializeSpeed() { if ((this.IsSpeedNull == false)) { return true; } return false; } - + private bool ShouldSerializeStatusInfo() { if ((this.IsStatusInfoNull == false)) { return true; } return false; } - + private bool ShouldSerializeSupportedMaximumTransmissionUnit() { if ((this.IsSupportedMaximumTransmissionUnitNull == false)) { return true; } return false; } - + private bool ShouldSerializeTimeOfLastStateChange() { if ((this.IsTimeOfLastStateChangeNull == false)) { return true; } return false; } - + private bool ShouldSerializeTotalPowerOnHours() { if ((this.IsTotalPowerOnHoursNull == false)) { return true; } return false; } - + private bool ShouldSerializeTransitioningToState() { if ((this.IsTransitioningToStateNull == false)) { return true; } return false; } - + private bool ShouldSerializeUsageRestriction() { if ((this.IsUsageRestrictionNull == false)) { return true; } return false; } - + [Browsable(true)] public void CommitObject() { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(); } } - + [Browsable(true)] public void CommitObject(System.Management.PutOptions putOptions) { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(putOptions); } } - + private void Initialize() { AutoCommitProp = true; isEmbedded = false; } - + private static string ConstructPath(string keyCreationClassName, string keyDeviceID, string keySystemCreationClassName, string keySystemName) { string strPath = "ROOT\\virtualization\\v2:Msvm_ExternalEthernetPort"; strPath = string.Concat(strPath, string.Concat(".CreationClassName=", string.Concat("\"", string.Concat(keyCreationClassName, "\"")))); @@ -1658,7 +1658,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { strPath = string.Concat(strPath, string.Concat(",SystemName=", string.Concat("\"", string.Concat(keySystemName, "\"")))); return strPath; } - + private void InitializeObject(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { Initialize(); if ((path != null)) { @@ -1670,24 +1670,24 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { PrivateSystemProperties = new ManagementSystemProperties(PrivateLateBoundObject); curObj = PrivateLateBoundObject; } - + // Different overloads of GetInstances() help in enumerating instances of the WMI class. public static ExternalEthernetPortCollection GetInstances() { return GetInstances(null, null, null); } - + public static ExternalEthernetPortCollection GetInstances(string condition) { return GetInstances(null, condition, null); } - + public static ExternalEthernetPortCollection GetInstances(string[] selectedProperties) { return GetInstances(null, null, selectedProperties); } - + public static ExternalEthernetPortCollection GetInstances(string condition, string[] selectedProperties) { return GetInstances(null, condition, selectedProperties); } - + public static ExternalEthernetPortCollection GetInstances(System.Management.ManagementScope mgmtScope, System.Management.EnumerationOptions enumOptions) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -1708,15 +1708,15 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } return new ExternalEthernetPortCollection(clsObject.GetInstances(enumOptions)); } - + public static ExternalEthernetPortCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition) { return GetInstances(mgmtScope, condition, null); } - + public static ExternalEthernetPortCollection GetInstances(System.Management.ManagementScope mgmtScope, string[] selectedProperties) { return GetInstances(mgmtScope, null, selectedProperties); } - + public static ExternalEthernetPortCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition, string[] selectedProperties) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -1733,7 +1733,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { ObjectSearcher.Options = enumOptions; return new ExternalEthernetPortCollection(ObjectSearcher.Get()); } - + [Browsable(true)] public static ExternalEthernetPort CreateInstance() { System.Management.ManagementScope mgmtScope = null; @@ -1748,12 +1748,12 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { System.Management.ManagementClass tmpMgmtClass = new System.Management.ManagementClass(mgmtScope, mgmtPath, null); return new ExternalEthernetPort(tmpMgmtClass.CreateInstance()); } - + [Browsable(true)] public void Delete() { PrivateLateBoundObject.Delete(); } - + public uint EnableDevice(bool Enabled) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1766,7 +1766,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint OnlineDevice(bool Online) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1779,7 +1779,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint QuiesceDevice(bool Quiesce) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1792,7 +1792,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint RequestStateChange(ushort RequestedState, System.DateTime TimeoutPeriod, out System.Management.ManagementPath Job) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1811,7 +1811,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint Reset() { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1822,7 +1822,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint RestoreProperties() { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1833,7 +1833,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint SaveProperties() { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1844,7 +1844,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint SetPowerState(ushort PowerState, System.DateTime Time) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1858,34 +1858,34 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + // Enumerator implementation for enumerating instances of the class. public class ExternalEthernetPortCollection : object, ICollection { - + private ManagementObjectCollection privColObj; - + public ExternalEthernetPortCollection(ManagementObjectCollection objCollection) { privColObj = objCollection; } - + public virtual int Count { get { return privColObj.Count; } } - + public virtual bool IsSynchronized { get { return privColObj.IsSynchronized; } } - + public virtual object SyncRoot { get { return this; } } - + public virtual void CopyTo(System.Array array, int index) { privColObj.CopyTo(array, index); int nCtr; @@ -1893,189 +1893,189 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { array.SetValue(new ExternalEthernetPort(((System.Management.ManagementObject)(array.GetValue(nCtr)))), nCtr); } } - + public virtual System.Collections.IEnumerator GetEnumerator() { return new ExternalEthernetPortEnumerator(privColObj.GetEnumerator()); } - + public class ExternalEthernetPortEnumerator : object, System.Collections.IEnumerator { - + private ManagementObjectCollection.ManagementObjectEnumerator privObjEnum; - + public ExternalEthernetPortEnumerator(ManagementObjectCollection.ManagementObjectEnumerator objEnum) { privObjEnum = objEnum; } - + public virtual object Current { get { return new ExternalEthernetPort(((System.Management.ManagementObject)(privObjEnum.Current))); } } - + public virtual bool MoveNext() { return privObjEnum.MoveNext(); } - + public virtual void Reset() { privObjEnum.Reset(); } } } - + // TypeConverter to handle null values for ValueType properties public class WMIValueTypeConverter : TypeConverter { - + private TypeConverter baseConverter; - + private System.Type baseType; - + public WMIValueTypeConverter(System.Type inBaseType) { baseConverter = TypeDescriptor.GetConverter(inBaseType); baseType = inBaseType; } - + 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 ((baseType.BaseType == typeof(System.Enum))) { if ((value.GetType() == destinationType)) { return value; } - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return "NULL_ENUM_VALUE" ; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((baseType == typeof(bool)) + if (((baseType == typeof(bool)) && (baseType.BaseType == typeof(System.ValueType)))) { - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((context != null) + if (((context != null) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } } - + // Embedded class to represent WMI system Properties. [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 { diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_ImageManagementService.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_ImageManagementService.cs index 1ebbeb00f91..5b3b781748b 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_ImageManagementService.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_ImageManagementService.cs @@ -23,8 +23,8 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { using System.Globalization; using System.ComponentModel.Design.Serialization; using System.Reflection; - - + + // Functions ShouldSerialize are functions used by VS property browser to check if a particular property has to be serialized. These functions are added for all ValueType properties ( properties of type Int32, BOOL etc.. which cannot be set to null). These functions use IsNull function. These functions are also used in the TypeConverter implementation for the properties to check for NULL value of property so that an empty value can be shown in Property browser in case of Drag and Drop in Visual studio. // Functions IsNull() are used to check if a property is NULL. // Functions Reset are added for Nullable Read/Write properties. These functions are used by VS designer in property browser to set a property to NULL. @@ -32,62 +32,62 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { // Datetime conversion functions ToDateTime and ToDmtfDateTime are added to the class to convert DMTF datetime to System.DateTime and vice-versa. // An Early Bound class generated for the WMI class.Msvm_ImageManagementService public class ImageManagementService : System.ComponentModel.Component { - + // Private property to hold the WMI namespace in which the class resides. private static string CreatedWmiNamespace = "ROOT\\virtualization\\v2"; - + // Private property to hold the name of WMI class which created this class. private static string CreatedClassName = "Msvm_ImageManagementService"; - + // Private member variable to hold the ManagementScope which is used by the various methods. private static System.Management.ManagementScope statMgmtScope = null; - + private ManagementSystemProperties PrivateSystemProperties; - + // Underlying lateBound WMI object. private System.Management.ManagementObject PrivateLateBoundObject; - + // Member variable to store the 'automatic commit' behavior for the class. private bool AutoCommitProp; - + // Private variable to hold the embedded property representing the instance. private System.Management.ManagementBaseObject embeddedObj; - + // The current WMI object used private System.Management.ManagementBaseObject curObj; - + // Flag to indicate if the instance is an embedded object. private bool isEmbedded; - + // Below are different overloads of constructors to initialize an instance of the class with a WMI object. public ImageManagementService() { this.InitializeObject(null, null, null); } - + public ImageManagementService(string keyCreationClassName, string keyName, string keySystemCreationClassName, string keySystemName) { this.InitializeObject(null, new System.Management.ManagementPath(ImageManagementService.ConstructPath(keyCreationClassName, keyName, keySystemCreationClassName, keySystemName)), null); } - + public ImageManagementService(System.Management.ManagementScope mgmtScope, string keyCreationClassName, string keyName, string keySystemCreationClassName, string keySystemName) { this.InitializeObject(((System.Management.ManagementScope)(mgmtScope)), new System.Management.ManagementPath(ImageManagementService.ConstructPath(keyCreationClassName, keyName, keySystemCreationClassName, keySystemName)), null); } - + public ImageManagementService(System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(null, path, getOptions); } - + public ImageManagementService(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path) { this.InitializeObject(mgmtScope, path, null); } - + public ImageManagementService(System.Management.ManagementPath path) { this.InitializeObject(null, path, null); } - + public ImageManagementService(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(mgmtScope, path, getOptions); } - + public ImageManagementService(System.Management.ManagementObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -99,7 +99,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { throw new System.ArgumentException("Class name does not match."); } } - + public ImageManagementService(System.Management.ManagementBaseObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -112,7 +112,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { throw new System.ArgumentException("Class name does not match."); } } - + // Property returns the namespace of the WMI class. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -121,7 +121,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return "ROOT\\virtualization\\v2"; } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ManagementClassName { @@ -130,7 +130,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { if ((curObj != null)) { if ((curObj.ClassPath != null)) { strRet = ((string)(curObj["__CLASS"])); - if (((strRet == null) + if (((strRet == null) || (strRet == string.Empty))) { strRet = CreatedClassName; } @@ -139,7 +139,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return strRet; } } - + // Property pointing to an embedded object to get System properties of the WMI object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -148,7 +148,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return PrivateSystemProperties; } } - + // Property returning the underlying lateBound object. [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -157,7 +157,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return curObj; } } - + // ManagementScope of the object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -176,7 +176,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + // Property to show the commit behavior for the WMI object. If true, WMI object will be automatically saved after each property modification.(ie. Put() is called after modification of a property). [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -188,7 +188,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { AutoCommitProp = value; } } - + // The ManagementPath of the underlying WMI object. [Browsable(true)] public System.Management.ManagementPath Path { @@ -209,7 +209,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + // Public static scope property which is used by the various methods. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -221,7 +221,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { statMgmtScope = value; } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public ushort[] AvailableRequestedStates { @@ -229,7 +229,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort[])(curObj["AvailableRequestedStates"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Caption { @@ -237,7 +237,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Caption"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsCommunicationStatusNull { @@ -250,7 +250,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -262,7 +262,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["CommunicationStatus"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string CreationClassName { @@ -270,7 +270,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["CreationClassName"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Description { @@ -278,7 +278,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Description"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsDetailedStatusNull { @@ -291,7 +291,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -303,7 +303,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["DetailedStatus"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ElementName { @@ -311,7 +311,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["ElementName"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsEnabledDefaultNull { @@ -324,7 +324,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -336,7 +336,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["EnabledDefault"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsEnabledStateNull { @@ -349,7 +349,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -361,7 +361,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["EnabledState"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsHealthStateNull { @@ -374,7 +374,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -386,7 +386,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["HealthState"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsInstallDateNull { @@ -399,7 +399,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -413,7 +413,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string InstanceID { @@ -421,7 +421,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["InstanceID"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Name { @@ -429,7 +429,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Name"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsOperatingStatusNull { @@ -442,7 +442,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -454,7 +454,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["OperatingStatus"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public ushort[] OperationalStatus { @@ -462,7 +462,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort[])(curObj["OperationalStatus"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string OtherEnabledState { @@ -470,7 +470,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["OtherEnabledState"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string PrimaryOwnerContact { @@ -478,7 +478,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["PrimaryOwnerContact"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string PrimaryOwnerName { @@ -486,7 +486,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["PrimaryOwnerName"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPrimaryStatusNull { @@ -499,7 +499,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -511,7 +511,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["PrimaryStatus"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsRequestedStateNull { @@ -524,7 +524,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -536,7 +536,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["RequestedState"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsStartedNull { @@ -549,7 +549,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -561,7 +561,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((bool)(curObj["Started"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string StartMode { @@ -569,7 +569,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["StartMode"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Status { @@ -577,7 +577,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Status"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string[] StatusDescriptions { @@ -585,7 +585,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string[])(curObj["StatusDescriptions"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string SystemCreationClassName { @@ -593,7 +593,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["SystemCreationClassName"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string SystemName { @@ -601,7 +601,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["SystemName"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsTimeOfLastStateChangeNull { @@ -614,7 +614,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -628,7 +628,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsTransitioningToStateNull { @@ -641,7 +641,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -653,9 +653,9 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["TransitioningToState"])); } } - + private bool CheckIfProperClass(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions OptionsParam) { - if (((path != null) + if (((path != null) && (string.Compare(path.ClassName, this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -663,9 +663,9 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return CheckIfProperClass(new System.Management.ManagementObject(mgmtScope, path, OptionsParam)); } } - + private bool CheckIfProperClass(System.Management.ManagementBaseObject theObj) { - if (((theObj != null) + if (((theObj != null) && (string.Compare(((string)(theObj["__CLASS"])), this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -682,42 +682,42 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } return false; } - + private bool ShouldSerializeCommunicationStatus() { if ((this.IsCommunicationStatusNull == false)) { return true; } return false; } - + private bool ShouldSerializeDetailedStatus() { if ((this.IsDetailedStatusNull == false)) { return true; } return false; } - + private bool ShouldSerializeEnabledDefault() { if ((this.IsEnabledDefaultNull == false)) { return true; } return false; } - + private bool ShouldSerializeEnabledState() { if ((this.IsEnabledStateNull == false)) { return true; } return false; } - + private bool ShouldSerializeHealthState() { if ((this.IsHealthStateNull == false)) { return true; } return false; } - + // Converts a given datetime in DMTF format to System.DateTime object. static System.DateTime ToDateTime(string dmtfDate) { System.DateTime initializer = System.DateTime.MinValue; @@ -769,13 +769,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { if (("******" != tempString)) { ticks = (long.Parse(tempString) * ((long)((System.TimeSpan.TicksPerMillisecond / 1000)))); } - if (((((((((year < 0) - || (month < 0)) - || (day < 0)) - || (hour < 0)) - || (minute < 0)) - || (minute < 0)) - || (second < 0)) + if (((((((((year < 0) + || (month < 0)) + || (day < 0)) + || (hour < 0)) + || (minute < 0)) + || (minute < 0)) + || (second < 0)) || (ticks < 0))) { throw new System.ArgumentOutOfRangeException(); } @@ -803,7 +803,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } return datetime; } - + // Converts a given System.DateTime object to DMTF datetime format. static string ToDmtfDateTime(System.DateTime date) { string utcString = string.Empty; @@ -830,8 +830,8 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { dmtfDateTime = string.Concat(dmtfDateTime, ((int)(date.Second)).ToString().PadLeft(2, '0')); dmtfDateTime = string.Concat(dmtfDateTime, "."); System.DateTime dtTemp = new System.DateTime(date.Year, date.Month, date.Day, date.Hour, date.Minute, date.Second, 0); - long microsec = ((long)((((date.Ticks - dtTemp.Ticks) - * 1000) + long microsec = ((long)((((date.Ticks - dtTemp.Ticks) + * 1000) / System.TimeSpan.TicksPerMillisecond))); string strMicrosec = ((long)(microsec)).ToString(); if ((strMicrosec.Length > 6)) { @@ -841,75 +841,75 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { dmtfDateTime = string.Concat(dmtfDateTime, utcString); return dmtfDateTime; } - + private bool ShouldSerializeInstallDate() { if ((this.IsInstallDateNull == false)) { return true; } return false; } - + private bool ShouldSerializeOperatingStatus() { if ((this.IsOperatingStatusNull == false)) { return true; } return false; } - + private bool ShouldSerializePrimaryStatus() { if ((this.IsPrimaryStatusNull == false)) { return true; } return false; } - + private bool ShouldSerializeRequestedState() { if ((this.IsRequestedStateNull == false)) { return true; } return false; } - + private bool ShouldSerializeStarted() { if ((this.IsStartedNull == false)) { return true; } return false; } - + private bool ShouldSerializeTimeOfLastStateChange() { if ((this.IsTimeOfLastStateChangeNull == false)) { return true; } return false; } - + private bool ShouldSerializeTransitioningToState() { if ((this.IsTransitioningToStateNull == false)) { return true; } return false; } - + [Browsable(true)] public void CommitObject() { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(); } } - + [Browsable(true)] public void CommitObject(System.Management.PutOptions putOptions) { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(putOptions); } } - + private void Initialize() { AutoCommitProp = true; isEmbedded = false; } - + private static string ConstructPath(string keyCreationClassName, string keyName, string keySystemCreationClassName, string keySystemName) { string strPath = "ROOT\\virtualization\\v2:Msvm_ImageManagementService"; strPath = string.Concat(strPath, string.Concat(".CreationClassName=", string.Concat("\"", string.Concat(keyCreationClassName, "\"")))); @@ -918,7 +918,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { strPath = string.Concat(strPath, string.Concat(",SystemName=", string.Concat("\"", string.Concat(keySystemName, "\"")))); return strPath; } - + private void InitializeObject(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { Initialize(); if ((path != null)) { @@ -930,24 +930,24 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { PrivateSystemProperties = new ManagementSystemProperties(PrivateLateBoundObject); curObj = PrivateLateBoundObject; } - + // Different overloads of GetInstances() help in enumerating instances of the WMI class. public static ImageManagementServiceCollection GetInstances() { return GetInstances(null, null, null); } - + public static ImageManagementServiceCollection GetInstances(string condition) { return GetInstances(null, condition, null); } - + public static ImageManagementServiceCollection GetInstances(string[] selectedProperties) { return GetInstances(null, null, selectedProperties); } - + public static ImageManagementServiceCollection GetInstances(string condition, string[] selectedProperties) { return GetInstances(null, condition, selectedProperties); } - + public static ImageManagementServiceCollection GetInstances(System.Management.ManagementScope mgmtScope, System.Management.EnumerationOptions enumOptions) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -968,15 +968,15 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } return new ImageManagementServiceCollection(clsObject.GetInstances(enumOptions)); } - + public static ImageManagementServiceCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition) { return GetInstances(mgmtScope, condition, null); } - + public static ImageManagementServiceCollection GetInstances(System.Management.ManagementScope mgmtScope, string[] selectedProperties) { return GetInstances(mgmtScope, null, selectedProperties); } - + public static ImageManagementServiceCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition, string[] selectedProperties) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -993,7 +993,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { ObjectSearcher.Options = enumOptions; return new ImageManagementServiceCollection(ObjectSearcher.Get()); } - + [Browsable(true)] public static ImageManagementService CreateInstance() { System.Management.ManagementScope mgmtScope = null; @@ -1008,12 +1008,12 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { System.Management.ManagementClass tmpMgmtClass = new System.Management.ManagementClass(mgmtScope, mgmtPath, null); return new ImageManagementService(tmpMgmtClass.CreateInstance()); } - + [Browsable(true)] public void Delete() { PrivateLateBoundObject.Delete(); } - + public uint AttachVirtualHardDisk(bool AssignDriveLetter, string Path, bool ReadOnly, out System.Management.ManagementPath Job) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1034,7 +1034,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint CompactVirtualHardDisk(ushort Mode, string Path, out System.Management.ManagementPath Job) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1054,7 +1054,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint ConvertVirtualHardDisk(string SourcePath, string VirtualDiskSettingData, out System.Management.ManagementPath Job) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1074,7 +1074,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint CreateVirtualFloppyDisk(string Path, out System.Management.ManagementPath Job) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1093,7 +1093,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint CreateVirtualHardDisk(string VirtualDiskSettingData, out System.Management.ManagementPath Job) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1112,7 +1112,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint GetVirtualHardDiskSettingData(string Path, out System.Management.ManagementPath Job, out string SettingData) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1133,7 +1133,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint GetVirtualHardDiskState(string Path, out System.Management.ManagementPath Job, out string State) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1154,7 +1154,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint MergeVirtualHardDisk(string DestinationPath, string SourcePath, out System.Management.ManagementPath Job) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1174,7 +1174,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint RequestStateChange(ushort RequestedState, System.DateTime TimeoutPeriod, out System.Management.ManagementPath Job) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1194,7 +1194,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint ResizeVirtualHardDisk(ulong MaxInternalSize, string Path, out System.Management.ManagementPath Job) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1214,7 +1214,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint SetParentVirtualHardDisk(string ChildPath, bool IgnoreIDMismatch, string LeafPath, string ParentPath, out System.Management.ManagementPath Job) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1236,7 +1236,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint SetVirtualHardDiskSettingData(string VirtualDiskSettingData, out System.Management.ManagementPath Job) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1255,7 +1255,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint StartService() { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1266,7 +1266,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint StopService() { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1277,7 +1277,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint ValidateVirtualHardDisk(string Path, out System.Management.ManagementPath Job) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1296,34 +1296,34 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + // Enumerator implementation for enumerating instances of the class. public class ImageManagementServiceCollection : object, ICollection { - + private ManagementObjectCollection privColObj; - + public ImageManagementServiceCollection(ManagementObjectCollection objCollection) { privColObj = objCollection; } - + public virtual int Count { get { return privColObj.Count; } } - + public virtual bool IsSynchronized { get { return privColObj.IsSynchronized; } } - + public virtual object SyncRoot { get { return this; } } - + public virtual void CopyTo(System.Array array, int index) { privColObj.CopyTo(array, index); int nCtr; @@ -1331,189 +1331,189 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { array.SetValue(new ImageManagementService(((System.Management.ManagementObject)(array.GetValue(nCtr)))), nCtr); } } - + public virtual System.Collections.IEnumerator GetEnumerator() { return new ImageManagementServiceEnumerator(privColObj.GetEnumerator()); } - + public class ImageManagementServiceEnumerator : object, System.Collections.IEnumerator { - + private ManagementObjectCollection.ManagementObjectEnumerator privObjEnum; - + public ImageManagementServiceEnumerator(ManagementObjectCollection.ManagementObjectEnumerator objEnum) { privObjEnum = objEnum; } - + public virtual object Current { get { return new ImageManagementService(((System.Management.ManagementObject)(privObjEnum.Current))); } } - + public virtual bool MoveNext() { return privObjEnum.MoveNext(); } - + public virtual void Reset() { privObjEnum.Reset(); } } } - + // TypeConverter to handle null values for ValueType properties public class WMIValueTypeConverter : TypeConverter { - + private TypeConverter baseConverter; - + private System.Type baseType; - + public WMIValueTypeConverter(System.Type inBaseType) { baseConverter = TypeDescriptor.GetConverter(inBaseType); baseType = inBaseType; } - + 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 ((baseType.BaseType == typeof(System.Enum))) { if ((value.GetType() == destinationType)) { return value; } - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return "NULL_ENUM_VALUE" ; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((baseType == typeof(bool)) + if (((baseType == typeof(bool)) && (baseType.BaseType == typeof(System.ValueType)))) { - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((context != null) + if (((context != null) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } } - + // Embedded class to represent WMI system Properties. [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 { diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_KvpExchangeComponent.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_KvpExchangeComponent.cs index 976da28136f..016ad188574 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_KvpExchangeComponent.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_KvpExchangeComponent.cs @@ -24,8 +24,8 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 using System.Globalization; using System.ComponentModel.Design.Serialization; using System.Reflection; - - + + // Functions ShouldSerialize are functions used by VS property browser to check if a particular property has to be serialized. These functions are added for all ValueType properties ( properties of type Int32, BOOL etc.. which cannot be set to null). These functions use IsNull function. These functions are also used in the TypeConverter implementation for the properties to check for NULL value of property so that an empty value can be shown in Property browser in case of Drag and Drop in Visual studio. // Functions IsNull() are used to check if a property is NULL. // Functions Reset are added for Nullable Read/Write properties. These functions are used by VS designer in property browser to set a property to NULL. @@ -33,62 +33,62 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 // Datetime conversion functions ToDateTime and ToDmtfDateTime are added to the class to convert DMTF datetime to System.DateTime and vice-versa. // An Early Bound class generated for the WMI class.Msvm_KvpExchangeComponent public class KvpExchangeComponent : System.ComponentModel.Component { - + // Private property to hold the WMI namespace in which the class resides. private static string CreatedWmiNamespace = "ROOT\\virtualization\\v2"; - + // Private property to hold the name of WMI class which created this class. private static string CreatedClassName = "Msvm_KvpExchangeComponent"; - + // Private member variable to hold the ManagementScope which is used by the various methods. private static System.Management.ManagementScope statMgmtScope = null; - + private ManagementSystemProperties PrivateSystemProperties; - + // Underlying lateBound WMI object. private System.Management.ManagementObject PrivateLateBoundObject; - + // Member variable to store the 'automatic commit' behavior for the class. private bool AutoCommitProp; - + // Private variable to hold the embedded property representing the instance. private System.Management.ManagementBaseObject embeddedObj; - + // The current WMI object used private System.Management.ManagementBaseObject curObj; - + // Flag to indicate if the instance is an embedded object. private bool isEmbedded; - + // Below are different overloads of constructors to initialize an instance of the class with a WMI object. public KvpExchangeComponent() { this.InitializeObject(null, null, null); } - + public KvpExchangeComponent(string keyCreationClassName, string keyDeviceID, string keySystemCreationClassName, string keySystemName) { this.InitializeObject(null, new System.Management.ManagementPath(KvpExchangeComponent.ConstructPath(keyCreationClassName, keyDeviceID, keySystemCreationClassName, keySystemName)), null); } - + public KvpExchangeComponent(System.Management.ManagementScope mgmtScope, string keyCreationClassName, string keyDeviceID, string keySystemCreationClassName, string keySystemName) { this.InitializeObject(((System.Management.ManagementScope)(mgmtScope)), new System.Management.ManagementPath(KvpExchangeComponent.ConstructPath(keyCreationClassName, keyDeviceID, keySystemCreationClassName, keySystemName)), null); } - + public KvpExchangeComponent(System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(null, path, getOptions); } - + public KvpExchangeComponent(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path) { this.InitializeObject(mgmtScope, path, null); } - + public KvpExchangeComponent(System.Management.ManagementPath path) { this.InitializeObject(null, path, null); } - + public KvpExchangeComponent(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(mgmtScope, path, getOptions); } - + public KvpExchangeComponent(System.Management.ManagementObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -100,7 +100,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 throw new System.ArgumentException("Class name does not match."); } } - + public KvpExchangeComponent(System.Management.ManagementBaseObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -113,7 +113,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 throw new System.ArgumentException("Class name does not match."); } } - + // Property returns the namespace of the WMI class. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -122,7 +122,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return "ROOT\\virtualization\\v2"; } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ManagementClassName { @@ -131,7 +131,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 if ((curObj != null)) { if ((curObj.ClassPath != null)) { strRet = ((string)(curObj["__CLASS"])); - if (((strRet == null) + if (((strRet == null) || (strRet == string.Empty))) { strRet = CreatedClassName; } @@ -140,7 +140,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return strRet; } } - + // Property pointing to an embedded object to get System properties of the WMI object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -149,7 +149,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return PrivateSystemProperties; } } - + // Property returning the underlying lateBound object. [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -158,7 +158,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return curObj; } } - + // ManagementScope of the object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -177,7 +177,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + // Property to show the commit behavior for the WMI object. If true, WMI object will be automatically saved after each property modification.(ie. Put() is called after modification of a property). [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -189,7 +189,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 AutoCommitProp = value; } } - + // The ManagementPath of the underlying WMI object. [Browsable(true)] public System.Management.ManagementPath Path { @@ -210,7 +210,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + // Public static scope property which is used by the various methods. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -222,7 +222,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 statMgmtScope = value; } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public ushort[] AdditionalAvailability { @@ -230,7 +230,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((ushort[])(curObj["AdditionalAvailability"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsAvailabilityNull { @@ -243,7 +243,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -255,7 +255,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((ushort)(curObj["Availability"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public ushort[] AvailableRequestedStates { @@ -263,7 +263,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((ushort[])(curObj["AvailableRequestedStates"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Caption { @@ -271,7 +271,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string)(curObj["Caption"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsCommunicationStatusNull { @@ -284,7 +284,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -296,7 +296,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((ushort)(curObj["CommunicationStatus"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string CreationClassName { @@ -304,7 +304,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string)(curObj["CreationClassName"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Description { @@ -312,7 +312,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string)(curObj["Description"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsDetailedStatusNull { @@ -325,7 +325,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -337,7 +337,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((ushort)(curObj["DetailedStatus"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string DeviceID { @@ -345,7 +345,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string)(curObj["DeviceID"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ElementName { @@ -353,7 +353,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string)(curObj["ElementName"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsEnabledDefaultNull { @@ -366,7 +366,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -378,7 +378,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((ushort)(curObj["EnabledDefault"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsEnabledStateNull { @@ -391,7 +391,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -403,7 +403,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((ushort)(curObj["EnabledState"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsErrorClearedNull { @@ -416,7 +416,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -428,7 +428,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((bool)(curObj["ErrorCleared"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ErrorDescription { @@ -436,7 +436,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string)(curObj["ErrorDescription"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"An array of embedded Msvm_KvpExchangeDataItem instances which contain the set of key-value pairs that components running within the guest operating system have pushed up to be available for access by external clients. This array will not contain any intrinsic items that are pushed by the integration component directly.")] @@ -445,7 +445,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string[])(curObj["GuestExchangeItems"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"An array of embedded Msvm_KvpExchangeDataItem instances which contain the set of key-value pairs that the guest operating system has pushed up to be available for access by external clients. This array will not contain any data items pushed by other components running within the guest operating system.")] @@ -454,7 +454,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string[])(curObj["GuestIntrinsicExchangeItems"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsHealthStateNull { @@ -467,7 +467,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -479,7 +479,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((ushort)(curObj["HealthState"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string[] IdentifyingDescriptions { @@ -487,7 +487,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string[])(curObj["IdentifyingDescriptions"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsInstallDateNull { @@ -500,7 +500,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -514,7 +514,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string InstanceID { @@ -522,7 +522,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string)(curObj["InstanceID"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsLastErrorCodeNull { @@ -535,7 +535,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -547,7 +547,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((uint)(curObj["LastErrorCode"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsMaxQuiesceTimeNull { @@ -560,7 +560,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -572,7 +572,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((ulong)(curObj["MaxQuiesceTime"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Name { @@ -580,7 +580,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string)(curObj["Name"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsOperatingStatusNull { @@ -593,7 +593,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -605,7 +605,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((ushort)(curObj["OperatingStatus"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public ushort[] OperationalStatus { @@ -613,7 +613,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((ushort[])(curObj["OperationalStatus"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string OtherEnabledState { @@ -621,7 +621,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string)(curObj["OtherEnabledState"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string[] OtherIdentifyingInfo { @@ -629,7 +629,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string[])(curObj["OtherIdentifyingInfo"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public ushort[] PowerManagementCapabilities { @@ -637,7 +637,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((ushort[])(curObj["PowerManagementCapabilities"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPowerManagementSupportedNull { @@ -650,7 +650,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -662,7 +662,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((bool)(curObj["PowerManagementSupported"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPowerOnHoursNull { @@ -675,7 +675,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -687,7 +687,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((ulong)(curObj["PowerOnHours"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPrimaryStatusNull { @@ -700,7 +700,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -712,7 +712,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((ushort)(curObj["PrimaryStatus"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsRequestedStateNull { @@ -725,7 +725,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -737,7 +737,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((ushort)(curObj["RequestedState"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Status { @@ -745,7 +745,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string)(curObj["Status"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string[] StatusDescriptions { @@ -753,7 +753,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string[])(curObj["StatusDescriptions"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsStatusInfoNull { @@ -766,7 +766,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -778,7 +778,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((ushort)(curObj["StatusInfo"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string SystemCreationClassName { @@ -786,7 +786,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string)(curObj["SystemCreationClassName"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string SystemName { @@ -794,7 +794,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string)(curObj["SystemName"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsTimeOfLastStateChangeNull { @@ -807,7 +807,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -821,7 +821,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsTotalPowerOnHoursNull { @@ -834,7 +834,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -846,7 +846,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((ulong)(curObj["TotalPowerOnHours"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsTransitioningToStateNull { @@ -859,7 +859,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -871,9 +871,9 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((ushort)(curObj["TransitioningToState"])); } } - + private bool CheckIfProperClass(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions OptionsParam) { - if (((path != null) + if (((path != null) && (string.Compare(path.ClassName, this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -881,9 +881,9 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return CheckIfProperClass(new System.Management.ManagementObject(mgmtScope, path, OptionsParam)); } } - + private bool CheckIfProperClass(System.Management.ManagementBaseObject theObj) { - if (((theObj != null) + if (((theObj != null) && (string.Compare(((string)(theObj["__CLASS"])), this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -900,56 +900,56 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } return false; } - + private bool ShouldSerializeAvailability() { if ((this.IsAvailabilityNull == false)) { return true; } return false; } - + private bool ShouldSerializeCommunicationStatus() { if ((this.IsCommunicationStatusNull == false)) { return true; } return false; } - + private bool ShouldSerializeDetailedStatus() { if ((this.IsDetailedStatusNull == false)) { return true; } return false; } - + private bool ShouldSerializeEnabledDefault() { if ((this.IsEnabledDefaultNull == false)) { return true; } return false; } - + private bool ShouldSerializeEnabledState() { if ((this.IsEnabledStateNull == false)) { return true; } return false; } - + private bool ShouldSerializeErrorCleared() { if ((this.IsErrorClearedNull == false)) { return true; } return false; } - + private bool ShouldSerializeHealthState() { if ((this.IsHealthStateNull == false)) { return true; } return false; } - + // Converts a given datetime in DMTF format to System.DateTime object. static System.DateTime ToDateTime(string dmtfDate) { System.DateTime initializer = System.DateTime.MinValue; @@ -1001,13 +1001,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 if (("******" != tempString)) { ticks = (long.Parse(tempString) * ((long)((System.TimeSpan.TicksPerMillisecond / 1000)))); } - if (((((((((year < 0) - || (month < 0)) - || (day < 0)) - || (hour < 0)) - || (minute < 0)) - || (minute < 0)) - || (second < 0)) + if (((((((((year < 0) + || (month < 0)) + || (day < 0)) + || (hour < 0)) + || (minute < 0)) + || (minute < 0)) + || (second < 0)) || (ticks < 0))) { throw new System.ArgumentOutOfRangeException(); } @@ -1035,7 +1035,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } return datetime; } - + // Converts a given System.DateTime object to DMTF datetime format. static string ToDmtfDateTime(System.DateTime date) { string utcString = string.Empty; @@ -1062,8 +1062,8 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 dmtfDateTime = string.Concat(dmtfDateTime, ((int)(date.Second)).ToString().PadLeft(2, '0')); dmtfDateTime = string.Concat(dmtfDateTime, "."); System.DateTime dtTemp = new System.DateTime(date.Year, date.Month, date.Day, date.Hour, date.Minute, date.Second, 0); - long microsec = ((long)((((date.Ticks - dtTemp.Ticks) - * 1000) + long microsec = ((long)((((date.Ticks - dtTemp.Ticks) + * 1000) / System.TimeSpan.TicksPerMillisecond))); string strMicrosec = ((long)(microsec)).ToString(); if ((strMicrosec.Length > 6)) { @@ -1073,110 +1073,110 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 dmtfDateTime = string.Concat(dmtfDateTime, utcString); return dmtfDateTime; } - + private bool ShouldSerializeInstallDate() { if ((this.IsInstallDateNull == false)) { return true; } return false; } - + private bool ShouldSerializeLastErrorCode() { if ((this.IsLastErrorCodeNull == false)) { return true; } return false; } - + private bool ShouldSerializeMaxQuiesceTime() { if ((this.IsMaxQuiesceTimeNull == false)) { return true; } return false; } - + private bool ShouldSerializeOperatingStatus() { if ((this.IsOperatingStatusNull == false)) { return true; } return false; } - + private bool ShouldSerializePowerManagementSupported() { if ((this.IsPowerManagementSupportedNull == false)) { return true; } return false; } - + private bool ShouldSerializePowerOnHours() { if ((this.IsPowerOnHoursNull == false)) { return true; } return false; } - + private bool ShouldSerializePrimaryStatus() { if ((this.IsPrimaryStatusNull == false)) { return true; } return false; } - + private bool ShouldSerializeRequestedState() { if ((this.IsRequestedStateNull == false)) { return true; } return false; } - + private bool ShouldSerializeStatusInfo() { if ((this.IsStatusInfoNull == false)) { return true; } return false; } - + private bool ShouldSerializeTimeOfLastStateChange() { if ((this.IsTimeOfLastStateChangeNull == false)) { return true; } return false; } - + private bool ShouldSerializeTotalPowerOnHours() { if ((this.IsTotalPowerOnHoursNull == false)) { return true; } return false; } - + private bool ShouldSerializeTransitioningToState() { if ((this.IsTransitioningToStateNull == false)) { return true; } return false; } - + [Browsable(true)] public void CommitObject() { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(); } } - + [Browsable(true)] public void CommitObject(System.Management.PutOptions putOptions) { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(putOptions); } } - + private void Initialize() { AutoCommitProp = true; isEmbedded = false; } - + private static string ConstructPath(string keyCreationClassName, string keyDeviceID, string keySystemCreationClassName, string keySystemName) { string strPath = "ROOT\\virtualization\\v2:Msvm_KvpExchangeComponent"; strPath = string.Concat(strPath, string.Concat(".CreationClassName=", string.Concat("\"", string.Concat(keyCreationClassName, "\"")))); @@ -1185,7 +1185,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 strPath = string.Concat(strPath, string.Concat(",SystemName=", string.Concat("\"", string.Concat(keySystemName, "\"")))); return strPath; } - + private void InitializeObject(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { Initialize(); if ((path != null)) { @@ -1197,24 +1197,24 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 PrivateSystemProperties = new ManagementSystemProperties(PrivateLateBoundObject); curObj = PrivateLateBoundObject; } - + // Different overloads of GetInstances() help in enumerating instances of the WMI class. public static KvpExchangeComponentCollection GetInstances() { return GetInstances(null, null, null); } - + public static KvpExchangeComponentCollection GetInstances(string condition) { return GetInstances(null, condition, null); } - + public static KvpExchangeComponentCollection GetInstances(string[] selectedProperties) { return GetInstances(null, null, selectedProperties); } - + public static KvpExchangeComponentCollection GetInstances(string condition, string[] selectedProperties) { return GetInstances(null, condition, selectedProperties); } - + public static KvpExchangeComponentCollection GetInstances(System.Management.ManagementScope mgmtScope, System.Management.EnumerationOptions enumOptions) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -1235,15 +1235,15 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } return new KvpExchangeComponentCollection(clsObject.GetInstances(enumOptions)); } - + public static KvpExchangeComponentCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition) { return GetInstances(mgmtScope, condition, null); } - + public static KvpExchangeComponentCollection GetInstances(System.Management.ManagementScope mgmtScope, string[] selectedProperties) { return GetInstances(mgmtScope, null, selectedProperties); } - + public static KvpExchangeComponentCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition, string[] selectedProperties) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -1260,7 +1260,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 ObjectSearcher.Options = enumOptions; return new KvpExchangeComponentCollection(ObjectSearcher.Get()); } - + [Browsable(true)] public static KvpExchangeComponent CreateInstance() { System.Management.ManagementScope mgmtScope = null; @@ -1275,12 +1275,12 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 System.Management.ManagementClass tmpMgmtClass = new System.Management.ManagementClass(mgmtScope, mgmtPath, null); return new KvpExchangeComponent(tmpMgmtClass.CreateInstance()); } - + [Browsable(true)] public void Delete() { PrivateLateBoundObject.Delete(); } - + public uint EnableDevice(bool Enabled) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1293,7 +1293,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return System.Convert.ToUInt32(0); } } - + public uint OnlineDevice(bool Online) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1306,7 +1306,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return System.Convert.ToUInt32(0); } } - + public uint QuiesceDevice(bool Quiesce) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1319,7 +1319,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return System.Convert.ToUInt32(0); } } - + public uint RequestStateChange(ushort RequestedState, System.DateTime TimeoutPeriod, out System.Management.ManagementPath Job) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1339,7 +1339,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return System.Convert.ToUInt32(0); } } - + public uint Reset() { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1350,7 +1350,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return System.Convert.ToUInt32(0); } } - + public uint RestoreProperties() { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1361,7 +1361,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return System.Convert.ToUInt32(0); } } - + public uint SaveProperties() { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1372,7 +1372,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return System.Convert.ToUInt32(0); } } - + public uint SetPowerState(ushort PowerState, System.DateTime Time) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1386,34 +1386,34 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return System.Convert.ToUInt32(0); } } - + // Enumerator implementation for enumerating instances of the class. public class KvpExchangeComponentCollection : object, ICollection { - + private ManagementObjectCollection privColObj; - + public KvpExchangeComponentCollection(ManagementObjectCollection objCollection) { privColObj = objCollection; } - + public virtual int Count { get { return privColObj.Count; } } - + public virtual bool IsSynchronized { get { return privColObj.IsSynchronized; } } - + public virtual object SyncRoot { get { return this; } } - + public virtual void CopyTo(System.Array array, int index) { privColObj.CopyTo(array, index); int nCtr; @@ -1421,189 +1421,189 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 array.SetValue(new KvpExchangeComponent(((System.Management.ManagementObject)(array.GetValue(nCtr)))), nCtr); } } - + public virtual System.Collections.IEnumerator GetEnumerator() { return new KvpExchangeComponentEnumerator(privColObj.GetEnumerator()); } - + public class KvpExchangeComponentEnumerator : object, System.Collections.IEnumerator { - + private ManagementObjectCollection.ManagementObjectEnumerator privObjEnum; - + public KvpExchangeComponentEnumerator(ManagementObjectCollection.ManagementObjectEnumerator objEnum) { privObjEnum = objEnum; } - + public virtual object Current { get { return new KvpExchangeComponent(((System.Management.ManagementObject)(privObjEnum.Current))); } } - + public virtual bool MoveNext() { return privObjEnum.MoveNext(); } - + public virtual void Reset() { privObjEnum.Reset(); } } } - + // TypeConverter to handle null values for ValueType properties public class WMIValueTypeConverter : TypeConverter { - + private TypeConverter baseConverter; - + private System.Type baseType; - + public WMIValueTypeConverter(System.Type inBaseType) { baseConverter = TypeDescriptor.GetConverter(inBaseType); baseType = inBaseType; } - + 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 ((baseType.BaseType == typeof(System.Enum))) { if ((value.GetType() == destinationType)) { return value; } - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return "NULL_ENUM_VALUE" ; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((baseType == typeof(bool)) + if (((baseType == typeof(bool)) && (baseType.BaseType == typeof(System.ValueType)))) { - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((context != null) + if (((context != null) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } } - + // Embedded class to represent WMI system Properties. [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 { diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_KvpExchangeComponentSettingData.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_KvpExchangeComponentSettingData.cs index 4e704e02354..81c562bd173 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_KvpExchangeComponentSettingData.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_KvpExchangeComponentSettingData.cs @@ -24,70 +24,70 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 using System.Globalization; using System.ComponentModel.Design.Serialization; using System.Reflection; - - + + // Functions ShouldSerialize are functions used by VS property browser to check if a particular property has to be serialized. These functions are added for all ValueType properties ( properties of type Int32, BOOL etc.. which cannot be set to null). These functions use IsNull function. These functions are also used in the TypeConverter implementation for the properties to check for NULL value of property so that an empty value can be shown in Property browser in case of Drag and Drop in Visual studio. // Functions IsNull() are used to check if a property is NULL. // Functions Reset are added for Nullable Read/Write properties. These functions are used by VS designer in property browser to set a property to NULL. // Every property added to the class for WMI property has attributes set to define its behavior in Visual Studio designer and also to define a TypeConverter to be used. // An Early Bound class generated for the WMI class.Msvm_KvpExchangeComponentSettingData public class KvpExchangeComponentSettingData : System.ComponentModel.Component { - + // Private property to hold the WMI namespace in which the class resides. private static string CreatedWmiNamespace = "ROOT\\virtualization\\v2"; - + // Private property to hold the name of WMI class which created this class. public static string CreatedClassName = "Msvm_KvpExchangeComponentSettingData"; - + // Private member variable to hold the ManagementScope which is used by the various methods. private static System.Management.ManagementScope statMgmtScope = null; - + private ManagementSystemProperties PrivateSystemProperties; - + // Underlying lateBound WMI object. private System.Management.ManagementObject PrivateLateBoundObject; - + // Member variable to store the 'automatic commit' behavior for the class. private bool AutoCommitProp; - + // Private variable to hold the embedded property representing the instance. private System.Management.ManagementBaseObject embeddedObj; - + // The current WMI object used private System.Management.ManagementBaseObject curObj; - + // Flag to indicate if the instance is an embedded object. private bool isEmbedded; - + // Below are different overloads of constructors to initialize an instance of the class with a WMI object. public KvpExchangeComponentSettingData() { this.InitializeObject(null, null, null); } - + public KvpExchangeComponentSettingData(string keyInstanceID) { this.InitializeObject(null, new System.Management.ManagementPath(KvpExchangeComponentSettingData.ConstructPath(keyInstanceID)), null); } - + public KvpExchangeComponentSettingData(System.Management.ManagementScope mgmtScope, string keyInstanceID) { this.InitializeObject(((System.Management.ManagementScope)(mgmtScope)), new System.Management.ManagementPath(KvpExchangeComponentSettingData.ConstructPath(keyInstanceID)), null); } - + public KvpExchangeComponentSettingData(System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(null, path, getOptions); } - + public KvpExchangeComponentSettingData(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path) { this.InitializeObject(mgmtScope, path, null); } - + public KvpExchangeComponentSettingData(System.Management.ManagementPath path) { this.InitializeObject(null, path, null); } - + public KvpExchangeComponentSettingData(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(mgmtScope, path, getOptions); } - + public KvpExchangeComponentSettingData(System.Management.ManagementObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -99,7 +99,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 throw new System.ArgumentException("Class name does not match."); } } - + public KvpExchangeComponentSettingData(System.Management.ManagementBaseObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -112,7 +112,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 throw new System.ArgumentException("Class name does not match."); } } - + // Property returns the namespace of the WMI class. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -121,7 +121,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return "ROOT\\virtualization\\v2"; } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ManagementClassName { @@ -130,7 +130,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 if ((curObj != null)) { if ((curObj.ClassPath != null)) { strRet = ((string)(curObj["__CLASS"])); - if (((strRet == null) + if (((strRet == null) || (strRet == string.Empty))) { strRet = CreatedClassName; } @@ -139,7 +139,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return strRet; } } - + // Property pointing to an embedded object to get System properties of the WMI object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -148,7 +148,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return PrivateSystemProperties; } } - + // Property returning the underlying lateBound object. [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -157,7 +157,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return curObj; } } - + // ManagementScope of the object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -176,7 +176,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + // Property to show the commit behavior for the WMI object. If true, WMI object will be automatically saved after each property modification.(ie. Put() is called after modification of a property). [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -188,7 +188,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 AutoCommitProp = value; } } - + // The ManagementPath of the underlying WMI object. [Browsable(true)] public System.Management.ManagementPath Path { @@ -209,7 +209,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + // Public static scope property which is used by the various methods. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -221,7 +221,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 statMgmtScope = value; } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Address { @@ -229,7 +229,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string)(curObj["Address"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string AddressOnParent { @@ -237,7 +237,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string)(curObj["AddressOnParent"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string AllocationUnits { @@ -245,7 +245,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string)(curObj["AllocationUnits"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsAutomaticAllocationNull { @@ -258,7 +258,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -270,7 +270,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((bool)(curObj["AutomaticAllocation"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsAutomaticDeallocationNull { @@ -283,7 +283,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -295,7 +295,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((bool)(curObj["AutomaticDeallocation"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Caption { @@ -303,7 +303,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string)(curObj["Caption"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string[] Connection { @@ -311,7 +311,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string[])(curObj["Connection"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsConsumerVisibilityNull { @@ -324,7 +324,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -336,7 +336,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((ushort)(curObj["ConsumerVisibility"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Description { @@ -344,7 +344,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string)(curObj["Description"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ElementName { @@ -352,7 +352,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string)(curObj["ElementName"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsEnabledStateNull { @@ -365,7 +365,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"The enabled and disabled states of an element. @@ -380,7 +380,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste return ((ushort)(curObj["EnabledState"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("An array of Msvm_KvpExchangeDataItem instances.\nThis is a read-only property, but" + @@ -391,7 +391,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste return ((string[])(curObj["HostExchangeItems"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"An array of Msvm_KvpExchangeDataItem instances containing the key/value pairs that are stored in the configuration file but not exchanged with the guest OS. This allows applications to store VM-specific data that does not need to be visible to the guest OS. The items are formatted the same as the items in the HostExchangeItems property except the Source property of the Msvm_KvpExchangeDataItem instance is set to 4. Each configuration file is limited to 128 key/value pairs, where each value field is allowed to be up to 16 KB in size and the key field is allowed to be up to512 bytes.")] @@ -400,7 +400,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste return ((string[])(curObj["HostOnlyItems"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string[] HostResource { @@ -408,7 +408,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste return ((string[])(curObj["HostResource"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string InstanceID { @@ -416,7 +416,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste return ((string)(curObj["InstanceID"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsLimitNull { @@ -429,7 +429,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -441,7 +441,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste return ((ulong)(curObj["Limit"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsMappingBehaviorNull { @@ -454,7 +454,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -466,7 +466,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste return ((ushort)(curObj["MappingBehavior"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string OtherResourceType { @@ -474,7 +474,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste return ((string)(curObj["OtherResourceType"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Parent { @@ -482,7 +482,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste return ((string)(curObj["Parent"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string PoolID { @@ -490,7 +490,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste return ((string)(curObj["PoolID"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsReservationNull { @@ -503,7 +503,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -515,7 +515,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste return ((ulong)(curObj["Reservation"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ResourceSubType { @@ -523,7 +523,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste return ((string)(curObj["ResourceSubType"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsResourceTypeNull { @@ -536,7 +536,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -548,7 +548,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste return ((ushort)(curObj["ResourceType"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsVirtualQuantityNull { @@ -561,7 +561,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -573,7 +573,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste return ((ulong)(curObj["VirtualQuantity"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string VirtualQuantityUnits { @@ -581,7 +581,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste return ((string)(curObj["VirtualQuantityUnits"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsWeightNull { @@ -594,7 +594,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -606,9 +606,9 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste return ((uint)(curObj["Weight"])); } } - + private bool CheckIfProperClass(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions OptionsParam) { - if (((path != null) + if (((path != null) && (string.Compare(path.ClassName, this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -616,9 +616,9 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste return CheckIfProperClass(new System.Management.ManagementObject(mgmtScope, path, OptionsParam)); } } - + private bool CheckIfProperClass(System.Management.ManagementBaseObject theObj) { - if (((theObj != null) + if (((theObj != null) && (string.Compare(((string)(theObj["__CLASS"])), this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -635,102 +635,102 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste } return false; } - + private bool ShouldSerializeAutomaticAllocation() { if ((this.IsAutomaticAllocationNull == false)) { return true; } return false; } - + private bool ShouldSerializeAutomaticDeallocation() { if ((this.IsAutomaticDeallocationNull == false)) { return true; } return false; } - + private bool ShouldSerializeConsumerVisibility() { if ((this.IsConsumerVisibilityNull == false)) { return true; } return false; } - + private bool ShouldSerializeEnabledState() { if ((this.IsEnabledStateNull == false)) { return true; } return false; } - + private bool ShouldSerializeLimit() { if ((this.IsLimitNull == false)) { return true; } return false; } - + private bool ShouldSerializeMappingBehavior() { if ((this.IsMappingBehaviorNull == false)) { return true; } return false; } - + private bool ShouldSerializeReservation() { if ((this.IsReservationNull == false)) { return true; } return false; } - + private bool ShouldSerializeResourceType() { if ((this.IsResourceTypeNull == false)) { return true; } return false; } - + private bool ShouldSerializeVirtualQuantity() { if ((this.IsVirtualQuantityNull == false)) { return true; } return false; } - + private bool ShouldSerializeWeight() { if ((this.IsWeightNull == false)) { return true; } return false; } - + [Browsable(true)] public void CommitObject() { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(); } } - + [Browsable(true)] public void CommitObject(System.Management.PutOptions putOptions) { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(putOptions); } } - + private void Initialize() { AutoCommitProp = true; isEmbedded = false; } - + private static string ConstructPath(string keyInstanceID) { string strPath = "ROOT\\virtualization\\v2:Msvm_KvpExchangeComponentSettingData"; strPath = string.Concat(strPath, string.Concat(".InstanceID=", string.Concat("\"", string.Concat(keyInstanceID, "\"")))); return strPath; } - + private void InitializeObject(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { Initialize(); if ((path != null)) { @@ -742,24 +742,24 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste PrivateSystemProperties = new ManagementSystemProperties(PrivateLateBoundObject); curObj = PrivateLateBoundObject; } - + // Different overloads of GetInstances() help in enumerating instances of the WMI class. public static KvpExchangeComponentSettingDataCollection GetInstances() { return GetInstances(null, null, null); } - + public static KvpExchangeComponentSettingDataCollection GetInstances(string condition) { return GetInstances(null, condition, null); } - + public static KvpExchangeComponentSettingDataCollection GetInstances(string[] selectedProperties) { return GetInstances(null, null, selectedProperties); } - + public static KvpExchangeComponentSettingDataCollection GetInstances(string condition, string[] selectedProperties) { return GetInstances(null, condition, selectedProperties); } - + public static KvpExchangeComponentSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, System.Management.EnumerationOptions enumOptions) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -780,15 +780,15 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste } return new KvpExchangeComponentSettingDataCollection(clsObject.GetInstances(enumOptions)); } - + public static KvpExchangeComponentSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition) { return GetInstances(mgmtScope, condition, null); } - + public static KvpExchangeComponentSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string[] selectedProperties) { return GetInstances(mgmtScope, null, selectedProperties); } - + public static KvpExchangeComponentSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition, string[] selectedProperties) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -805,7 +805,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste ObjectSearcher.Options = enumOptions; return new KvpExchangeComponentSettingDataCollection(ObjectSearcher.Get()); } - + [Browsable(true)] public static KvpExchangeComponentSettingData CreateInstance() { System.Management.ManagementScope mgmtScope = null; @@ -820,39 +820,39 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste System.Management.ManagementClass tmpMgmtClass = new System.Management.ManagementClass(mgmtScope, mgmtPath, null); return new KvpExchangeComponentSettingData(tmpMgmtClass.CreateInstance()); } - + [Browsable(true)] public void Delete() { PrivateLateBoundObject.Delete(); } - + // Enumerator implementation for enumerating instances of the class. public class KvpExchangeComponentSettingDataCollection : object, ICollection { - + private ManagementObjectCollection privColObj; - + public KvpExchangeComponentSettingDataCollection(ManagementObjectCollection objCollection) { privColObj = objCollection; } - + public virtual int Count { get { return privColObj.Count; } } - + public virtual bool IsSynchronized { get { return privColObj.IsSynchronized; } } - + public virtual object SyncRoot { get { return this; } } - + public virtual void CopyTo(System.Array array, int index) { privColObj.CopyTo(array, index); int nCtr; @@ -860,189 +860,189 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste array.SetValue(new KvpExchangeComponentSettingData(((System.Management.ManagementObject)(array.GetValue(nCtr)))), nCtr); } } - + public virtual System.Collections.IEnumerator GetEnumerator() { return new KvpExchangeComponentSettingDataEnumerator(privColObj.GetEnumerator()); } - + public class KvpExchangeComponentSettingDataEnumerator : object, System.Collections.IEnumerator { - + private ManagementObjectCollection.ManagementObjectEnumerator privObjEnum; - + public KvpExchangeComponentSettingDataEnumerator(ManagementObjectCollection.ManagementObjectEnumerator objEnum) { privObjEnum = objEnum; } - + public virtual object Current { get { return new KvpExchangeComponentSettingData(((System.Management.ManagementObject)(privObjEnum.Current))); } } - + public virtual bool MoveNext() { return privObjEnum.MoveNext(); } - + public virtual void Reset() { privObjEnum.Reset(); } } } - + // TypeConverter to handle null values for ValueType properties public class WMIValueTypeConverter : TypeConverter { - + private TypeConverter baseConverter; - + private System.Type baseType; - + public WMIValueTypeConverter(System.Type inBaseType) { baseConverter = TypeDescriptor.GetConverter(inBaseType); baseType = inBaseType; } - + 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 ((baseType.BaseType == typeof(System.Enum))) { if ((value.GetType() == destinationType)) { return value; } - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return "NULL_ENUM_VALUE" ; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((baseType == typeof(bool)) + if (((baseType == typeof(bool)) && (baseType.BaseType == typeof(System.ValueType)))) { - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((context != null) + if (((context != null) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } } - + // Embedded class to represent WMI system Properties. [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 { diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_KvpExchangeDataItem.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_KvpExchangeDataItem.cs index f076f790277..58f3dff6816 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_KvpExchangeDataItem.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_KvpExchangeDataItem.cs @@ -24,62 +24,62 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 using System.Globalization; using System.ComponentModel.Design.Serialization; using System.Reflection; - - + + // Functions ShouldSerialize are functions used by VS property browser to check if a particular property has to be serialized. These functions are added for all ValueType properties ( properties of type Int32, BOOL etc.. which cannot be set to null). These functions use IsNull function. These functions are also used in the TypeConverter implementation for the properties to check for NULL value of property so that an empty value can be shown in Property browser in case of Drag and Drop in Visual studio. // Functions IsNull() are used to check if a property is NULL. // Functions Reset are added for Nullable Read/Write properties. These functions are used by VS designer in property browser to set a property to NULL. // Every property added to the class for WMI property has attributes set to define its behavior in Visual Studio designer and also to define a TypeConverter to be used. // An Early Bound class generated for the WMI class.Msvm_KvpExchangeDataItem public class KvpExchangeDataItem : System.ComponentModel.Component { - + // Private property to hold the WMI namespace in which the class resides. private static string CreatedWmiNamespace = "ROOT\\virtualization\\v2"; - + // Private property to hold the name of WMI class which created this class. private static string CreatedClassName = "Msvm_KvpExchangeDataItem"; - + // Private member variable to hold the ManagementScope which is used by the various methods. private static System.Management.ManagementScope statMgmtScope = null; - + private ManagementSystemProperties PrivateSystemProperties; - + // Underlying lateBound WMI object. private System.Management.ManagementObject PrivateLateBoundObject; - + // Member variable to store the 'automatic commit' behavior for the class. private bool AutoCommitProp; - + // Private variable to hold the embedded property representing the instance. private System.Management.ManagementBaseObject embeddedObj; - + // The current WMI object used private System.Management.ManagementBaseObject curObj; - + // Flag to indicate if the instance is an embedded object. private bool isEmbedded; - + // Below are different overloads of constructors to initialize an instance of the class with a WMI object. public KvpExchangeDataItem() { this.InitializeObject(null, null, null); } - + public KvpExchangeDataItem(System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(null, path, getOptions); } - + public KvpExchangeDataItem(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path) { this.InitializeObject(mgmtScope, path, null); } - + public KvpExchangeDataItem(System.Management.ManagementPath path) { this.InitializeObject(null, path, null); } - + public KvpExchangeDataItem(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(mgmtScope, path, getOptions); } - + public KvpExchangeDataItem(System.Management.ManagementObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -91,7 +91,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 throw new System.ArgumentException("Class name does not match."); } } - + public KvpExchangeDataItem(System.Management.ManagementBaseObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -104,7 +104,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 throw new System.ArgumentException("Class name does not match."); } } - + // Property returns the namespace of the WMI class. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -113,7 +113,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return "ROOT\\virtualization\\v2"; } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ManagementClassName { @@ -122,7 +122,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 if ((curObj != null)) { if ((curObj.ClassPath != null)) { strRet = ((string)(curObj["__CLASS"])); - if (((strRet == null) + if (((strRet == null) || (strRet == string.Empty))) { strRet = CreatedClassName; } @@ -131,7 +131,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return strRet; } } - + // Property pointing to an embedded object to get System properties of the WMI object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -140,7 +140,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return PrivateSystemProperties; } } - + // Property returning the underlying lateBound object. [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -149,7 +149,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return curObj; } } - + // ManagementScope of the object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -168,7 +168,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + // Property to show the commit behavior for the WMI object. If true, WMI object will be automatically saved after each property modification.(ie. Put() is called after modification of a property). [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -180,7 +180,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 AutoCommitProp = value; } } - + // The ManagementPath of the underlying WMI object. [Browsable(true)] public System.Management.ManagementPath Path { @@ -201,7 +201,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + // Public static scope property which is used by the various methods. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -213,7 +213,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 statMgmtScope = value; } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Caption { @@ -221,7 +221,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string)(curObj["Caption"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Data { @@ -229,7 +229,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string)(curObj["Data"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Description { @@ -237,7 +237,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string)(curObj["Description"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ElementName { @@ -245,7 +245,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string)(curObj["ElementName"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string InstanceID { @@ -253,7 +253,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string)(curObj["InstanceID"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Name { @@ -261,7 +261,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string)(curObj["Name"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsSourceNull { @@ -274,7 +274,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -286,9 +286,9 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((ushort)(curObj["Source"])); } } - + private bool CheckIfProperClass(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions OptionsParam) { - if (((path != null) + if (((path != null) && (string.Compare(path.ClassName, this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -296,9 +296,9 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return CheckIfProperClass(new System.Management.ManagementObject(mgmtScope, path, OptionsParam)); } } - + private bool CheckIfProperClass(System.Management.ManagementBaseObject theObj) { - if (((theObj != null) + if (((theObj != null) && (string.Compare(((string)(theObj["__CLASS"])), this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -315,38 +315,38 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } return false; } - + private bool ShouldSerializeSource() { if ((this.IsSourceNull == false)) { return true; } return false; } - + [Browsable(true)] public void CommitObject() { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(); } } - + [Browsable(true)] public void CommitObject(System.Management.PutOptions putOptions) { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(putOptions); } } - + private void Initialize() { AutoCommitProp = true; isEmbedded = false; } - + private static string ConstructPath() { string strPath = "ROOT\\virtualization\\v2:Msvm_KvpExchangeDataItem"; return strPath; } - + private void InitializeObject(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { Initialize(); if ((path != null)) { @@ -358,24 +358,24 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 PrivateSystemProperties = new ManagementSystemProperties(PrivateLateBoundObject); curObj = PrivateLateBoundObject; } - + // Different overloads of GetInstances() help in enumerating instances of the WMI class. public static KvpExchangeDataItemCollection GetInstances() { return GetInstances(null, null, null); } - + public static KvpExchangeDataItemCollection GetInstances(string condition) { return GetInstances(null, condition, null); } - + public static KvpExchangeDataItemCollection GetInstances(string[] selectedProperties) { return GetInstances(null, null, selectedProperties); } - + public static KvpExchangeDataItemCollection GetInstances(string condition, string[] selectedProperties) { return GetInstances(null, condition, selectedProperties); } - + public static KvpExchangeDataItemCollection GetInstances(System.Management.ManagementScope mgmtScope, System.Management.EnumerationOptions enumOptions) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -396,15 +396,15 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } return new KvpExchangeDataItemCollection(clsObject.GetInstances(enumOptions)); } - + public static KvpExchangeDataItemCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition) { return GetInstances(mgmtScope, condition, null); } - + public static KvpExchangeDataItemCollection GetInstances(System.Management.ManagementScope mgmtScope, string[] selectedProperties) { return GetInstances(mgmtScope, null, selectedProperties); } - + public static KvpExchangeDataItemCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition, string[] selectedProperties) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -421,7 +421,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 ObjectSearcher.Options = enumOptions; return new KvpExchangeDataItemCollection(ObjectSearcher.Get()); } - + [Browsable(true)] public static KvpExchangeDataItem CreateInstance() { System.Management.ManagementScope mgmtScope = null; @@ -436,39 +436,39 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 System.Management.ManagementClass tmpMgmtClass = new System.Management.ManagementClass(mgmtScope, mgmtPath, null); return new KvpExchangeDataItem(tmpMgmtClass.CreateInstance()); } - + [Browsable(true)] public void Delete() { PrivateLateBoundObject.Delete(); } - + // Enumerator implementation for enumerating instances of the class. public class KvpExchangeDataItemCollection : object, ICollection { - + private ManagementObjectCollection privColObj; - + public KvpExchangeDataItemCollection(ManagementObjectCollection objCollection) { privColObj = objCollection; } - + public virtual int Count { get { return privColObj.Count; } } - + public virtual bool IsSynchronized { get { return privColObj.IsSynchronized; } } - + public virtual object SyncRoot { get { return this; } } - + public virtual void CopyTo(System.Array array, int index) { privColObj.CopyTo(array, index); int nCtr; @@ -476,189 +476,189 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 array.SetValue(new KvpExchangeDataItem(((System.Management.ManagementObject)(array.GetValue(nCtr)))), nCtr); } } - + public virtual System.Collections.IEnumerator GetEnumerator() { return new KvpExchangeDataItemEnumerator(privColObj.GetEnumerator()); } - + public class KvpExchangeDataItemEnumerator : object, System.Collections.IEnumerator { - + private ManagementObjectCollection.ManagementObjectEnumerator privObjEnum; - + public KvpExchangeDataItemEnumerator(ManagementObjectCollection.ManagementObjectEnumerator objEnum) { privObjEnum = objEnum; } - + public virtual object Current { get { return new KvpExchangeDataItem(((System.Management.ManagementObject)(privObjEnum.Current))); } } - + public virtual bool MoveNext() { return privObjEnum.MoveNext(); } - + public virtual void Reset() { privObjEnum.Reset(); } } } - + // TypeConverter to handle null values for ValueType properties public class WMIValueTypeConverter : TypeConverter { - + private TypeConverter baseConverter; - + private System.Type baseType; - + public WMIValueTypeConverter(System.Type inBaseType) { baseConverter = TypeDescriptor.GetConverter(inBaseType); baseType = inBaseType; } - + 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 ((baseType.BaseType == typeof(System.Enum))) { if ((value.GetType() == destinationType)) { return value; } - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return "NULL_ENUM_VALUE" ; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((baseType == typeof(bool)) + if (((baseType == typeof(bool)) && (baseType.BaseType == typeof(System.ValueType)))) { - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((context != null) + if (((context != null) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } } - + // Embedded class to represent WMI system Properties. [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 { diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_LANEndpoint.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_LANEndpoint.cs index 9f09a069498..7fc0495fa04 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_LANEndpoint.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_LANEndpoint.cs @@ -23,8 +23,8 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { using System.Globalization; using System.ComponentModel.Design.Serialization; using System.Reflection; - - + + // Functions ShouldSerialize are functions used by VS property browser to check if a particular property has to be serialized. These functions are added for all ValueType properties ( properties of type Int32, BOOL etc.. which cannot be set to null). These functions use IsNull function. These functions are also used in the TypeConverter implementation for the properties to check for NULL value of property so that an empty value can be shown in Property browser in case of Drag and Drop in Visual studio. // Functions IsNull() are used to check if a property is NULL. // Functions Reset are added for Nullable Read/Write properties. These functions are used by VS designer in property browser to set a property to NULL. @@ -32,62 +32,62 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { // Datetime conversion functions ToDateTime and ToDmtfDateTime are added to the class to convert DMTF datetime to System.DateTime and vice-versa. // An Early Bound class generated for the WMI class.Msvm_LANEndpoint public class LANEndpoint : System.ComponentModel.Component { - + // Private property to hold the WMI namespace in which the class resides. private static string CreatedWmiNamespace = "ROOT\\virtualization\\v2"; - + // Private property to hold the name of WMI class which created this class. public static string CreatedClassName = "Msvm_LANEndpoint"; - + // Private member variable to hold the ManagementScope which is used by the various methods. private static System.Management.ManagementScope statMgmtScope = null; - + private ManagementSystemProperties PrivateSystemProperties; - + // Underlying lateBound WMI object. private System.Management.ManagementObject PrivateLateBoundObject; - + // Member variable to store the 'automatic commit' behavior for the class. private bool AutoCommitProp; - + // Private variable to hold the embedded property representing the instance. private System.Management.ManagementBaseObject embeddedObj; - + // The current WMI object used private System.Management.ManagementBaseObject curObj; - + // Flag to indicate if the instance is an embedded object. private bool isEmbedded; - + // Below are different overloads of constructors to initialize an instance of the class with a WMI object. public LANEndpoint() { this.InitializeObject(null, null, null); } - + public LANEndpoint(string keyCreationClassName, string keyName, string keySystemCreationClassName, string keySystemName) { this.InitializeObject(null, new System.Management.ManagementPath(LANEndpoint.ConstructPath(keyCreationClassName, keyName, keySystemCreationClassName, keySystemName)), null); } - + public LANEndpoint(System.Management.ManagementScope mgmtScope, string keyCreationClassName, string keyName, string keySystemCreationClassName, string keySystemName) { this.InitializeObject(((System.Management.ManagementScope)(mgmtScope)), new System.Management.ManagementPath(LANEndpoint.ConstructPath(keyCreationClassName, keyName, keySystemCreationClassName, keySystemName)), null); } - + public LANEndpoint(System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(null, path, getOptions); } - + public LANEndpoint(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path) { this.InitializeObject(mgmtScope, path, null); } - + public LANEndpoint(System.Management.ManagementPath path) { this.InitializeObject(null, path, null); } - + public LANEndpoint(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(mgmtScope, path, getOptions); } - + public LANEndpoint(System.Management.ManagementObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -99,7 +99,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { throw new System.ArgumentException("Class name does not match."); } } - + public LANEndpoint(System.Management.ManagementBaseObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -112,7 +112,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { throw new System.ArgumentException("Class name does not match."); } } - + // Property returns the namespace of the WMI class. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -121,7 +121,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return "ROOT\\virtualization\\v2"; } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ManagementClassName { @@ -130,7 +130,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { if ((curObj != null)) { if ((curObj.ClassPath != null)) { strRet = ((string)(curObj["__CLASS"])); - if (((strRet == null) + if (((strRet == null) || (strRet == string.Empty))) { strRet = CreatedClassName; } @@ -139,7 +139,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return strRet; } } - + // Property pointing to an embedded object to get System properties of the WMI object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -148,7 +148,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return PrivateSystemProperties; } } - + // Property returning the underlying lateBound object. [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -157,7 +157,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return curObj; } } - + // ManagementScope of the object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -176,7 +176,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + // Property to show the commit behavior for the WMI object. If true, WMI object will be automatically saved after each property modification.(ie. Put() is called after modification of a property). [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -188,7 +188,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { AutoCommitProp = value; } } - + // The ManagementPath of the underlying WMI object. [Browsable(true)] public System.Management.ManagementPath Path { @@ -209,7 +209,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + // Public static scope property which is used by the various methods. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -221,7 +221,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { statMgmtScope = value; } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string[] AliasAddresses { @@ -229,7 +229,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string[])(curObj["AliasAddresses"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public ushort[] AvailableRequestedStates { @@ -237,7 +237,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort[])(curObj["AvailableRequestedStates"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Caption { @@ -245,7 +245,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Caption"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsCommunicationStatusNull { @@ -258,7 +258,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -270,7 +270,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["CommunicationStatus"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsConnectedNull { @@ -283,7 +283,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("This property is set to TRUE if the LAN endpoint is connected to a switch port.")] @@ -296,7 +296,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((bool)(curObj["Connected"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string CreationClassName { @@ -304,7 +304,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["CreationClassName"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Description { @@ -312,7 +312,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Description"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsDetailedStatusNull { @@ -325,7 +325,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -337,7 +337,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["DetailedStatus"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ElementName { @@ -345,7 +345,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["ElementName"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsEnabledDefaultNull { @@ -358,7 +358,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -370,7 +370,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["EnabledDefault"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsEnabledStateNull { @@ -383,7 +383,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -395,7 +395,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["EnabledState"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string[] GroupAddresses { @@ -403,7 +403,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string[])(curObj["GroupAddresses"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsHealthStateNull { @@ -416,7 +416,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -428,7 +428,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["HealthState"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsInstallDateNull { @@ -441,7 +441,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -455,7 +455,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string InstanceID { @@ -463,7 +463,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["InstanceID"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string LANID { @@ -471,7 +471,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["LANID"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsLANTypeNull { @@ -484,7 +484,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -496,7 +496,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["LANType"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string MACAddress { @@ -504,7 +504,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["MACAddress"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsMaxDataSizeNull { @@ -517,7 +517,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -529,7 +529,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((uint)(curObj["MaxDataSize"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Name { @@ -537,7 +537,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Name"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string NameFormat { @@ -545,7 +545,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["NameFormat"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsOperatingStatusNull { @@ -558,7 +558,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -570,7 +570,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["OperatingStatus"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public ushort[] OperationalStatus { @@ -578,7 +578,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort[])(curObj["OperationalStatus"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string OtherEnabledState { @@ -586,7 +586,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["OtherEnabledState"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string OtherLANType { @@ -594,7 +594,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["OtherLANType"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string OtherTypeDescription { @@ -602,7 +602,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["OtherTypeDescription"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPrimaryStatusNull { @@ -615,7 +615,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -627,7 +627,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["PrimaryStatus"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsProtocolIFTypeNull { @@ -640,7 +640,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -652,7 +652,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["ProtocolIFType"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsProtocolTypeNull { @@ -665,7 +665,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -677,7 +677,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["ProtocolType"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsRequestedStateNull { @@ -690,7 +690,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -702,7 +702,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["RequestedState"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Status { @@ -710,7 +710,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Status"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string[] StatusDescriptions { @@ -718,7 +718,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string[])(curObj["StatusDescriptions"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string SystemCreationClassName { @@ -726,7 +726,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["SystemCreationClassName"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string SystemName { @@ -734,7 +734,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["SystemName"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsTimeOfLastStateChangeNull { @@ -747,7 +747,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -761,7 +761,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsTransitioningToStateNull { @@ -774,7 +774,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -786,9 +786,9 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["TransitioningToState"])); } } - + private bool CheckIfProperClass(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions OptionsParam) { - if (((path != null) + if (((path != null) && (string.Compare(path.ClassName, this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -796,9 +796,9 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return CheckIfProperClass(new System.Management.ManagementObject(mgmtScope, path, OptionsParam)); } } - + private bool CheckIfProperClass(System.Management.ManagementBaseObject theObj) { - if (((theObj != null) + if (((theObj != null) && (string.Compare(((string)(theObj["__CLASS"])), this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -815,49 +815,49 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } return false; } - + private bool ShouldSerializeCommunicationStatus() { if ((this.IsCommunicationStatusNull == false)) { return true; } return false; } - + private bool ShouldSerializeConnected() { if ((this.IsConnectedNull == false)) { return true; } return false; } - + private bool ShouldSerializeDetailedStatus() { if ((this.IsDetailedStatusNull == false)) { return true; } return false; } - + private bool ShouldSerializeEnabledDefault() { if ((this.IsEnabledDefaultNull == false)) { return true; } return false; } - + private bool ShouldSerializeEnabledState() { if ((this.IsEnabledStateNull == false)) { return true; } return false; } - + private bool ShouldSerializeHealthState() { if ((this.IsHealthStateNull == false)) { return true; } return false; } - + // Converts a given datetime in DMTF format to System.DateTime object. static System.DateTime ToDateTime(string dmtfDate) { System.DateTime initializer = System.DateTime.MinValue; @@ -909,13 +909,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { if (("******" != tempString)) { ticks = (long.Parse(tempString) * ((long)((System.TimeSpan.TicksPerMillisecond / 1000)))); } - if (((((((((year < 0) - || (month < 0)) - || (day < 0)) - || (hour < 0)) - || (minute < 0)) - || (minute < 0)) - || (second < 0)) + if (((((((((year < 0) + || (month < 0)) + || (day < 0)) + || (hour < 0)) + || (minute < 0)) + || (minute < 0)) + || (second < 0)) || (ticks < 0))) { throw new System.ArgumentOutOfRangeException(); } @@ -943,7 +943,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } return datetime; } - + // Converts a given System.DateTime object to DMTF datetime format. static string ToDmtfDateTime(System.DateTime date) { string utcString = string.Empty; @@ -970,8 +970,8 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { dmtfDateTime = string.Concat(dmtfDateTime, ((int)(date.Second)).ToString().PadLeft(2, '0')); dmtfDateTime = string.Concat(dmtfDateTime, "."); System.DateTime dtTemp = new System.DateTime(date.Year, date.Month, date.Day, date.Hour, date.Minute, date.Second, 0); - long microsec = ((long)((((date.Ticks - dtTemp.Ticks) - * 1000) + long microsec = ((long)((((date.Ticks - dtTemp.Ticks) + * 1000) / System.TimeSpan.TicksPerMillisecond))); string strMicrosec = ((long)(microsec)).ToString(); if ((strMicrosec.Length > 6)) { @@ -981,96 +981,96 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { dmtfDateTime = string.Concat(dmtfDateTime, utcString); return dmtfDateTime; } - + private bool ShouldSerializeInstallDate() { if ((this.IsInstallDateNull == false)) { return true; } return false; } - + private bool ShouldSerializeLANType() { if ((this.IsLANTypeNull == false)) { return true; } return false; } - + private bool ShouldSerializeMaxDataSize() { if ((this.IsMaxDataSizeNull == false)) { return true; } return false; } - + private bool ShouldSerializeOperatingStatus() { if ((this.IsOperatingStatusNull == false)) { return true; } return false; } - + private bool ShouldSerializePrimaryStatus() { if ((this.IsPrimaryStatusNull == false)) { return true; } return false; } - + private bool ShouldSerializeProtocolIFType() { if ((this.IsProtocolIFTypeNull == false)) { return true; } return false; } - + private bool ShouldSerializeProtocolType() { if ((this.IsProtocolTypeNull == false)) { return true; } return false; } - + private bool ShouldSerializeRequestedState() { if ((this.IsRequestedStateNull == false)) { return true; } return false; } - + private bool ShouldSerializeTimeOfLastStateChange() { if ((this.IsTimeOfLastStateChangeNull == false)) { return true; } return false; } - + private bool ShouldSerializeTransitioningToState() { if ((this.IsTransitioningToStateNull == false)) { return true; } return false; } - + [Browsable(true)] public void CommitObject() { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(); } } - + [Browsable(true)] public void CommitObject(System.Management.PutOptions putOptions) { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(putOptions); } } - + private void Initialize() { AutoCommitProp = true; isEmbedded = false; } - + private static string ConstructPath(string keyCreationClassName, string keyName, string keySystemCreationClassName, string keySystemName) { string strPath = "ROOT\\virtualization\\v2:Msvm_LANEndpoint"; strPath = string.Concat(strPath, string.Concat(".CreationClassName=", string.Concat("\"", string.Concat(keyCreationClassName, "\"")))); @@ -1079,7 +1079,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { strPath = string.Concat(strPath, string.Concat(",SystemName=", string.Concat("\"", string.Concat(keySystemName, "\"")))); return strPath; } - + private void InitializeObject(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { Initialize(); if ((path != null)) { @@ -1091,24 +1091,24 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { PrivateSystemProperties = new ManagementSystemProperties(PrivateLateBoundObject); curObj = PrivateLateBoundObject; } - + // Different overloads of GetInstances() help in enumerating instances of the WMI class. public static LANEndpointCollection GetInstances() { return GetInstances(null, null, null); } - + public static LANEndpointCollection GetInstances(string condition) { return GetInstances(null, condition, null); } - + public static LANEndpointCollection GetInstances(string[] selectedProperties) { return GetInstances(null, null, selectedProperties); } - + public static LANEndpointCollection GetInstances(string condition, string[] selectedProperties) { return GetInstances(null, condition, selectedProperties); } - + public static LANEndpointCollection GetInstances(System.Management.ManagementScope mgmtScope, System.Management.EnumerationOptions enumOptions) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -1129,15 +1129,15 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } return new LANEndpointCollection(clsObject.GetInstances(enumOptions)); } - + public static LANEndpointCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition) { return GetInstances(mgmtScope, condition, null); } - + public static LANEndpointCollection GetInstances(System.Management.ManagementScope mgmtScope, string[] selectedProperties) { return GetInstances(mgmtScope, null, selectedProperties); } - + public static LANEndpointCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition, string[] selectedProperties) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -1154,7 +1154,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { ObjectSearcher.Options = enumOptions; return new LANEndpointCollection(ObjectSearcher.Get()); } - + [Browsable(true)] public static LANEndpoint CreateInstance() { System.Management.ManagementScope mgmtScope = null; @@ -1169,12 +1169,12 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { System.Management.ManagementClass tmpMgmtClass = new System.Management.ManagementClass(mgmtScope, mgmtPath, null); return new LANEndpoint(tmpMgmtClass.CreateInstance()); } - + [Browsable(true)] public void Delete() { PrivateLateBoundObject.Delete(); } - + public uint RequestStateChange(ushort RequestedState, System.DateTime TimeoutPeriod, out System.Management.ManagementPath Job) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1193,34 +1193,34 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + // Enumerator implementation for enumerating instances of the class. public class LANEndpointCollection : object, ICollection { - + private ManagementObjectCollection privColObj; - + public LANEndpointCollection(ManagementObjectCollection objCollection) { privColObj = objCollection; } - + public virtual int Count { get { return privColObj.Count; } } - + public virtual bool IsSynchronized { get { return privColObj.IsSynchronized; } } - + public virtual object SyncRoot { get { return this; } } - + public virtual void CopyTo(System.Array array, int index) { privColObj.CopyTo(array, index); int nCtr; @@ -1228,189 +1228,189 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { array.SetValue(new LANEndpoint(((System.Management.ManagementObject)(array.GetValue(nCtr)))), nCtr); } } - + public virtual System.Collections.IEnumerator GetEnumerator() { return new LANEndpointEnumerator(privColObj.GetEnumerator()); } - + public class LANEndpointEnumerator : object, System.Collections.IEnumerator { - + private ManagementObjectCollection.ManagementObjectEnumerator privObjEnum; - + public LANEndpointEnumerator(ManagementObjectCollection.ManagementObjectEnumerator objEnum) { privObjEnum = objEnum; } - + public virtual object Current { get { return new LANEndpoint(((System.Management.ManagementObject)(privObjEnum.Current))); } } - + public virtual bool MoveNext() { return privObjEnum.MoveNext(); } - + public virtual void Reset() { privObjEnum.Reset(); } } } - + // TypeConverter to handle null values for ValueType properties public class WMIValueTypeConverter : TypeConverter { - + private TypeConverter baseConverter; - + private System.Type baseType; - + public WMIValueTypeConverter(System.Type inBaseType) { baseConverter = TypeDescriptor.GetConverter(inBaseType); baseType = inBaseType; } - + 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 ((baseType.BaseType == typeof(System.Enum))) { if ((value.GetType() == destinationType)) { return value; } - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return "NULL_ENUM_VALUE" ; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((baseType == typeof(bool)) + if (((baseType == typeof(bool)) && (baseType.BaseType == typeof(System.ValueType)))) { - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((context != null) + if (((context != null) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } } - + // Embedded class to represent WMI system Properties. [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 { diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_MemorySettingData.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_MemorySettingData.cs index 99200dd1b21..1276fe92891 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_MemorySettingData.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_MemorySettingData.cs @@ -23,70 +23,70 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { using System.Globalization; using System.ComponentModel.Design.Serialization; using System.Reflection; - - + + // Functions ShouldSerialize are functions used by VS property browser to check if a particular property has to be serialized. These functions are added for all ValueType properties ( properties of type Int32, BOOL etc.. which cannot be set to null). These functions use IsNull function. These functions are also used in the TypeConverter implementation for the properties to check for NULL value of property so that an empty value can be shown in Property browser in case of Drag and Drop in Visual studio. // Functions IsNull() are used to check if a property is NULL. // Functions Reset are added for Nullable Read/Write properties. These functions are used by VS designer in property browser to set a property to NULL. // Every property added to the class for WMI property has attributes set to define its behavior in Visual Studio designer and also to define a TypeConverter to be used. // An Early Bound class generated for the WMI class.Msvm_MemorySettingData public class MemorySettingData : System.ComponentModel.Component { - + // Private property to hold the WMI namespace in which the class resides. private static string CreatedWmiNamespace = "ROOT\\virtualization\\v2"; - + // Private property to hold the name of WMI class which created this class. public static string CreatedClassName = "Msvm_MemorySettingData"; - + // Private member variable to hold the ManagementScope which is used by the various methods. private static System.Management.ManagementScope statMgmtScope = null; - + private ManagementSystemProperties PrivateSystemProperties; - + // Underlying lateBound WMI object. private System.Management.ManagementObject PrivateLateBoundObject; - + // Member variable to store the 'automatic commit' behavior for the class. private bool AutoCommitProp; - + // Private variable to hold the embedded property representing the instance. private System.Management.ManagementBaseObject embeddedObj; - + // The current WMI object used private System.Management.ManagementBaseObject curObj; - + // Flag to indicate if the instance is an embedded object. private bool isEmbedded; - + // Below are different overloads of constructors to initialize an instance of the class with a WMI object. public MemorySettingData() { this.InitializeObject(null, null, null); } - + public MemorySettingData(string keyInstanceID) { this.InitializeObject(null, new System.Management.ManagementPath(MemorySettingData.ConstructPath(keyInstanceID)), null); } - + public MemorySettingData(System.Management.ManagementScope mgmtScope, string keyInstanceID) { this.InitializeObject(((System.Management.ManagementScope)(mgmtScope)), new System.Management.ManagementPath(MemorySettingData.ConstructPath(keyInstanceID)), null); } - + public MemorySettingData(System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(null, path, getOptions); } - + public MemorySettingData(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path) { this.InitializeObject(mgmtScope, path, null); } - + public MemorySettingData(System.Management.ManagementPath path) { this.InitializeObject(null, path, null); } - + public MemorySettingData(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(mgmtScope, path, getOptions); } - + public MemorySettingData(System.Management.ManagementObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -98,7 +98,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { throw new System.ArgumentException("Class name does not match."); } } - + public MemorySettingData(System.Management.ManagementBaseObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -111,7 +111,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { throw new System.ArgumentException("Class name does not match."); } } - + // Property returns the namespace of the WMI class. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -120,7 +120,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return "ROOT\\virtualization\\v2"; } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ManagementClassName { @@ -129,7 +129,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { if ((curObj != null)) { if ((curObj.ClassPath != null)) { strRet = ((string)(curObj["__CLASS"])); - if (((strRet == null) + if (((strRet == null) || (strRet == string.Empty))) { strRet = CreatedClassName; } @@ -138,7 +138,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return strRet; } } - + // Property pointing to an embedded object to get System properties of the WMI object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -147,7 +147,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return PrivateSystemProperties; } } - + // Property returning the underlying lateBound object. [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -156,7 +156,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return curObj; } } - + // ManagementScope of the object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -175,7 +175,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + // Property to show the commit behavior for the WMI object. If true, WMI object will be automatically saved after each property modification.(ie. Put() is called after modification of a property). [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -187,7 +187,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { AutoCommitProp = value; } } - + // The ManagementPath of the underlying WMI object. [Browsable(true)] public System.Management.ManagementPath Path { @@ -208,7 +208,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + // Public static scope property which is used by the various methods. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -220,7 +220,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { statMgmtScope = value; } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Address { @@ -228,7 +228,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Address"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string AddressOnParent { @@ -236,7 +236,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["AddressOnParent"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string AllocationUnits { @@ -244,7 +244,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["AllocationUnits"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsAutomaticAllocationNull { @@ -257,7 +257,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -269,7 +269,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((bool)(curObj["AutomaticAllocation"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsAutomaticDeallocationNull { @@ -282,7 +282,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -294,7 +294,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((bool)(curObj["AutomaticDeallocation"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Caption { @@ -302,7 +302,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Caption"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string[] Connection { @@ -310,7 +310,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string[])(curObj["Connection"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsConsumerVisibilityNull { @@ -323,7 +323,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -335,7 +335,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["ConsumerVisibility"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Description { @@ -343,7 +343,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Description"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsDynamicMemoryEnabledNull { @@ -356,7 +356,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("Indicates if dynamic memory is enabled.")] @@ -369,7 +369,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((bool)(curObj["DynamicMemoryEnabled"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ElementName { @@ -377,7 +377,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["ElementName"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string[] HostResource { @@ -385,7 +385,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string[])(curObj["HostResource"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string InstanceID { @@ -393,7 +393,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["InstanceID"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsIsVirtualizedNull { @@ -406,7 +406,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"Indicates whether this device is virtualized or passed through, possibly using partitioning. When set to False, the underlying or host resource is utilized. At least one item shall be present in the DeviceID property. When set to True, the resource is virtualized and may not map directly to an underlying/host resource. Some implementations may support specific assignment for virtualized resources, in which case the host resource(s) are exposed using the DeviceID property. This property is always set to True.")] @@ -419,7 +419,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((bool)(curObj["IsVirtualized"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsLimitNull { @@ -432,7 +432,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -444,7 +444,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ulong)(curObj["Limit"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsMappingBehaviorNull { @@ -457,7 +457,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -469,7 +469,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["MappingBehavior"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsMaxMemoryBlocksPerNumaNodeNull { @@ -482,7 +482,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The maximum amount of memory that can be observed within the VM as belonging to a" + @@ -496,7 +496,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ulong)(curObj["MaxMemoryBlocksPerNumaNode"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string OtherResourceType { @@ -504,7 +504,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["OtherResourceType"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Parent { @@ -512,7 +512,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Parent"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string PoolID { @@ -520,7 +520,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["PoolID"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsReservationNull { @@ -533,7 +533,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -545,7 +545,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ulong)(curObj["Reservation"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ResourceSubType { @@ -553,7 +553,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["ResourceSubType"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsResourceTypeNull { @@ -566,7 +566,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -578,7 +578,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["ResourceType"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsSwapFilesInUseNull { @@ -591,7 +591,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("Indicates if smart paging is active.")] @@ -604,7 +604,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((bool)(curObj["SwapFilesInUse"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsTargetMemoryBufferNull { @@ -617,7 +617,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -629,7 +629,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((uint)(curObj["TargetMemoryBuffer"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsVirtualQuantityNull { @@ -642,7 +642,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -654,7 +654,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ulong)(curObj["VirtualQuantity"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string VirtualQuantityUnits { @@ -662,7 +662,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["VirtualQuantityUnits"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsWeightNull { @@ -675,7 +675,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -687,9 +687,9 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((uint)(curObj["Weight"])); } } - + private bool CheckIfProperClass(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions OptionsParam) { - if (((path != null) + if (((path != null) && (string.Compare(path.ClassName, this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -697,9 +697,9 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return CheckIfProperClass(new System.Management.ManagementObject(mgmtScope, path, OptionsParam)); } } - + private bool CheckIfProperClass(System.Management.ManagementBaseObject theObj) { - if (((theObj != null) + if (((theObj != null) && (string.Compare(((string)(theObj["__CLASS"])), this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -716,130 +716,130 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } return false; } - + private bool ShouldSerializeAutomaticAllocation() { if ((this.IsAutomaticAllocationNull == false)) { return true; } return false; } - + private bool ShouldSerializeAutomaticDeallocation() { if ((this.IsAutomaticDeallocationNull == false)) { return true; } return false; } - + private bool ShouldSerializeConsumerVisibility() { if ((this.IsConsumerVisibilityNull == false)) { return true; } return false; } - + private bool ShouldSerializeDynamicMemoryEnabled() { if ((this.IsDynamicMemoryEnabledNull == false)) { return true; } return false; } - + private bool ShouldSerializeIsVirtualized() { if ((this.IsIsVirtualizedNull == false)) { return true; } return false; } - + private bool ShouldSerializeLimit() { if ((this.IsLimitNull == false)) { return true; } return false; } - + private bool ShouldSerializeMappingBehavior() { if ((this.IsMappingBehaviorNull == false)) { return true; } return false; } - + private bool ShouldSerializeMaxMemoryBlocksPerNumaNode() { if ((this.IsMaxMemoryBlocksPerNumaNodeNull == false)) { return true; } return false; } - + private bool ShouldSerializeReservation() { if ((this.IsReservationNull == false)) { return true; } return false; } - + private bool ShouldSerializeResourceType() { if ((this.IsResourceTypeNull == false)) { return true; } return false; } - + private bool ShouldSerializeSwapFilesInUse() { if ((this.IsSwapFilesInUseNull == false)) { return true; } return false; } - + private bool ShouldSerializeTargetMemoryBuffer() { if ((this.IsTargetMemoryBufferNull == false)) { return true; } return false; } - + private bool ShouldSerializeVirtualQuantity() { if ((this.IsVirtualQuantityNull == false)) { return true; } return false; } - + private bool ShouldSerializeWeight() { if ((this.IsWeightNull == false)) { return true; } return false; } - + [Browsable(true)] public void CommitObject() { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(); } } - + [Browsable(true)] public void CommitObject(System.Management.PutOptions putOptions) { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(putOptions); } } - + private void Initialize() { AutoCommitProp = true; isEmbedded = false; } - + private static string ConstructPath(string keyInstanceID) { string strPath = "ROOT\\virtualization\\v2:Msvm_MemorySettingData"; strPath = string.Concat(strPath, string.Concat(".InstanceID=", string.Concat("\"", string.Concat(keyInstanceID, "\"")))); return strPath; } - + private void InitializeObject(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { Initialize(); if ((path != null)) { @@ -851,24 +851,24 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { PrivateSystemProperties = new ManagementSystemProperties(PrivateLateBoundObject); curObj = PrivateLateBoundObject; } - + // Different overloads of GetInstances() help in enumerating instances of the WMI class. public static MemorySettingDataCollection GetInstances() { return GetInstances(null, null, null); } - + public static MemorySettingDataCollection GetInstances(string condition) { return GetInstances(null, condition, null); } - + public static MemorySettingDataCollection GetInstances(string[] selectedProperties) { return GetInstances(null, null, selectedProperties); } - + public static MemorySettingDataCollection GetInstances(string condition, string[] selectedProperties) { return GetInstances(null, condition, selectedProperties); } - + public static MemorySettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, System.Management.EnumerationOptions enumOptions) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -889,15 +889,15 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } return new MemorySettingDataCollection(clsObject.GetInstances(enumOptions)); } - + public static MemorySettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition) { return GetInstances(mgmtScope, condition, null); } - + public static MemorySettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string[] selectedProperties) { return GetInstances(mgmtScope, null, selectedProperties); } - + public static MemorySettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition, string[] selectedProperties) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -914,7 +914,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { ObjectSearcher.Options = enumOptions; return new MemorySettingDataCollection(ObjectSearcher.Get()); } - + [Browsable(true)] public static MemorySettingData CreateInstance() { System.Management.ManagementScope mgmtScope = null; @@ -929,39 +929,39 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { System.Management.ManagementClass tmpMgmtClass = new System.Management.ManagementClass(mgmtScope, mgmtPath, null); return new MemorySettingData(tmpMgmtClass.CreateInstance()); } - + [Browsable(true)] public void Delete() { PrivateLateBoundObject.Delete(); } - + // Enumerator implementation for enumerating instances of the class. public class MemorySettingDataCollection : object, ICollection { - + private ManagementObjectCollection privColObj; - + public MemorySettingDataCollection(ManagementObjectCollection objCollection) { privColObj = objCollection; } - + public virtual int Count { get { return privColObj.Count; } } - + public virtual bool IsSynchronized { get { return privColObj.IsSynchronized; } } - + public virtual object SyncRoot { get { return this; } } - + public virtual void CopyTo(System.Array array, int index) { privColObj.CopyTo(array, index); int nCtr; @@ -969,189 +969,189 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { array.SetValue(new MemorySettingData(((System.Management.ManagementObject)(array.GetValue(nCtr)))), nCtr); } } - + public virtual System.Collections.IEnumerator GetEnumerator() { return new MemorySettingDataEnumerator(privColObj.GetEnumerator()); } - + public class MemorySettingDataEnumerator : object, System.Collections.IEnumerator { - + private ManagementObjectCollection.ManagementObjectEnumerator privObjEnum; - + public MemorySettingDataEnumerator(ManagementObjectCollection.ManagementObjectEnumerator objEnum) { privObjEnum = objEnum; } - + public virtual object Current { get { return new MemorySettingData(((System.Management.ManagementObject)(privObjEnum.Current))); } } - + public virtual bool MoveNext() { return privObjEnum.MoveNext(); } - + public virtual void Reset() { privObjEnum.Reset(); } } } - + // TypeConverter to handle null values for ValueType properties public class WMIValueTypeConverter : TypeConverter { - + private TypeConverter baseConverter; - + private System.Type baseType; - + public WMIValueTypeConverter(System.Type inBaseType) { baseConverter = TypeDescriptor.GetConverter(inBaseType); baseType = inBaseType; } - + 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 ((baseType.BaseType == typeof(System.Enum))) { if ((value.GetType() == destinationType)) { return value; } - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return "NULL_ENUM_VALUE" ; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((baseType == typeof(bool)) + if (((baseType == typeof(bool)) && (baseType.BaseType == typeof(System.ValueType)))) { - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((context != null) + if (((context != null) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } } - + // Embedded class to represent WMI system Properties. [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 { diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_MigrationJob.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_MigrationJob.cs index 7b7e5f1d088..d58e282b4a0 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_MigrationJob.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_MigrationJob.cs @@ -32,62 +32,62 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { // Datetime conversion functions ToDateTime and ToDmtfDateTime are added to the class to convert DMTF datetime to System.DateTime and vice-versa. // An Early Bound class generated for the WMI class.Msvm_MigrationJob public class MigrationJob : System.ComponentModel.Component { - + // Private property to hold the WMI namespace in which the class resides. private static string CreatedWmiNamespace = "ROOT\\virtualization\\v2"; - + // Private property to hold the name of WMI class which created this class. public static string CreatedClassName = "Msvm_MigrationJob"; - + // Private member variable to hold the ManagementScope which is used by the various methods. private static System.Management.ManagementScope statMgmtScope = null; - + private ManagementSystemProperties PrivateSystemProperties; - + // Underlying lateBound WMI object. private System.Management.ManagementObject PrivateLateBoundObject; - + // Member variable to store the 'automatic commit' behavior for the class. private bool AutoCommitProp; - + // Private variable to hold the embedded property representing the instance. private System.Management.ManagementBaseObject embeddedObj; - + // The current WMI object used private System.Management.ManagementBaseObject curObj; - + // Flag to indicate if the instance is an embedded object. private bool isEmbedded; - + // Below are different overloads of constructors to initialize an instance of the class with a WMI object. public MigrationJob() { this.InitializeObject(null, null, null); } - + public MigrationJob(string keyInstanceID) { this.InitializeObject(null, new System.Management.ManagementPath(MigrationJob.ConstructPath(keyInstanceID)), null); } - + public MigrationJob(System.Management.ManagementScope mgmtScope, string keyInstanceID) { this.InitializeObject(((System.Management.ManagementScope)(mgmtScope)), new System.Management.ManagementPath(MigrationJob.ConstructPath(keyInstanceID)), null); } - + public MigrationJob(System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(null, path, getOptions); } - + public MigrationJob(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path) { this.InitializeObject(mgmtScope, path, null); } - + public MigrationJob(System.Management.ManagementPath path) { this.InitializeObject(null, path, null); } - + public MigrationJob(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(mgmtScope, path, getOptions); } - + public MigrationJob(System.Management.ManagementObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -99,7 +99,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { throw new System.ArgumentException("Class name does not match."); } } - + public MigrationJob(System.Management.ManagementBaseObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -112,7 +112,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { throw new System.ArgumentException("Class name does not match."); } } - + // Property returns the namespace of the WMI class. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -121,7 +121,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return "ROOT\\virtualization\\v2"; } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ManagementClassName { @@ -130,7 +130,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { if ((curObj != null)) { if ((curObj.ClassPath != null)) { strRet = ((string)(curObj["__CLASS"])); - if (((strRet == null) + if (((strRet == null) || (strRet == string.Empty))) { strRet = CreatedClassName; } @@ -139,7 +139,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return strRet; } } - + // Property pointing to an embedded object to get System properties of the WMI object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -148,7 +148,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return PrivateSystemProperties; } } - + // Property returning the underlying lateBound object. [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -157,7 +157,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return curObj; } } - + // ManagementScope of the object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -176,7 +176,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + // Property to show the commit behavior for the WMI object. If true, WMI object will be automatically saved after each property modification.(ie. Put() is called after modification of a property). [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -188,7 +188,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { AutoCommitProp = value; } } - + // The ManagementPath of the underlying WMI object. [Browsable(true)] public System.Management.ManagementPath Path { @@ -209,7 +209,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + // Public static scope property which is used by the various methods. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -221,7 +221,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { statMgmtScope = value; } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsCancellableNull { @@ -234,7 +234,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("Indicates whether the job can be cancelled. The value of this property does not g" + @@ -248,7 +248,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((bool)(curObj["Cancellable"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Caption { @@ -256,7 +256,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Caption"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsCommunicationStatusNull { @@ -269,7 +269,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -281,7 +281,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["CommunicationStatus"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsDeleteOnCompletionNull { @@ -294,7 +294,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -306,7 +306,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((bool)(curObj["DeleteOnCompletion"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Description { @@ -314,7 +314,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Description"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("Hostname the destination virtualization platform where the virtual system is migr" + @@ -324,7 +324,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["DestinationHost"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsDetailedStatusNull { @@ -337,7 +337,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -349,7 +349,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["DetailedStatus"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsElapsedTimeNull { @@ -362,7 +362,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -376,7 +376,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ElementName { @@ -384,7 +384,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["ElementName"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsErrorCodeNull { @@ -397,7 +397,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -409,7 +409,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["ErrorCode"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ErrorDescription { @@ -417,7 +417,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["ErrorDescription"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ErrorSummaryDescription { @@ -425,7 +425,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["ErrorSummaryDescription"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsHealthStateNull { @@ -438,7 +438,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -450,7 +450,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["HealthState"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsInstallDateNull { @@ -463,7 +463,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -477,7 +477,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string InstanceID { @@ -485,7 +485,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["InstanceID"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsJobRunTimesNull { @@ -498,7 +498,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -510,7 +510,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((uint)(curObj["JobRunTimes"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsJobStateNull { @@ -523,7 +523,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -535,7 +535,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["JobState"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string JobStatus { @@ -543,7 +543,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["JobStatus"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsJobTypeNull { @@ -556,7 +556,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("Indicates the type of Job being tracked by this object.")] @@ -569,7 +569,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((JobTypeValues)(System.Convert.ToInt32(curObj["JobType"]))); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsLocalOrUtcTimeNull { @@ -582,7 +582,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -594,7 +594,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["LocalOrUtcTime"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsMigrationTypeNull { @@ -607,7 +607,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The migration type as defined in Msvm_VirtualSystemMigrationSettingData.Migration" + @@ -621,7 +621,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["MigrationType"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Name { @@ -629,7 +629,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Name"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"For Live Migration this must be set to NULL. For Storage Migration, it will specify the virtual machine's virtual hard drives which moved and where they moved. If not NULL, NewResourceSettingData will contain an array of embedded instances of resource allocation setting data (RASD) which represent VHDs. Destination location will be provided using Connection property of RASD.")] @@ -638,7 +638,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string[])(curObj["NewResourceSettingData"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"For Live Migration this will be set to NULL. For Storage Migration, it will indicate the new path for virtual machine data (ExternalDataRoot, SnapshotDataRoot and SwapFileDataRoot). This being NULL indicates that virtual machine's data roots are not moving. Otherwise NewSystemSettingData will be instance of Msvm_VirtualSystemGlobalSettingData containing properties ExternalDataRoot, SnapshotDataRoot and SwapFileDataRoot. If not NULL, ExternalDataRoot property will specify new location of virtual machine's current configuration and saved state. If not NULL, SnapshotDataRoot property will specify new location for snapshots data. If not NULL, SwapFileDataRoot property will specify new location of virtual machine's smart paging files ")] @@ -647,7 +647,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["NewSystemSettingData"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Notify { @@ -655,7 +655,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Notify"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsOperatingStatusNull { @@ -668,7 +668,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -680,7 +680,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["OperatingStatus"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public ushort[] OperationalStatus { @@ -688,7 +688,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort[])(curObj["OperationalStatus"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string OtherRecoveryAction { @@ -696,7 +696,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["OtherRecoveryAction"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Owner { @@ -704,7 +704,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Owner"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPercentCompleteNull { @@ -717,7 +717,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -729,7 +729,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["PercentComplete"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPrimaryStatusNull { @@ -742,7 +742,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -754,7 +754,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["PrimaryStatus"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPriorityNull { @@ -767,7 +767,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -779,7 +779,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((uint)(curObj["Priority"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsRecoveryActionNull { @@ -792,7 +792,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -804,7 +804,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["RecoveryAction"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsRunDayNull { @@ -817,7 +817,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -829,7 +829,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((sbyte)(curObj["RunDay"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsRunDayOfWeekNull { @@ -842,7 +842,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -854,7 +854,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((sbyte)(curObj["RunDayOfWeek"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsRunMonthNull { @@ -867,7 +867,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -879,7 +879,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((byte)(curObj["RunMonth"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsRunStartIntervalNull { @@ -892,7 +892,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -906,7 +906,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsScheduledStartTimeNull { @@ -919,7 +919,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -933,7 +933,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsStartTimeNull { @@ -946,7 +946,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -960,7 +960,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Status { @@ -968,7 +968,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Status"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string[] StatusDescriptions { @@ -976,7 +976,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string[])(curObj["StatusDescriptions"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsTimeBeforeRemovalNull { @@ -989,7 +989,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -1003,7 +1003,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsTimeOfLastStateChangeNull { @@ -1016,7 +1016,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -1030,7 +1030,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsTimeSubmittedNull { @@ -1043,7 +1043,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -1057,7 +1057,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsUntilTimeNull { @@ -1070,7 +1070,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -1084,7 +1084,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("GUID of the affected virtual system.")] @@ -1093,9 +1093,9 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["VirtualSystemName"])); } } - + private bool CheckIfProperClass(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions OptionsParam) { - if (((path != null) + if (((path != null) && (string.Compare(path.ClassName, this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -1103,9 +1103,9 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return CheckIfProperClass(new System.Management.ManagementObject(mgmtScope, path, OptionsParam)); } } - + private bool CheckIfProperClass(System.Management.ManagementBaseObject theObj) { - if (((theObj != null) + if (((theObj != null) && (string.Compare(((string)(theObj["__CLASS"])), this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -1122,35 +1122,35 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } return false; } - + private bool ShouldSerializeCancellable() { if ((this.IsCancellableNull == false)) { return true; } return false; } - + private bool ShouldSerializeCommunicationStatus() { if ((this.IsCommunicationStatusNull == false)) { return true; } return false; } - + private bool ShouldSerializeDeleteOnCompletion() { if ((this.IsDeleteOnCompletionNull == false)) { return true; } return false; } - + private bool ShouldSerializeDetailedStatus() { if ((this.IsDetailedStatusNull == false)) { return true; } return false; } - + // Converts a given datetime in DMTF format to System.DateTime object. static System.DateTime ToDateTime(string dmtfDate) { System.DateTime initializer = System.DateTime.MinValue; @@ -1202,13 +1202,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { if (("******" != tempString)) { ticks = (long.Parse(tempString) * ((long)((System.TimeSpan.TicksPerMillisecond / 1000)))); } - if (((((((((year < 0) - || (month < 0)) - || (day < 0)) - || (hour < 0)) - || (minute < 0)) - || (minute < 0)) - || (second < 0)) + if (((((((((year < 0) + || (month < 0)) + || (day < 0)) + || (hour < 0)) + || (minute < 0)) + || (minute < 0)) + || (second < 0)) || (ticks < 0))) { throw new System.ArgumentOutOfRangeException(); } @@ -1236,7 +1236,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } return datetime; } - + // Converts a given System.DateTime object to DMTF datetime format. static string ToDmtfDateTime(System.DateTime date) { string utcString = string.Empty; @@ -1263,8 +1263,8 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { dmtfDateTime = string.Concat(dmtfDateTime, ((int)(date.Second)).ToString().PadLeft(2, '0')); dmtfDateTime = string.Concat(dmtfDateTime, "."); System.DateTime dtTemp = new System.DateTime(date.Year, date.Month, date.Day, date.Hour, date.Minute, date.Second, 0); - long microsec = ((long)((((date.Ticks - dtTemp.Ticks) - * 1000) + long microsec = ((long)((((date.Ticks - dtTemp.Ticks) + * 1000) / System.TimeSpan.TicksPerMillisecond))); string strMicrosec = ((long)(microsec)).ToString(); if ((strMicrosec.Length > 6)) { @@ -1274,200 +1274,200 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { dmtfDateTime = string.Concat(dmtfDateTime, utcString); return dmtfDateTime; } - + private bool ShouldSerializeElapsedTime() { if ((this.IsElapsedTimeNull == false)) { return true; } return false; } - + private bool ShouldSerializeErrorCode() { if ((this.IsErrorCodeNull == false)) { return true; } return false; } - + private bool ShouldSerializeHealthState() { if ((this.IsHealthStateNull == false)) { return true; } return false; } - + private bool ShouldSerializeInstallDate() { if ((this.IsInstallDateNull == false)) { return true; } return false; } - + private bool ShouldSerializeJobRunTimes() { if ((this.IsJobRunTimesNull == false)) { return true; } return false; } - + private bool ShouldSerializeJobState() { if ((this.IsJobStateNull == false)) { return true; } return false; } - + private bool ShouldSerializeJobType() { if ((this.IsJobTypeNull == false)) { return true; } return false; } - + private bool ShouldSerializeLocalOrUtcTime() { if ((this.IsLocalOrUtcTimeNull == false)) { return true; } return false; } - + private bool ShouldSerializeMigrationType() { if ((this.IsMigrationTypeNull == false)) { return true; } return false; } - + private bool ShouldSerializeOperatingStatus() { if ((this.IsOperatingStatusNull == false)) { return true; } return false; } - + private bool ShouldSerializePercentComplete() { if ((this.IsPercentCompleteNull == false)) { return true; } return false; } - + private bool ShouldSerializePrimaryStatus() { if ((this.IsPrimaryStatusNull == false)) { return true; } return false; } - + private bool ShouldSerializePriority() { if ((this.IsPriorityNull == false)) { return true; } return false; } - + private bool ShouldSerializeRecoveryAction() { if ((this.IsRecoveryActionNull == false)) { return true; } return false; } - + private bool ShouldSerializeRunDay() { if ((this.IsRunDayNull == false)) { return true; } return false; } - + private bool ShouldSerializeRunDayOfWeek() { if ((this.IsRunDayOfWeekNull == false)) { return true; } return false; } - + private bool ShouldSerializeRunMonth() { if ((this.IsRunMonthNull == false)) { return true; } return false; } - + private bool ShouldSerializeRunStartInterval() { if ((this.IsRunStartIntervalNull == false)) { return true; } return false; } - + private bool ShouldSerializeScheduledStartTime() { if ((this.IsScheduledStartTimeNull == false)) { return true; } return false; } - + private bool ShouldSerializeStartTime() { if ((this.IsStartTimeNull == false)) { return true; } return false; } - + private bool ShouldSerializeTimeBeforeRemoval() { if ((this.IsTimeBeforeRemovalNull == false)) { return true; } return false; } - + private bool ShouldSerializeTimeOfLastStateChange() { if ((this.IsTimeOfLastStateChangeNull == false)) { return true; } return false; } - + private bool ShouldSerializeTimeSubmitted() { if ((this.IsTimeSubmittedNull == false)) { return true; } return false; } - + private bool ShouldSerializeUntilTime() { if ((this.IsUntilTimeNull == false)) { return true; } return false; } - + [Browsable(true)] public void CommitObject() { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(); } } - + [Browsable(true)] public void CommitObject(System.Management.PutOptions putOptions) { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(putOptions); } } - + private void Initialize() { AutoCommitProp = true; isEmbedded = false; } - + private static string ConstructPath(string keyInstanceID) { string strPath = "ROOT\\virtualization\\v2:Msvm_MigrationJob"; strPath = string.Concat(strPath, string.Concat(".InstanceID=", string.Concat("\"", string.Concat(keyInstanceID, "\"")))); return strPath; } - + private void InitializeObject(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { Initialize(); if ((path != null)) { @@ -1479,24 +1479,24 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { PrivateSystemProperties = new ManagementSystemProperties(PrivateLateBoundObject); curObj = PrivateLateBoundObject; } - + // Different overloads of GetInstances() help in enumerating instances of the WMI class. public static MigrationJobCollection GetInstances() { return GetInstances(null, null, null); } - + public static MigrationJobCollection GetInstances(string condition) { return GetInstances(null, condition, null); } - + public static MigrationJobCollection GetInstances(string[] selectedProperties) { return GetInstances(null, null, selectedProperties); } - + public static MigrationJobCollection GetInstances(string condition, string[] selectedProperties) { return GetInstances(null, condition, selectedProperties); } - + public static MigrationJobCollection GetInstances(System.Management.ManagementScope mgmtScope, System.Management.EnumerationOptions enumOptions) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -1517,15 +1517,15 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } return new MigrationJobCollection(clsObject.GetInstances(enumOptions)); } - + public static MigrationJobCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition) { return GetInstances(mgmtScope, condition, null); } - + public static MigrationJobCollection GetInstances(System.Management.ManagementScope mgmtScope, string[] selectedProperties) { return GetInstances(mgmtScope, null, selectedProperties); } - + public static MigrationJobCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition, string[] selectedProperties) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -1542,7 +1542,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { ObjectSearcher.Options = enumOptions; return new MigrationJobCollection(ObjectSearcher.Get()); } - + [Browsable(true)] public static MigrationJob CreateInstance() { System.Management.ManagementScope mgmtScope = null; @@ -1557,12 +1557,12 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { System.Management.ManagementClass tmpMgmtClass = new System.Management.ManagementClass(mgmtScope, mgmtPath, null); return new MigrationJob(tmpMgmtClass.CreateInstance()); } - + [Browsable(true)] public void Delete() { PrivateLateBoundObject.Delete(); } - + public uint GetError(out string Error) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1575,7 +1575,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint GetErrorEx(out string[] Errors) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1588,7 +1588,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint KillJob(bool DeleteOnKill) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1601,7 +1601,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint RequestStateChange(ushort RequestedState, System.DateTime TimeoutPeriod) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1615,57 +1615,57 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public enum JobTypeValues { - + Unknown0 = 0, - + Creating_Remote_Virtual_Machine = 300, - + Checking_Virtual_Machine_Compatibility = 301, - + Checking_Virtual_Machine_and_Storage_Compatibility = 302, - + Checking_Storage_Compatibility = 303, - + Checking_Storage_Migration = 304, - + Moving_Virtual_Machine = 305, - + Moving_Virtual_Machine_and_Storage = 306, - + Moving_Storage = 307, - + NULL_ENUM_VALUE = 308, } - + // Enumerator implementation for enumerating instances of the class. public class MigrationJobCollection : object, ICollection { - + private ManagementObjectCollection privColObj; - + public MigrationJobCollection(ManagementObjectCollection objCollection) { privColObj = objCollection; } - + public virtual int Count { get { return privColObj.Count; } } - + public virtual bool IsSynchronized { get { return privColObj.IsSynchronized; } } - + public virtual object SyncRoot { get { return this; } } - + public virtual void CopyTo(System.Array array, int index) { privColObj.CopyTo(array, index); int nCtr; @@ -1673,189 +1673,189 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { array.SetValue(new MigrationJob(((System.Management.ManagementObject)(array.GetValue(nCtr)))), nCtr); } } - + public virtual System.Collections.IEnumerator GetEnumerator() { return new MigrationJobEnumerator(privColObj.GetEnumerator()); } - + public class MigrationJobEnumerator : object, System.Collections.IEnumerator { - + private ManagementObjectCollection.ManagementObjectEnumerator privObjEnum; - + public MigrationJobEnumerator(ManagementObjectCollection.ManagementObjectEnumerator objEnum) { privObjEnum = objEnum; } - + public virtual object Current { get { return new MigrationJob(((System.Management.ManagementObject)(privObjEnum.Current))); } } - + public virtual bool MoveNext() { return privObjEnum.MoveNext(); } - + public virtual void Reset() { privObjEnum.Reset(); } } } - + // TypeConverter to handle null values for ValueType properties public class WMIValueTypeConverter : TypeConverter { - + private TypeConverter baseConverter; - + private System.Type baseType; - + public WMIValueTypeConverter(System.Type inBaseType) { baseConverter = TypeDescriptor.GetConverter(inBaseType); baseType = inBaseType; } - + 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 ((baseType.BaseType == typeof(System.Enum))) { if ((value.GetType() == destinationType)) { return value; } - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return "NULL_ENUM_VALUE" ; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((baseType == typeof(bool)) + if (((baseType == typeof(bool)) && (baseType.BaseType == typeof(System.ValueType)))) { - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((context != null) + if (((context != null) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } } - + // Embedded class to represent WMI system Properties. [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 { diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_ProcessorSettingData.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_ProcessorSettingData.cs index c21c71cc6d4..f8e0a73f2ed 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_ProcessorSettingData.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_ProcessorSettingData.cs @@ -23,70 +23,70 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { using System.Globalization; using System.ComponentModel.Design.Serialization; using System.Reflection; - - + + // Functions ShouldSerialize are functions used by VS property browser to check if a particular property has to be serialized. These functions are added for all ValueType properties ( properties of type Int32, BOOL etc.. which cannot be set to null). These functions use IsNull function. These functions are also used in the TypeConverter implementation for the properties to check for NULL value of property so that an empty value can be shown in Property browser in case of Drag and Drop in Visual studio. // Functions IsNull() are used to check if a property is NULL. // Functions Reset are added for Nullable Read/Write properties. These functions are used by VS designer in property browser to set a property to NULL. // Every property added to the class for WMI property has attributes set to define its behavior in Visual Studio designer and also to define a TypeConverter to be used. // An Early Bound class generated for the WMI class.Msvm_ProcessorSettingData public class ProcessorSettingData : System.ComponentModel.Component { - + // Private property to hold the WMI namespace in which the class resides. private static string CreatedWmiNamespace = "ROOT\\virtualization\\v2"; - + // Private property to hold the name of WMI class which created this class. public static string CreatedClassName = "Msvm_ProcessorSettingData"; - + // Private member variable to hold the ManagementScope which is used by the various methods. private static System.Management.ManagementScope statMgmtScope = null; - + private ManagementSystemProperties PrivateSystemProperties; - + // Underlying lateBound WMI object. private System.Management.ManagementObject PrivateLateBoundObject; - + // Member variable to store the 'automatic commit' behavior for the class. private bool AutoCommitProp; - + // Private variable to hold the embedded property representing the instance. private System.Management.ManagementBaseObject embeddedObj; - + // The current WMI object used private System.Management.ManagementBaseObject curObj; - + // Flag to indicate if the instance is an embedded object. private bool isEmbedded; - + // Below are different overloads of constructors to initialize an instance of the class with a WMI object. public ProcessorSettingData() { this.InitializeObject(null, null, null); } - + public ProcessorSettingData(string keyInstanceID) { this.InitializeObject(null, new System.Management.ManagementPath(ProcessorSettingData.ConstructPath(keyInstanceID)), null); } - + public ProcessorSettingData(System.Management.ManagementScope mgmtScope, string keyInstanceID) { this.InitializeObject(((System.Management.ManagementScope)(mgmtScope)), new System.Management.ManagementPath(ProcessorSettingData.ConstructPath(keyInstanceID)), null); } - + public ProcessorSettingData(System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(null, path, getOptions); } - + public ProcessorSettingData(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path) { this.InitializeObject(mgmtScope, path, null); } - + public ProcessorSettingData(System.Management.ManagementPath path) { this.InitializeObject(null, path, null); } - + public ProcessorSettingData(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(mgmtScope, path, getOptions); } - + public ProcessorSettingData(System.Management.ManagementObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -98,7 +98,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { throw new System.ArgumentException("Class name does not match."); } } - + public ProcessorSettingData(System.Management.ManagementBaseObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -111,7 +111,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { throw new System.ArgumentException("Class name does not match."); } } - + // Property returns the namespace of the WMI class. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -120,7 +120,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return "ROOT\\virtualization\\v2"; } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ManagementClassName { @@ -129,7 +129,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { if ((curObj != null)) { if ((curObj.ClassPath != null)) { strRet = ((string)(curObj["__CLASS"])); - if (((strRet == null) + if (((strRet == null) || (strRet == string.Empty))) { strRet = CreatedClassName; } @@ -138,7 +138,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return strRet; } } - + // Property pointing to an embedded object to get System properties of the WMI object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -147,7 +147,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return PrivateSystemProperties; } } - + // Property returning the underlying lateBound object. [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -156,7 +156,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return curObj; } } - + // ManagementScope of the object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -175,7 +175,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + // Property to show the commit behavior for the WMI object. If true, WMI object will be automatically saved after each property modification.(ie. Put() is called after modification of a property). [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -187,7 +187,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { AutoCommitProp = value; } } - + // The ManagementPath of the underlying WMI object. [Browsable(true)] public System.Management.ManagementPath Path { @@ -208,7 +208,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + // Public static scope property which is used by the various methods. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -220,7 +220,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { statMgmtScope = value; } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Address { @@ -228,7 +228,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Address"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string AddressOnParent { @@ -236,7 +236,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["AddressOnParent"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string AllocationUnits { @@ -244,7 +244,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["AllocationUnits"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsAutomaticAllocationNull { @@ -257,7 +257,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -269,7 +269,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((bool)(curObj["AutomaticAllocation"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsAutomaticDeallocationNull { @@ -282,7 +282,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -294,7 +294,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((bool)(curObj["AutomaticDeallocation"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Caption { @@ -302,7 +302,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Caption"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string[] Connection { @@ -310,7 +310,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string[])(curObj["Connection"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsConsumerVisibilityNull { @@ -323,7 +323,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -335,7 +335,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["ConsumerVisibility"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Description { @@ -343,7 +343,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Description"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ElementName { @@ -351,7 +351,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["ElementName"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string[] HostResource { @@ -359,7 +359,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string[])(curObj["HostResource"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string InstanceID { @@ -367,7 +367,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["InstanceID"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsLimitNull { @@ -380,7 +380,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -392,7 +392,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ulong)(curObj["Limit"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsLimitCPUIDNull { @@ -405,7 +405,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("Indicates whether the virtual machine should lower the CPU identifier. Some older" + @@ -420,7 +420,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((bool)(curObj["LimitCPUID"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsLimitProcessorFeaturesNull { @@ -433,7 +433,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"Indicates whether the VM should limit the CPU features exposed to the operating system. Limiting the processor features enables the VM to be migrated to different host computer systems with different processors. Migrating VMs between computers with processors from different vendors is not supported.")] @@ -446,7 +446,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((bool)(curObj["LimitProcessorFeatures"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsMappingBehaviorNull { @@ -459,7 +459,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -471,7 +471,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["MappingBehavior"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsMaxNumaNodesPerSocketNull { @@ -484,7 +484,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The maximum number of NUMA nodes that can be observed within the VM as belonging " + @@ -498,7 +498,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ulong)(curObj["MaxNumaNodesPerSocket"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsMaxProcessorsPerNumaNodeNull { @@ -511,7 +511,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The maximum number of virtual processors that can be observed within the VM as be" + @@ -525,7 +525,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ulong)(curObj["MaxProcessorsPerNumaNode"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string OtherResourceType { @@ -533,7 +533,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["OtherResourceType"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Parent { @@ -541,7 +541,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Parent"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string PoolID { @@ -549,7 +549,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["PoolID"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsReservationNull { @@ -562,7 +562,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -574,7 +574,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ulong)(curObj["Reservation"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ResourceSubType { @@ -582,7 +582,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["ResourceSubType"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsResourceTypeNull { @@ -595,7 +595,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -607,7 +607,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["ResourceType"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsVirtualQuantityNull { @@ -620,7 +620,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -632,7 +632,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ulong)(curObj["VirtualQuantity"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string VirtualQuantityUnits { @@ -640,7 +640,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["VirtualQuantityUnits"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsWeightNull { @@ -653,7 +653,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -665,9 +665,9 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((uint)(curObj["Weight"])); } } - + private bool CheckIfProperClass(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions OptionsParam) { - if (((path != null) + if (((path != null) && (string.Compare(path.ClassName, this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -675,9 +675,9 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return CheckIfProperClass(new System.Management.ManagementObject(mgmtScope, path, OptionsParam)); } } - + private bool CheckIfProperClass(System.Management.ManagementBaseObject theObj) { - if (((theObj != null) + if (((theObj != null) && (string.Compare(((string)(theObj["__CLASS"])), this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -694,123 +694,123 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } return false; } - + private bool ShouldSerializeAutomaticAllocation() { if ((this.IsAutomaticAllocationNull == false)) { return true; } return false; } - + private bool ShouldSerializeAutomaticDeallocation() { if ((this.IsAutomaticDeallocationNull == false)) { return true; } return false; } - + private bool ShouldSerializeConsumerVisibility() { if ((this.IsConsumerVisibilityNull == false)) { return true; } return false; } - + private bool ShouldSerializeLimit() { if ((this.IsLimitNull == false)) { return true; } return false; } - + private bool ShouldSerializeLimitCPUID() { if ((this.IsLimitCPUIDNull == false)) { return true; } return false; } - + private bool ShouldSerializeLimitProcessorFeatures() { if ((this.IsLimitProcessorFeaturesNull == false)) { return true; } return false; } - + private bool ShouldSerializeMappingBehavior() { if ((this.IsMappingBehaviorNull == false)) { return true; } return false; } - + private bool ShouldSerializeMaxNumaNodesPerSocket() { if ((this.IsMaxNumaNodesPerSocketNull == false)) { return true; } return false; } - + private bool ShouldSerializeMaxProcessorsPerNumaNode() { if ((this.IsMaxProcessorsPerNumaNodeNull == false)) { return true; } return false; } - + private bool ShouldSerializeReservation() { if ((this.IsReservationNull == false)) { return true; } return false; } - + private bool ShouldSerializeResourceType() { if ((this.IsResourceTypeNull == false)) { return true; } return false; } - + private bool ShouldSerializeVirtualQuantity() { if ((this.IsVirtualQuantityNull == false)) { return true; } return false; } - + private bool ShouldSerializeWeight() { if ((this.IsWeightNull == false)) { return true; } return false; } - + [Browsable(true)] public void CommitObject() { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(); } } - + [Browsable(true)] public void CommitObject(System.Management.PutOptions putOptions) { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(putOptions); } } - + private void Initialize() { AutoCommitProp = true; isEmbedded = false; } - + private static string ConstructPath(string keyInstanceID) { string strPath = "ROOT\\virtualization\\v2:Msvm_ProcessorSettingData"; strPath = string.Concat(strPath, string.Concat(".InstanceID=", string.Concat("\"", string.Concat(keyInstanceID, "\"")))); return strPath; } - + private void InitializeObject(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { Initialize(); if ((path != null)) { @@ -822,24 +822,24 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { PrivateSystemProperties = new ManagementSystemProperties(PrivateLateBoundObject); curObj = PrivateLateBoundObject; } - + // Different overloads of GetInstances() help in enumerating instances of the WMI class. public static ProcessorSettingDataCollection GetInstances() { return GetInstances(null, null, null); } - + public static ProcessorSettingDataCollection GetInstances(string condition) { return GetInstances(null, condition, null); } - + public static ProcessorSettingDataCollection GetInstances(string[] selectedProperties) { return GetInstances(null, null, selectedProperties); } - + public static ProcessorSettingDataCollection GetInstances(string condition, string[] selectedProperties) { return GetInstances(null, condition, selectedProperties); } - + public static ProcessorSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, System.Management.EnumerationOptions enumOptions) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -860,15 +860,15 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } return new ProcessorSettingDataCollection(clsObject.GetInstances(enumOptions)); } - + public static ProcessorSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition) { return GetInstances(mgmtScope, condition, null); } - + public static ProcessorSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string[] selectedProperties) { return GetInstances(mgmtScope, null, selectedProperties); } - + public static ProcessorSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition, string[] selectedProperties) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -885,7 +885,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { ObjectSearcher.Options = enumOptions; return new ProcessorSettingDataCollection(ObjectSearcher.Get()); } - + [Browsable(true)] public static ProcessorSettingData CreateInstance() { System.Management.ManagementScope mgmtScope = null; @@ -900,39 +900,39 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { System.Management.ManagementClass tmpMgmtClass = new System.Management.ManagementClass(mgmtScope, mgmtPath, null); return new ProcessorSettingData(tmpMgmtClass.CreateInstance()); } - + [Browsable(true)] public void Delete() { PrivateLateBoundObject.Delete(); } - + // Enumerator implementation for enumerating instances of the class. public class ProcessorSettingDataCollection : object, ICollection { - + private ManagementObjectCollection privColObj; - + public ProcessorSettingDataCollection(ManagementObjectCollection objCollection) { privColObj = objCollection; } - + public virtual int Count { get { return privColObj.Count; } } - + public virtual bool IsSynchronized { get { return privColObj.IsSynchronized; } } - + public virtual object SyncRoot { get { return this; } } - + public virtual void CopyTo(System.Array array, int index) { privColObj.CopyTo(array, index); int nCtr; @@ -940,189 +940,189 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { array.SetValue(new ProcessorSettingData(((System.Management.ManagementObject)(array.GetValue(nCtr)))), nCtr); } } - + public virtual System.Collections.IEnumerator GetEnumerator() { return new ProcessorSettingDataEnumerator(privColObj.GetEnumerator()); } - + public class ProcessorSettingDataEnumerator : object, System.Collections.IEnumerator { - + private ManagementObjectCollection.ManagementObjectEnumerator privObjEnum; - + public ProcessorSettingDataEnumerator(ManagementObjectCollection.ManagementObjectEnumerator objEnum) { privObjEnum = objEnum; } - + public virtual object Current { get { return new ProcessorSettingData(((System.Management.ManagementObject)(privObjEnum.Current))); } } - + public virtual bool MoveNext() { return privObjEnum.MoveNext(); } - + public virtual void Reset() { privObjEnum.Reset(); } } } - + // TypeConverter to handle null values for ValueType properties public class WMIValueTypeConverter : TypeConverter { - + private TypeConverter baseConverter; - + private System.Type baseType; - + public WMIValueTypeConverter(System.Type inBaseType) { baseConverter = TypeDescriptor.GetConverter(inBaseType); baseType = inBaseType; } - + 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 ((baseType.BaseType == typeof(System.Enum))) { if ((value.GetType() == destinationType)) { return value; } - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return "NULL_ENUM_VALUE" ; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((baseType == typeof(bool)) + if (((baseType == typeof(bool)) && (baseType.BaseType == typeof(System.ValueType)))) { - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((context != null) + if (((context != null) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } } - + // Embedded class to represent WMI system Properties. [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 { diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_ResourceAllocationSettingData.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_ResourceAllocationSettingData.cs index a75837e15ec..dc097e1852a 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_ResourceAllocationSettingData.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_ResourceAllocationSettingData.cs @@ -24,70 +24,70 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 using System.Globalization; using System.ComponentModel.Design.Serialization; using System.Reflection; - - + + // Functions ShouldSerialize are functions used by VS property browser to check if a particular property has to be serialized. These functions are added for all ValueType properties ( properties of type Int32, BOOL etc.. which cannot be set to null). These functions use IsNull function. These functions are also used in the TypeConverter implementation for the properties to check for NULL value of property so that an empty value can be shown in Property browser in case of Drag and Drop in Visual studio. // Functions IsNull() are used to check if a property is NULL. // Functions Reset are added for Nullable Read/Write properties. These functions are used by VS designer in property browser to set a property to NULL. // Every property added to the class for WMI property has attributes set to define its behavior in Visual Studio designer and also to define a TypeConverter to be used. // An Early Bound class generated for the WMI class.Msvm_ResourceAllocationSettingData public class ResourceAllocationSettingData : System.ComponentModel.Component { - + // Private property to hold the WMI namespace in which the class resides. private static string CreatedWmiNamespace = "ROOT\\virtualization\\v2"; - + // Private property to hold the name of WMI class which created this class. public static string CreatedClassName = "Msvm_ResourceAllocationSettingData"; - + // Private member variable to hold the ManagementScope which is used by the various methods. private static System.Management.ManagementScope statMgmtScope = null; - + private ManagementSystemProperties PrivateSystemProperties; - + // Underlying lateBound WMI object. private System.Management.ManagementObject PrivateLateBoundObject; - + // Member variable to store the 'automatic commit' behavior for the class. private bool AutoCommitProp; - + // Private variable to hold the embedded property representing the instance. private System.Management.ManagementBaseObject embeddedObj; - + // The current WMI object used private System.Management.ManagementBaseObject curObj; - + // Flag to indicate if the instance is an embedded object. private bool isEmbedded; - + // Below are different overloads of constructors to initialize an instance of the class with a WMI object. public ResourceAllocationSettingData() { this.InitializeObject(null, null, null); } - + public ResourceAllocationSettingData(string keyInstanceID) { this.InitializeObject(null, new System.Management.ManagementPath(ResourceAllocationSettingData.ConstructPath(keyInstanceID)), null); } - + public ResourceAllocationSettingData(System.Management.ManagementScope mgmtScope, string keyInstanceID) { this.InitializeObject(((System.Management.ManagementScope)(mgmtScope)), new System.Management.ManagementPath(ResourceAllocationSettingData.ConstructPath(keyInstanceID)), null); } - + public ResourceAllocationSettingData(System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(null, path, getOptions); } - + public ResourceAllocationSettingData(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path) { this.InitializeObject(mgmtScope, path, null); } - + public ResourceAllocationSettingData(System.Management.ManagementPath path) { this.InitializeObject(null, path, null); } - + public ResourceAllocationSettingData(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(mgmtScope, path, getOptions); } - + public ResourceAllocationSettingData(System.Management.ManagementObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -99,7 +99,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 throw new System.ArgumentException("Class name does not match."); } } - + public ResourceAllocationSettingData(System.Management.ManagementBaseObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -112,7 +112,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 throw new System.ArgumentException("Class name does not match."); } } - + // Property returns the namespace of the WMI class. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -121,7 +121,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return "ROOT\\virtualization\\v2"; } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ManagementClassName { @@ -130,7 +130,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 if ((curObj != null)) { if ((curObj.ClassPath != null)) { strRet = ((string)(curObj["__CLASS"])); - if (((strRet == null) + if (((strRet == null) || (strRet == string.Empty))) { strRet = CreatedClassName; } @@ -139,7 +139,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return strRet; } } - + // Property pointing to an embedded object to get System properties of the WMI object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -148,7 +148,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return PrivateSystemProperties; } } - + // Property returning the underlying lateBound object. [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -157,7 +157,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return curObj; } } - + // ManagementScope of the object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -176,7 +176,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + // Property to show the commit behavior for the WMI object. If true, WMI object will be automatically saved after each property modification.(ie. Put() is called after modification of a property). [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -188,7 +188,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 AutoCommitProp = value; } } - + // The ManagementPath of the underlying WMI object. [Browsable(true)] public System.Management.ManagementPath Path { @@ -209,7 +209,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + // Public static scope property which is used by the various methods. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -221,7 +221,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 statMgmtScope = value; } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Address { @@ -229,7 +229,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string)(curObj["Address"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string AddressOnParent { @@ -237,7 +237,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string)(curObj["AddressOnParent"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string AllocationUnits { @@ -245,7 +245,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string)(curObj["AllocationUnits"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsAutomaticAllocationNull { @@ -258,7 +258,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -270,7 +270,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((bool)(curObj["AutomaticAllocation"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsAutomaticDeallocationNull { @@ -283,7 +283,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -295,7 +295,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((bool)(curObj["AutomaticDeallocation"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Caption { @@ -303,7 +303,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string)(curObj["Caption"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string[] Connection { @@ -311,7 +311,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string[])(curObj["Connection"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsConsumerVisibilityNull { @@ -324,7 +324,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -336,7 +336,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((ushort)(curObj["ConsumerVisibility"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Description { @@ -344,7 +344,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string)(curObj["Description"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ElementName { @@ -352,7 +352,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string)(curObj["ElementName"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string[] HostResource { @@ -360,7 +360,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string[])(curObj["HostResource"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string InstanceID { @@ -368,7 +368,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string)(curObj["InstanceID"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsLimitNull { @@ -381,7 +381,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -393,7 +393,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((ulong)(curObj["Limit"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsMappingBehaviorNull { @@ -406,7 +406,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -418,7 +418,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((ushort)(curObj["MappingBehavior"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string OtherResourceType { @@ -426,7 +426,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string)(curObj["OtherResourceType"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Parent { @@ -434,7 +434,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string)(curObj["Parent"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string PoolID { @@ -442,7 +442,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string)(curObj["PoolID"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsReservationNull { @@ -455,7 +455,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -467,7 +467,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((ulong)(curObj["Reservation"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ResourceSubType { @@ -475,7 +475,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string)(curObj["ResourceSubType"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsResourceTypeNull { @@ -488,7 +488,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -500,7 +500,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((ushort)(curObj["ResourceType"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsVirtualQuantityNull { @@ -513,7 +513,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -525,7 +525,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((ulong)(curObj["VirtualQuantity"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string VirtualQuantityUnits { @@ -533,7 +533,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string)(curObj["VirtualQuantityUnits"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"A free-form string array of identifiers of this resource presented to the virtual computer system's operating system. These values are only used if the ResourceType property is set to 6 (Parallel SCSI HBA) and the ResourceSubType property is set to ""Microsoft Synthetic SCSI Controller"". This property is set to ""GUID"". @@ -544,7 +544,7 @@ Windows Server 2008: The VirtualSystemIdentifiers property is not supported unt return ((string[])(curObj["VirtualSystemIdentifiers"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsWeightNull { @@ -557,7 +557,7 @@ Windows Server 2008: The VirtualSystemIdentifiers property is not supported unt } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -569,9 +569,9 @@ Windows Server 2008: The VirtualSystemIdentifiers property is not supported unt return ((uint)(curObj["Weight"])); } } - + private bool CheckIfProperClass(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions OptionsParam) { - if (((path != null) + if (((path != null) && (string.Compare(path.ClassName, this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -579,9 +579,9 @@ Windows Server 2008: The VirtualSystemIdentifiers property is not supported unt return CheckIfProperClass(new System.Management.ManagementObject(mgmtScope, path, OptionsParam)); } } - + private bool CheckIfProperClass(System.Management.ManagementBaseObject theObj) { - if (((theObj != null) + if (((theObj != null) && (string.Compare(((string)(theObj["__CLASS"])), this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -598,95 +598,95 @@ Windows Server 2008: The VirtualSystemIdentifiers property is not supported unt } return false; } - + private bool ShouldSerializeAutomaticAllocation() { if ((this.IsAutomaticAllocationNull == false)) { return true; } return false; } - + private bool ShouldSerializeAutomaticDeallocation() { if ((this.IsAutomaticDeallocationNull == false)) { return true; } return false; } - + private bool ShouldSerializeConsumerVisibility() { if ((this.IsConsumerVisibilityNull == false)) { return true; } return false; } - + private bool ShouldSerializeLimit() { if ((this.IsLimitNull == false)) { return true; } return false; } - + private bool ShouldSerializeMappingBehavior() { if ((this.IsMappingBehaviorNull == false)) { return true; } return false; } - + private bool ShouldSerializeReservation() { if ((this.IsReservationNull == false)) { return true; } return false; } - + private bool ShouldSerializeResourceType() { if ((this.IsResourceTypeNull == false)) { return true; } return false; } - + private bool ShouldSerializeVirtualQuantity() { if ((this.IsVirtualQuantityNull == false)) { return true; } return false; } - + private bool ShouldSerializeWeight() { if ((this.IsWeightNull == false)) { return true; } return false; } - + [Browsable(true)] public void CommitObject() { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(); } } - + [Browsable(true)] public void CommitObject(System.Management.PutOptions putOptions) { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(putOptions); } } - + private void Initialize() { AutoCommitProp = true; isEmbedded = false; } - + private static string ConstructPath(string keyInstanceID) { string strPath = "ROOT\\virtualization\\v2:Msvm_ResourceAllocationSettingData"; strPath = string.Concat(strPath, string.Concat(".InstanceID=", string.Concat("\"", string.Concat(keyInstanceID, "\"")))); return strPath; } - + private void InitializeObject(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { Initialize(); if ((path != null)) { @@ -698,24 +698,24 @@ Windows Server 2008: The VirtualSystemIdentifiers property is not supported unt PrivateSystemProperties = new ManagementSystemProperties(PrivateLateBoundObject); curObj = PrivateLateBoundObject; } - + // Different overloads of GetInstances() help in enumerating instances of the WMI class. public static ResourceAllocationSettingDataCollection GetInstances() { return GetInstances(null, null, null); } - + public static ResourceAllocationSettingDataCollection GetInstances(string condition) { return GetInstances(null, condition, null); } - + public static ResourceAllocationSettingDataCollection GetInstances(string[] selectedProperties) { return GetInstances(null, null, selectedProperties); } - + public static ResourceAllocationSettingDataCollection GetInstances(string condition, string[] selectedProperties) { return GetInstances(null, condition, selectedProperties); } - + public static ResourceAllocationSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, System.Management.EnumerationOptions enumOptions) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -736,15 +736,15 @@ Windows Server 2008: The VirtualSystemIdentifiers property is not supported unt } return new ResourceAllocationSettingDataCollection(clsObject.GetInstances(enumOptions)); } - + public static ResourceAllocationSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition) { return GetInstances(mgmtScope, condition, null); } - + public static ResourceAllocationSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string[] selectedProperties) { return GetInstances(mgmtScope, null, selectedProperties); } - + public static ResourceAllocationSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition, string[] selectedProperties) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -761,7 +761,7 @@ Windows Server 2008: The VirtualSystemIdentifiers property is not supported unt ObjectSearcher.Options = enumOptions; return new ResourceAllocationSettingDataCollection(ObjectSearcher.Get()); } - + [Browsable(true)] public static ResourceAllocationSettingData CreateInstance() { System.Management.ManagementScope mgmtScope = null; @@ -776,39 +776,39 @@ Windows Server 2008: The VirtualSystemIdentifiers property is not supported unt System.Management.ManagementClass tmpMgmtClass = new System.Management.ManagementClass(mgmtScope, mgmtPath, null); return new ResourceAllocationSettingData(tmpMgmtClass.CreateInstance()); } - + [Browsable(true)] public void Delete() { PrivateLateBoundObject.Delete(); } - + // Enumerator implementation for enumerating instances of the class. public class ResourceAllocationSettingDataCollection : object, ICollection { - + private ManagementObjectCollection privColObj; - + public ResourceAllocationSettingDataCollection(ManagementObjectCollection objCollection) { privColObj = objCollection; } - + public virtual int Count { get { return privColObj.Count; } } - + public virtual bool IsSynchronized { get { return privColObj.IsSynchronized; } } - + public virtual object SyncRoot { get { return this; } } - + public virtual void CopyTo(System.Array array, int index) { privColObj.CopyTo(array, index); int nCtr; @@ -816,189 +816,189 @@ Windows Server 2008: The VirtualSystemIdentifiers property is not supported unt array.SetValue(new ResourceAllocationSettingData(((System.Management.ManagementObject)(array.GetValue(nCtr)))), nCtr); } } - + public virtual System.Collections.IEnumerator GetEnumerator() { return new ResourceAllocationSettingDataEnumerator(privColObj.GetEnumerator()); } - + public class ResourceAllocationSettingDataEnumerator : object, System.Collections.IEnumerator { - + private ManagementObjectCollection.ManagementObjectEnumerator privObjEnum; - + public ResourceAllocationSettingDataEnumerator(ManagementObjectCollection.ManagementObjectEnumerator objEnum) { privObjEnum = objEnum; } - + public virtual object Current { get { return new ResourceAllocationSettingData(((System.Management.ManagementObject)(privObjEnum.Current))); } } - + public virtual bool MoveNext() { return privObjEnum.MoveNext(); } - + public virtual void Reset() { privObjEnum.Reset(); } } } - + // TypeConverter to handle null values for ValueType properties public class WMIValueTypeConverter : TypeConverter { - + private TypeConverter baseConverter; - + private System.Type baseType; - + public WMIValueTypeConverter(System.Type inBaseType) { baseConverter = TypeDescriptor.GetConverter(inBaseType); baseType = inBaseType; } - + 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 ((baseType.BaseType == typeof(System.Enum))) { if ((value.GetType() == destinationType)) { return value; } - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return "NULL_ENUM_VALUE" ; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((baseType == typeof(bool)) + if (((baseType == typeof(bool)) && (baseType.BaseType == typeof(System.ValueType)))) { - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((context != null) + if (((context != null) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } } - + // Embedded class to represent WMI system Properties. [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 { diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_ShutdownComponent.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_ShutdownComponent.cs index 81613ea88f4..678f80b0bf6 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_ShutdownComponent.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_ShutdownComponent.cs @@ -23,8 +23,8 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { using System.Globalization; using System.ComponentModel.Design.Serialization; using System.Reflection; - - + + // Functions ShouldSerialize are functions used by VS property browser to check if a particular property has to be serialized. These functions are added for all ValueType properties ( properties of type Int32, BOOL etc.. which cannot be set to null). These functions use IsNull function. These functions are also used in the TypeConverter implementation for the properties to check for NULL value of property so that an empty value can be shown in Property browser in case of Drag and Drop in Visual studio. // Functions IsNull() are used to check if a property is NULL. // Functions Reset are added for Nullable Read/Write properties. These functions are used by VS designer in property browser to set a property to NULL. @@ -32,62 +32,62 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { // Datetime conversion functions ToDateTime and ToDmtfDateTime are added to the class to convert DMTF datetime to System.DateTime and vice-versa. // An Early Bound class generated for the WMI class.Msvm_ShutdownComponent public class ShutdownComponent : System.ComponentModel.Component { - + // Private property to hold the WMI namespace in which the class resides. private static string CreatedWmiNamespace = "ROOT\\virtualization\\v2"; - + // Private property to hold the name of WMI class which created this class. private static string CreatedClassName = "Msvm_ShutdownComponent"; - + // Private member variable to hold the ManagementScope which is used by the various methods. private static System.Management.ManagementScope statMgmtScope = null; - + private ManagementSystemProperties PrivateSystemProperties; - + // Underlying lateBound WMI object. private System.Management.ManagementObject PrivateLateBoundObject; - + // Member variable to store the 'automatic commit' behavior for the class. private bool AutoCommitProp; - + // Private variable to hold the embedded property representing the instance. private System.Management.ManagementBaseObject embeddedObj; - + // The current WMI object used private System.Management.ManagementBaseObject curObj; - + // Flag to indicate if the instance is an embedded object. private bool isEmbedded; - + // Below are different overloads of constructors to initialize an instance of the class with a WMI object. public ShutdownComponent() { this.InitializeObject(null, null, null); } - + public ShutdownComponent(string keyCreationClassName, string keyDeviceID, string keySystemCreationClassName, string keySystemName) { this.InitializeObject(null, new System.Management.ManagementPath(ShutdownComponent.ConstructPath(keyCreationClassName, keyDeviceID, keySystemCreationClassName, keySystemName)), null); } - + public ShutdownComponent(System.Management.ManagementScope mgmtScope, string keyCreationClassName, string keyDeviceID, string keySystemCreationClassName, string keySystemName) { this.InitializeObject(((System.Management.ManagementScope)(mgmtScope)), new System.Management.ManagementPath(ShutdownComponent.ConstructPath(keyCreationClassName, keyDeviceID, keySystemCreationClassName, keySystemName)), null); } - + public ShutdownComponent(System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(null, path, getOptions); } - + public ShutdownComponent(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path) { this.InitializeObject(mgmtScope, path, null); } - + public ShutdownComponent(System.Management.ManagementPath path) { this.InitializeObject(null, path, null); } - + public ShutdownComponent(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(mgmtScope, path, getOptions); } - + public ShutdownComponent(System.Management.ManagementObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -99,7 +99,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { throw new System.ArgumentException("Class name does not match."); } } - + public ShutdownComponent(System.Management.ManagementBaseObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -112,7 +112,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { throw new System.ArgumentException("Class name does not match."); } } - + // Property returns the namespace of the WMI class. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -121,7 +121,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return "ROOT\\virtualization\\v2"; } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ManagementClassName { @@ -130,7 +130,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { if ((curObj != null)) { if ((curObj.ClassPath != null)) { strRet = ((string)(curObj["__CLASS"])); - if (((strRet == null) + if (((strRet == null) || (strRet == string.Empty))) { strRet = CreatedClassName; } @@ -139,7 +139,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return strRet; } } - + // Property pointing to an embedded object to get System properties of the WMI object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -148,7 +148,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return PrivateSystemProperties; } } - + // Property returning the underlying lateBound object. [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -157,7 +157,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return curObj; } } - + // ManagementScope of the object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -176,7 +176,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + // Property to show the commit behavior for the WMI object. If true, WMI object will be automatically saved after each property modification.(ie. Put() is called after modification of a property). [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -188,7 +188,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { AutoCommitProp = value; } } - + // The ManagementPath of the underlying WMI object. [Browsable(true)] public System.Management.ManagementPath Path { @@ -209,7 +209,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + // Public static scope property which is used by the various methods. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -221,7 +221,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { statMgmtScope = value; } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public ushort[] AdditionalAvailability { @@ -229,7 +229,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort[])(curObj["AdditionalAvailability"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsAvailabilityNull { @@ -242,7 +242,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -254,7 +254,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["Availability"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public ushort[] AvailableRequestedStates { @@ -262,7 +262,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort[])(curObj["AvailableRequestedStates"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Caption { @@ -270,7 +270,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Caption"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsCommunicationStatusNull { @@ -283,7 +283,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -295,7 +295,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["CommunicationStatus"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string CreationClassName { @@ -303,7 +303,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["CreationClassName"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Description { @@ -311,7 +311,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Description"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsDetailedStatusNull { @@ -324,7 +324,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -336,7 +336,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["DetailedStatus"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string DeviceID { @@ -344,7 +344,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["DeviceID"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ElementName { @@ -352,7 +352,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["ElementName"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsEnabledDefaultNull { @@ -365,7 +365,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -377,7 +377,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["EnabledDefault"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsEnabledStateNull { @@ -390,7 +390,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -402,7 +402,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["EnabledState"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsErrorClearedNull { @@ -415,7 +415,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -427,7 +427,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((bool)(curObj["ErrorCleared"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ErrorDescription { @@ -435,7 +435,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["ErrorDescription"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsHealthStateNull { @@ -448,7 +448,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -460,7 +460,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["HealthState"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string[] IdentifyingDescriptions { @@ -468,7 +468,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string[])(curObj["IdentifyingDescriptions"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsInstallDateNull { @@ -481,7 +481,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -495,7 +495,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string InstanceID { @@ -503,7 +503,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["InstanceID"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsLastErrorCodeNull { @@ -516,7 +516,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -528,7 +528,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((uint)(curObj["LastErrorCode"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsMaxQuiesceTimeNull { @@ -541,7 +541,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -553,7 +553,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ulong)(curObj["MaxQuiesceTime"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Name { @@ -561,7 +561,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Name"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsOperatingStatusNull { @@ -574,7 +574,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -586,7 +586,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["OperatingStatus"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public ushort[] OperationalStatus { @@ -594,7 +594,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort[])(curObj["OperationalStatus"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string OtherEnabledState { @@ -602,7 +602,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["OtherEnabledState"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string[] OtherIdentifyingInfo { @@ -610,7 +610,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string[])(curObj["OtherIdentifyingInfo"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public ushort[] PowerManagementCapabilities { @@ -618,7 +618,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort[])(curObj["PowerManagementCapabilities"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPowerManagementSupportedNull { @@ -631,7 +631,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -643,7 +643,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((bool)(curObj["PowerManagementSupported"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPowerOnHoursNull { @@ -656,7 +656,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -668,7 +668,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ulong)(curObj["PowerOnHours"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPrimaryStatusNull { @@ -681,7 +681,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -693,7 +693,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["PrimaryStatus"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsRequestedStateNull { @@ -706,7 +706,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -718,7 +718,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["RequestedState"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Status { @@ -726,7 +726,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Status"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string[] StatusDescriptions { @@ -734,7 +734,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string[])(curObj["StatusDescriptions"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsStatusInfoNull { @@ -747,7 +747,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -759,7 +759,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["StatusInfo"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string SystemCreationClassName { @@ -767,7 +767,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["SystemCreationClassName"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string SystemName { @@ -775,7 +775,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["SystemName"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsTimeOfLastStateChangeNull { @@ -788,7 +788,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -802,7 +802,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsTotalPowerOnHoursNull { @@ -815,7 +815,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -827,7 +827,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ulong)(curObj["TotalPowerOnHours"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsTransitioningToStateNull { @@ -840,7 +840,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -852,9 +852,9 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["TransitioningToState"])); } } - + private bool CheckIfProperClass(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions OptionsParam) { - if (((path != null) + if (((path != null) && (string.Compare(path.ClassName, this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -862,9 +862,9 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return CheckIfProperClass(new System.Management.ManagementObject(mgmtScope, path, OptionsParam)); } } - + private bool CheckIfProperClass(System.Management.ManagementBaseObject theObj) { - if (((theObj != null) + if (((theObj != null) && (string.Compare(((string)(theObj["__CLASS"])), this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -881,56 +881,56 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } return false; } - + private bool ShouldSerializeAvailability() { if ((this.IsAvailabilityNull == false)) { return true; } return false; } - + private bool ShouldSerializeCommunicationStatus() { if ((this.IsCommunicationStatusNull == false)) { return true; } return false; } - + private bool ShouldSerializeDetailedStatus() { if ((this.IsDetailedStatusNull == false)) { return true; } return false; } - + private bool ShouldSerializeEnabledDefault() { if ((this.IsEnabledDefaultNull == false)) { return true; } return false; } - + private bool ShouldSerializeEnabledState() { if ((this.IsEnabledStateNull == false)) { return true; } return false; } - + private bool ShouldSerializeErrorCleared() { if ((this.IsErrorClearedNull == false)) { return true; } return false; } - + private bool ShouldSerializeHealthState() { if ((this.IsHealthStateNull == false)) { return true; } return false; } - + // Converts a given datetime in DMTF format to System.DateTime object. static System.DateTime ToDateTime(string dmtfDate) { System.DateTime initializer = System.DateTime.MinValue; @@ -982,13 +982,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { if (("******" != tempString)) { ticks = (long.Parse(tempString) * ((long)((System.TimeSpan.TicksPerMillisecond / 1000)))); } - if (((((((((year < 0) - || (month < 0)) - || (day < 0)) - || (hour < 0)) - || (minute < 0)) - || (minute < 0)) - || (second < 0)) + if (((((((((year < 0) + || (month < 0)) + || (day < 0)) + || (hour < 0)) + || (minute < 0)) + || (minute < 0)) + || (second < 0)) || (ticks < 0))) { throw new System.ArgumentOutOfRangeException(); } @@ -1016,7 +1016,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } return datetime; } - + // Converts a given System.DateTime object to DMTF datetime format. static string ToDmtfDateTime(System.DateTime date) { string utcString = string.Empty; @@ -1043,8 +1043,8 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { dmtfDateTime = string.Concat(dmtfDateTime, ((int)(date.Second)).ToString().PadLeft(2, '0')); dmtfDateTime = string.Concat(dmtfDateTime, "."); System.DateTime dtTemp = new System.DateTime(date.Year, date.Month, date.Day, date.Hour, date.Minute, date.Second, 0); - long microsec = ((long)((((date.Ticks - dtTemp.Ticks) - * 1000) + long microsec = ((long)((((date.Ticks - dtTemp.Ticks) + * 1000) / System.TimeSpan.TicksPerMillisecond))); string strMicrosec = ((long)(microsec)).ToString(); if ((strMicrosec.Length > 6)) { @@ -1054,110 +1054,110 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { dmtfDateTime = string.Concat(dmtfDateTime, utcString); return dmtfDateTime; } - + private bool ShouldSerializeInstallDate() { if ((this.IsInstallDateNull == false)) { return true; } return false; } - + private bool ShouldSerializeLastErrorCode() { if ((this.IsLastErrorCodeNull == false)) { return true; } return false; } - + private bool ShouldSerializeMaxQuiesceTime() { if ((this.IsMaxQuiesceTimeNull == false)) { return true; } return false; } - + private bool ShouldSerializeOperatingStatus() { if ((this.IsOperatingStatusNull == false)) { return true; } return false; } - + private bool ShouldSerializePowerManagementSupported() { if ((this.IsPowerManagementSupportedNull == false)) { return true; } return false; } - + private bool ShouldSerializePowerOnHours() { if ((this.IsPowerOnHoursNull == false)) { return true; } return false; } - + private bool ShouldSerializePrimaryStatus() { if ((this.IsPrimaryStatusNull == false)) { return true; } return false; } - + private bool ShouldSerializeRequestedState() { if ((this.IsRequestedStateNull == false)) { return true; } return false; } - + private bool ShouldSerializeStatusInfo() { if ((this.IsStatusInfoNull == false)) { return true; } return false; } - + private bool ShouldSerializeTimeOfLastStateChange() { if ((this.IsTimeOfLastStateChangeNull == false)) { return true; } return false; } - + private bool ShouldSerializeTotalPowerOnHours() { if ((this.IsTotalPowerOnHoursNull == false)) { return true; } return false; } - + private bool ShouldSerializeTransitioningToState() { if ((this.IsTransitioningToStateNull == false)) { return true; } return false; } - + [Browsable(true)] public void CommitObject() { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(); } } - + [Browsable(true)] public void CommitObject(System.Management.PutOptions putOptions) { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(putOptions); } } - + private void Initialize() { AutoCommitProp = true; isEmbedded = false; } - + private static string ConstructPath(string keyCreationClassName, string keyDeviceID, string keySystemCreationClassName, string keySystemName) { string strPath = "ROOT\\virtualization\\v2:Msvm_ShutdownComponent"; strPath = string.Concat(strPath, string.Concat(".CreationClassName=", string.Concat("\"", string.Concat(keyCreationClassName, "\"")))); @@ -1166,7 +1166,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { strPath = string.Concat(strPath, string.Concat(",SystemName=", string.Concat("\"", string.Concat(keySystemName, "\"")))); return strPath; } - + private void InitializeObject(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { Initialize(); if ((path != null)) { @@ -1178,24 +1178,24 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { PrivateSystemProperties = new ManagementSystemProperties(PrivateLateBoundObject); curObj = PrivateLateBoundObject; } - + // Different overloads of GetInstances() help in enumerating instances of the WMI class. public static ShutdownComponentCollection GetInstances() { return GetInstances(null, null, null); } - + public static ShutdownComponentCollection GetInstances(string condition) { return GetInstances(null, condition, null); } - + public static ShutdownComponentCollection GetInstances(string[] selectedProperties) { return GetInstances(null, null, selectedProperties); } - + public static ShutdownComponentCollection GetInstances(string condition, string[] selectedProperties) { return GetInstances(null, condition, selectedProperties); } - + public static ShutdownComponentCollection GetInstances(System.Management.ManagementScope mgmtScope, System.Management.EnumerationOptions enumOptions) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -1216,15 +1216,15 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } return new ShutdownComponentCollection(clsObject.GetInstances(enumOptions)); } - + public static ShutdownComponentCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition) { return GetInstances(mgmtScope, condition, null); } - + public static ShutdownComponentCollection GetInstances(System.Management.ManagementScope mgmtScope, string[] selectedProperties) { return GetInstances(mgmtScope, null, selectedProperties); } - + public static ShutdownComponentCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition, string[] selectedProperties) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -1241,7 +1241,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { ObjectSearcher.Options = enumOptions; return new ShutdownComponentCollection(ObjectSearcher.Get()); } - + [Browsable(true)] public static ShutdownComponent CreateInstance() { System.Management.ManagementScope mgmtScope = null; @@ -1256,12 +1256,12 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { System.Management.ManagementClass tmpMgmtClass = new System.Management.ManagementClass(mgmtScope, mgmtPath, null); return new ShutdownComponent(tmpMgmtClass.CreateInstance()); } - + [Browsable(true)] public void Delete() { PrivateLateBoundObject.Delete(); } - + public uint EnableDevice(bool Enabled) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1274,7 +1274,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint InitiateShutdown(bool Force, string Reason) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1288,7 +1288,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint OnlineDevice(bool Online) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1301,7 +1301,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint QuiesceDevice(bool Quiesce) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1314,7 +1314,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint RequestStateChange(ushort RequestedState, System.DateTime TimeoutPeriod, out System.Management.ManagementPath Job) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1333,7 +1333,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint Reset() { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1344,7 +1344,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint RestoreProperties() { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1355,7 +1355,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint SaveProperties() { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1366,7 +1366,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint SetPowerState(ushort PowerState, System.DateTime Time) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1380,34 +1380,34 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + // Enumerator implementation for enumerating instances of the class. public class ShutdownComponentCollection : object, ICollection { - + private ManagementObjectCollection privColObj; - + public ShutdownComponentCollection(ManagementObjectCollection objCollection) { privColObj = objCollection; } - + public virtual int Count { get { return privColObj.Count; } } - + public virtual bool IsSynchronized { get { return privColObj.IsSynchronized; } } - + public virtual object SyncRoot { get { return this; } } - + public virtual void CopyTo(System.Array array, int index) { privColObj.CopyTo(array, index); int nCtr; @@ -1415,189 +1415,189 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { array.SetValue(new ShutdownComponent(((System.Management.ManagementObject)(array.GetValue(nCtr)))), nCtr); } } - + public virtual System.Collections.IEnumerator GetEnumerator() { return new ShutdownComponentEnumerator(privColObj.GetEnumerator()); } - + public class ShutdownComponentEnumerator : object, System.Collections.IEnumerator { - + private ManagementObjectCollection.ManagementObjectEnumerator privObjEnum; - + public ShutdownComponentEnumerator(ManagementObjectCollection.ManagementObjectEnumerator objEnum) { privObjEnum = objEnum; } - + public virtual object Current { get { return new ShutdownComponent(((System.Management.ManagementObject)(privObjEnum.Current))); } } - + public virtual bool MoveNext() { return privObjEnum.MoveNext(); } - + public virtual void Reset() { privObjEnum.Reset(); } } } - + // TypeConverter to handle null values for ValueType properties public class WMIValueTypeConverter : TypeConverter { - + private TypeConverter baseConverter; - + private System.Type baseType; - + public WMIValueTypeConverter(System.Type inBaseType) { baseConverter = TypeDescriptor.GetConverter(inBaseType); baseType = inBaseType; } - + 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 ((baseType.BaseType == typeof(System.Enum))) { if ((value.GetType() == destinationType)) { return value; } - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return "NULL_ENUM_VALUE" ; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((baseType == typeof(bool)) + if (((baseType == typeof(bool)) && (baseType.BaseType == typeof(System.ValueType)))) { - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((context != null) + if (((context != null) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } } - + // Embedded class to represent WMI system Properties. [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 { diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_StorageAllocationSettingData.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_StorageAllocationSettingData.cs index 602347f90dc..b9b58816539 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_StorageAllocationSettingData.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_StorageAllocationSettingData.cs @@ -23,70 +23,70 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { using System.Globalization; using System.ComponentModel.Design.Serialization; using System.Reflection; - - + + // Functions ShouldSerialize are functions used by VS property browser to check if a particular property has to be serialized. These functions are added for all ValueType properties ( properties of type Int32, BOOL etc.. which cannot be set to null). These functions use IsNull function. These functions are also used in the TypeConverter implementation for the properties to check for NULL value of property so that an empty value can be shown in Property browser in case of Drag and Drop in Visual studio. // Functions IsNull() are used to check if a property is NULL. // Functions Reset are added for Nullable Read/Write properties. These functions are used by VS designer in property browser to set a property to NULL. // Every property added to the class for WMI property has attributes set to define its behavior in Visual Studio designer and also to define a TypeConverter to be used. // An Early Bound class generated for the WMI class.Msvm_StorageAllocationSettingData public class StorageAllocationSettingData : System.ComponentModel.Component { - + // Private property to hold the WMI namespace in which the class resides. private static string CreatedWmiNamespace = "ROOT\\virtualization\\v2"; - + // Private property to hold the name of WMI class which created this class. public static string CreatedClassName = "Msvm_StorageAllocationSettingData"; - + // Private member variable to hold the ManagementScope which is used by the various methods. private static System.Management.ManagementScope statMgmtScope = null; - + private ManagementSystemProperties PrivateSystemProperties; - + // Underlying lateBound WMI object. private System.Management.ManagementObject PrivateLateBoundObject; - + // Member variable to store the 'automatic commit' behavior for the class. private bool AutoCommitProp; - + // Private variable to hold the embedded property representing the instance. private System.Management.ManagementBaseObject embeddedObj; - + // The current WMI object used private System.Management.ManagementBaseObject curObj; - + // Flag to indicate if the instance is an embedded object. private bool isEmbedded; - + // Below are different overloads of constructors to initialize an instance of the class with a WMI object. public StorageAllocationSettingData() { this.InitializeObject(null, null, null); } - + public StorageAllocationSettingData(string keyInstanceID) { this.InitializeObject(null, new System.Management.ManagementPath(StorageAllocationSettingData.ConstructPath(keyInstanceID)), null); } - + public StorageAllocationSettingData(System.Management.ManagementScope mgmtScope, string keyInstanceID) { this.InitializeObject(((System.Management.ManagementScope)(mgmtScope)), new System.Management.ManagementPath(StorageAllocationSettingData.ConstructPath(keyInstanceID)), null); } - + public StorageAllocationSettingData(System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(null, path, getOptions); } - + public StorageAllocationSettingData(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path) { this.InitializeObject(mgmtScope, path, null); } - + public StorageAllocationSettingData(System.Management.ManagementPath path) { this.InitializeObject(null, path, null); } - + public StorageAllocationSettingData(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(mgmtScope, path, getOptions); } - + public StorageAllocationSettingData(System.Management.ManagementObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -98,7 +98,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { throw new System.ArgumentException("Class name does not match."); } } - + public StorageAllocationSettingData(System.Management.ManagementBaseObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -111,7 +111,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { throw new System.ArgumentException("Class name does not match."); } } - + // Property returns the namespace of the WMI class. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -120,7 +120,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return "ROOT\\virtualization\\v2"; } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ManagementClassName { @@ -129,7 +129,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { if ((curObj != null)) { if ((curObj.ClassPath != null)) { strRet = ((string)(curObj["__CLASS"])); - if (((strRet == null) + if (((strRet == null) || (strRet == string.Empty))) { strRet = CreatedClassName; } @@ -138,7 +138,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return strRet; } } - + // Property pointing to an embedded object to get System properties of the WMI object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -147,7 +147,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return PrivateSystemProperties; } } - + // Property returning the underlying lateBound object. [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -156,7 +156,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return curObj; } } - + // ManagementScope of the object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -175,7 +175,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + // Property to show the commit behavior for the WMI object. If true, WMI object will be automatically saved after each property modification.(ie. Put() is called after modification of a property). [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -187,7 +187,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { AutoCommitProp = value; } } - + // The ManagementPath of the underlying WMI object. [Browsable(true)] public System.Management.ManagementPath Path { @@ -208,7 +208,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + // Public static scope property which is used by the various methods. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -220,7 +220,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { statMgmtScope = value; } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsAccessNull { @@ -233,7 +233,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -245,7 +245,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["Access"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Address { @@ -253,7 +253,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Address"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string AddressOnParent { @@ -261,7 +261,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["AddressOnParent"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string AllocationUnits { @@ -269,7 +269,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["AllocationUnits"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsAutomaticAllocationNull { @@ -282,7 +282,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -294,7 +294,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((bool)(curObj["AutomaticAllocation"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsAutomaticDeallocationNull { @@ -307,7 +307,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -319,7 +319,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((bool)(curObj["AutomaticDeallocation"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Caption { @@ -327,7 +327,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Caption"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string[] Connection { @@ -335,7 +335,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string[])(curObj["Connection"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsConsumerVisibilityNull { @@ -348,7 +348,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -360,7 +360,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["ConsumerVisibility"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Description { @@ -368,7 +368,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Description"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ElementName { @@ -376,7 +376,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["ElementName"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string HostExtentName { @@ -384,7 +384,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["HostExtentName"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsHostExtentNameFormatNull { @@ -397,7 +397,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -409,7 +409,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["HostExtentNameFormat"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsHostExtentNameNamespaceNull { @@ -422,7 +422,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -434,7 +434,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["HostExtentNameNamespace"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsHostExtentStartingAddressNull { @@ -447,7 +447,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -459,7 +459,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ulong)(curObj["HostExtentStartingAddress"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string[] HostResource { @@ -467,7 +467,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string[])(curObj["HostResource"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsHostResourceBlockSizeNull { @@ -480,7 +480,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -492,7 +492,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ulong)(curObj["HostResourceBlockSize"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string InstanceID { @@ -500,7 +500,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["InstanceID"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsLimitNull { @@ -513,7 +513,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -525,7 +525,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ulong)(curObj["Limit"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsMappingBehaviorNull { @@ -538,7 +538,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -550,7 +550,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["MappingBehavior"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string OtherHostExtentNameFormat { @@ -558,7 +558,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["OtherHostExtentNameFormat"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string OtherHostExtentNameNamespace { @@ -566,7 +566,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["OtherHostExtentNameNamespace"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string OtherResourceType { @@ -574,7 +574,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["OtherResourceType"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Parent { @@ -582,7 +582,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Parent"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string PoolID { @@ -590,7 +590,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["PoolID"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsReservationNull { @@ -603,7 +603,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -615,7 +615,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ulong)(curObj["Reservation"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ResourceSubType { @@ -623,7 +623,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["ResourceSubType"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsResourceTypeNull { @@ -636,7 +636,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -648,7 +648,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["ResourceType"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsVirtualQuantityNull { @@ -661,7 +661,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -673,7 +673,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ulong)(curObj["VirtualQuantity"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string VirtualQuantityUnits { @@ -681,7 +681,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["VirtualQuantityUnits"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsVirtualResourceBlockSizeNull { @@ -694,7 +694,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -706,7 +706,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ulong)(curObj["VirtualResourceBlockSize"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsWeightNull { @@ -719,7 +719,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -731,9 +731,9 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((uint)(curObj["Weight"])); } } - + private bool CheckIfProperClass(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions OptionsParam) { - if (((path != null) + if (((path != null) && (string.Compare(path.ClassName, this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -741,9 +741,9 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return CheckIfProperClass(new System.Management.ManagementObject(mgmtScope, path, OptionsParam)); } } - + private bool CheckIfProperClass(System.Management.ManagementBaseObject theObj) { - if (((theObj != null) + if (((theObj != null) && (string.Compare(((string)(theObj["__CLASS"])), this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -760,137 +760,137 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } return false; } - + private bool ShouldSerializeAccess() { if ((this.IsAccessNull == false)) { return true; } return false; } - + private bool ShouldSerializeAutomaticAllocation() { if ((this.IsAutomaticAllocationNull == false)) { return true; } return false; } - + private bool ShouldSerializeAutomaticDeallocation() { if ((this.IsAutomaticDeallocationNull == false)) { return true; } return false; } - + private bool ShouldSerializeConsumerVisibility() { if ((this.IsConsumerVisibilityNull == false)) { return true; } return false; } - + private bool ShouldSerializeHostExtentNameFormat() { if ((this.IsHostExtentNameFormatNull == false)) { return true; } return false; } - + private bool ShouldSerializeHostExtentNameNamespace() { if ((this.IsHostExtentNameNamespaceNull == false)) { return true; } return false; } - + private bool ShouldSerializeHostExtentStartingAddress() { if ((this.IsHostExtentStartingAddressNull == false)) { return true; } return false; } - + private bool ShouldSerializeHostResourceBlockSize() { if ((this.IsHostResourceBlockSizeNull == false)) { return true; } return false; } - + private bool ShouldSerializeLimit() { if ((this.IsLimitNull == false)) { return true; } return false; } - + private bool ShouldSerializeMappingBehavior() { if ((this.IsMappingBehaviorNull == false)) { return true; } return false; } - + private bool ShouldSerializeReservation() { if ((this.IsReservationNull == false)) { return true; } return false; } - + private bool ShouldSerializeResourceType() { if ((this.IsResourceTypeNull == false)) { return true; } return false; } - + private bool ShouldSerializeVirtualQuantity() { if ((this.IsVirtualQuantityNull == false)) { return true; } return false; } - + private bool ShouldSerializeVirtualResourceBlockSize() { if ((this.IsVirtualResourceBlockSizeNull == false)) { return true; } return false; } - + private bool ShouldSerializeWeight() { if ((this.IsWeightNull == false)) { return true; } return false; } - + [Browsable(true)] public void CommitObject() { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(); } } - + [Browsable(true)] public void CommitObject(System.Management.PutOptions putOptions) { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(putOptions); } } - + private void Initialize() { AutoCommitProp = true; isEmbedded = false; } - + private static string ConstructPath(string keyInstanceID) { string strPath = "ROOT\\virtualization\\v2:Msvm_StorageAllocationSettingData"; strPath = string.Concat(strPath, string.Concat(".InstanceID=", string.Concat("\"", string.Concat(keyInstanceID, "\"")))); return strPath; } - + private void InitializeObject(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { Initialize(); if ((path != null)) { @@ -902,24 +902,24 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { PrivateSystemProperties = new ManagementSystemProperties(PrivateLateBoundObject); curObj = PrivateLateBoundObject; } - + // Different overloads of GetInstances() help in enumerating instances of the WMI class. public static StorageAllocationSettingDataCollection GetInstances() { return GetInstances(null, null, null); } - + public static StorageAllocationSettingDataCollection GetInstances(string condition) { return GetInstances(null, condition, null); } - + public static StorageAllocationSettingDataCollection GetInstances(string[] selectedProperties) { return GetInstances(null, null, selectedProperties); } - + public static StorageAllocationSettingDataCollection GetInstances(string condition, string[] selectedProperties) { return GetInstances(null, condition, selectedProperties); } - + public static StorageAllocationSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, System.Management.EnumerationOptions enumOptions) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -940,15 +940,15 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } return new StorageAllocationSettingDataCollection(clsObject.GetInstances(enumOptions)); } - + public static StorageAllocationSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition) { return GetInstances(mgmtScope, condition, null); } - + public static StorageAllocationSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string[] selectedProperties) { return GetInstances(mgmtScope, null, selectedProperties); } - + public static StorageAllocationSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition, string[] selectedProperties) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -965,7 +965,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { ObjectSearcher.Options = enumOptions; return new StorageAllocationSettingDataCollection(ObjectSearcher.Get()); } - + [Browsable(true)] public static StorageAllocationSettingData CreateInstance() { System.Management.ManagementScope mgmtScope = null; @@ -980,39 +980,39 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { System.Management.ManagementClass tmpMgmtClass = new System.Management.ManagementClass(mgmtScope, mgmtPath, null); return new StorageAllocationSettingData(tmpMgmtClass.CreateInstance()); } - + [Browsable(true)] public void Delete() { PrivateLateBoundObject.Delete(); } - + // Enumerator implementation for enumerating instances of the class. public class StorageAllocationSettingDataCollection : object, ICollection { - + private ManagementObjectCollection privColObj; - + public StorageAllocationSettingDataCollection(ManagementObjectCollection objCollection) { privColObj = objCollection; } - + public virtual int Count { get { return privColObj.Count; } } - + public virtual bool IsSynchronized { get { return privColObj.IsSynchronized; } } - + public virtual object SyncRoot { get { return this; } } - + public virtual void CopyTo(System.Array array, int index) { privColObj.CopyTo(array, index); int nCtr; @@ -1020,189 +1020,189 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { array.SetValue(new StorageAllocationSettingData(((System.Management.ManagementObject)(array.GetValue(nCtr)))), nCtr); } } - + public virtual System.Collections.IEnumerator GetEnumerator() { return new StorageAllocationSettingDataEnumerator(privColObj.GetEnumerator()); } - + public class StorageAllocationSettingDataEnumerator : object, System.Collections.IEnumerator { - + private ManagementObjectCollection.ManagementObjectEnumerator privObjEnum; - + public StorageAllocationSettingDataEnumerator(ManagementObjectCollection.ManagementObjectEnumerator objEnum) { privObjEnum = objEnum; } - + public virtual object Current { get { return new StorageAllocationSettingData(((System.Management.ManagementObject)(privObjEnum.Current))); } } - + public virtual bool MoveNext() { return privObjEnum.MoveNext(); } - + public virtual void Reset() { privObjEnum.Reset(); } } } - + // TypeConverter to handle null values for ValueType properties public class WMIValueTypeConverter : TypeConverter { - + private TypeConverter baseConverter; - + private System.Type baseType; - + public WMIValueTypeConverter(System.Type inBaseType) { baseConverter = TypeDescriptor.GetConverter(inBaseType); baseType = inBaseType; } - + 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 ((baseType.BaseType == typeof(System.Enum))) { if ((value.GetType() == destinationType)) { return value; } - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return "NULL_ENUM_VALUE" ; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((baseType == typeof(bool)) + if (((baseType == typeof(bool)) && (baseType.BaseType == typeof(System.ValueType)))) { - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((context != null) + if (((context != null) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } } - + // Embedded class to represent WMI system Properties. [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 { diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_StorageJob.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_StorageJob.cs index 5a101f1bfeb..2daa32f914e 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_StorageJob.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_StorageJob.cs @@ -32,62 +32,62 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { // Datetime conversion functions ToDateTime and ToDmtfDateTime are added to the class to convert DMTF datetime to System.DateTime and vice-versa. // An Early Bound class generated for the WMI class.Msvm_StorageJob public class StorageJob : System.ComponentModel.Component { - + // Private property to hold the WMI namespace in which the class resides. private static string CreatedWmiNamespace = "ROOT\\virtualization\\v2"; - + // Private property to hold the name of WMI class which created this class. public static string CreatedClassName = "Msvm_StorageJob"; - + // Private member variable to hold the ManagementScope which is used by the various methods. private static System.Management.ManagementScope statMgmtScope = null; - + private ManagementSystemProperties PrivateSystemProperties; - + // Underlying lateBound WMI object. private System.Management.ManagementObject PrivateLateBoundObject; - + // Member variable to store the 'automatic commit' behavior for the class. private bool AutoCommitProp; - + // Private variable to hold the embedded property representing the instance. private System.Management.ManagementBaseObject embeddedObj; - + // The current WMI object used private System.Management.ManagementBaseObject curObj; - + // Flag to indicate if the instance is an embedded object. private bool isEmbedded; - + // Below are different overloads of constructors to initialize an instance of the class with a WMI object. public StorageJob() { this.InitializeObject(null, null, null); } - + public StorageJob(string keyInstanceID) { this.InitializeObject(null, new System.Management.ManagementPath(StorageJob.ConstructPath(keyInstanceID)), null); } - + public StorageJob(System.Management.ManagementScope mgmtScope, string keyInstanceID) { this.InitializeObject(((System.Management.ManagementScope)(mgmtScope)), new System.Management.ManagementPath(StorageJob.ConstructPath(keyInstanceID)), null); } - + public StorageJob(System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(null, path, getOptions); } - + public StorageJob(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path) { this.InitializeObject(mgmtScope, path, null); } - + public StorageJob(System.Management.ManagementPath path) { this.InitializeObject(null, path, null); } - + public StorageJob(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(mgmtScope, path, getOptions); } - + public StorageJob(System.Management.ManagementObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -99,7 +99,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { throw new System.ArgumentException("Class name does not match."); } } - + public StorageJob(System.Management.ManagementBaseObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -112,7 +112,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { throw new System.ArgumentException("Class name does not match."); } } - + // Property returns the namespace of the WMI class. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -121,7 +121,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return "ROOT\\virtualization\\v2"; } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ManagementClassName { @@ -130,7 +130,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { if ((curObj != null)) { if ((curObj.ClassPath != null)) { strRet = ((string)(curObj["__CLASS"])); - if (((strRet == null) + if (((strRet == null) || (strRet == string.Empty))) { strRet = CreatedClassName; } @@ -139,7 +139,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return strRet; } } - + // Property pointing to an embedded object to get System properties of the WMI object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -148,7 +148,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return PrivateSystemProperties; } } - + // Property returning the underlying lateBound object. [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -157,7 +157,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return curObj; } } - + // ManagementScope of the object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -176,7 +176,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + // Property to show the commit behavior for the WMI object. If true, WMI object will be automatically saved after each property modification.(ie. Put() is called after modification of a property). [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -188,7 +188,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { AutoCommitProp = value; } } - + // The ManagementPath of the underlying WMI object. [Browsable(true)] public System.Management.ManagementPath Path { @@ -209,7 +209,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + // Public static scope property which is used by the various methods. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -221,7 +221,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { statMgmtScope = value; } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsCancellableNull { @@ -234,7 +234,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("Indicates whether the job can be cancelled. The value of this property does not g" + @@ -248,7 +248,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((bool)(curObj["Cancellable"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Caption { @@ -256,7 +256,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Caption"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("On failure of the asynchronous operation, this property contains the file path to" + @@ -266,7 +266,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Child"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsCommunicationStatusNull { @@ -279,7 +279,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -291,7 +291,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["CommunicationStatus"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsDeleteOnCompletionNull { @@ -304,7 +304,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -316,7 +316,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((bool)(curObj["DeleteOnCompletion"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Description { @@ -324,7 +324,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Description"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsDetailedStatusNull { @@ -337,7 +337,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -349,7 +349,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["DetailedStatus"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsElapsedTimeNull { @@ -362,7 +362,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -376,7 +376,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ElementName { @@ -384,7 +384,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["ElementName"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsErrorCodeNull { @@ -397,7 +397,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -409,7 +409,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["ErrorCode"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ErrorDescription { @@ -417,7 +417,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["ErrorDescription"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ErrorSummaryDescription { @@ -425,7 +425,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["ErrorSummaryDescription"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsHealthStateNull { @@ -438,7 +438,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -450,7 +450,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["HealthState"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsInstallDateNull { @@ -463,7 +463,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -477,7 +477,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string InstanceID { @@ -485,7 +485,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["InstanceID"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsJobCompletionStatusCodeNull { @@ -498,7 +498,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The HRESULT code that describes the completion status for the asynchronous operat" + @@ -512,7 +512,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((uint)(curObj["JobCompletionStatusCode"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsJobRunTimesNull { @@ -525,7 +525,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -537,7 +537,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((uint)(curObj["JobRunTimes"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsJobStateNull { @@ -550,7 +550,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -562,7 +562,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["JobState"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string JobStatus { @@ -570,7 +570,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["JobStatus"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsJobTypeNull { @@ -583,7 +583,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"The type of asynchronous operation being tracked by this instance of Msvm_StorageJob. @@ -607,7 +607,7 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] return ((JobTypeValues)(System.Convert.ToInt32(curObj["JobType"]))); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsLocalOrUtcTimeNull { @@ -620,7 +620,7 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -632,7 +632,7 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] return ((ushort)(curObj["LocalOrUtcTime"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Name { @@ -640,7 +640,7 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] return ((string)(curObj["Name"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Notify { @@ -648,7 +648,7 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] return ((string)(curObj["Notify"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsOperatingStatusNull { @@ -661,7 +661,7 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -673,7 +673,7 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] return ((ushort)(curObj["OperatingStatus"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public ushort[] OperationalStatus { @@ -681,7 +681,7 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] return ((ushort[])(curObj["OperationalStatus"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string OtherRecoveryAction { @@ -689,7 +689,7 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] return ((string)(curObj["OtherRecoveryAction"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Owner { @@ -697,7 +697,7 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] return ((string)(curObj["Owner"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("On failure of the asynchronous operation, this property contains the file path to" + @@ -707,7 +707,7 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] return ((string)(curObj["Parent"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPercentCompleteNull { @@ -720,7 +720,7 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -732,7 +732,7 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] return ((ushort)(curObj["PercentComplete"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPrimaryStatusNull { @@ -745,7 +745,7 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -757,7 +757,7 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] return ((ushort)(curObj["PrimaryStatus"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPriorityNull { @@ -770,7 +770,7 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -782,7 +782,7 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] return ((uint)(curObj["Priority"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsRecoveryActionNull { @@ -795,7 +795,7 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -807,7 +807,7 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] return ((ushort)(curObj["RecoveryAction"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsRunDayNull { @@ -820,7 +820,7 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -832,7 +832,7 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] return ((sbyte)(curObj["RunDay"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsRunDayOfWeekNull { @@ -845,7 +845,7 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -857,7 +857,7 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] return ((sbyte)(curObj["RunDayOfWeek"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsRunMonthNull { @@ -870,7 +870,7 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -882,7 +882,7 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] return ((byte)(curObj["RunMonth"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsRunStartIntervalNull { @@ -895,7 +895,7 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -909,7 +909,7 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsScheduledStartTimeNull { @@ -922,7 +922,7 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -936,7 +936,7 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsStartTimeNull { @@ -949,7 +949,7 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -963,7 +963,7 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Status { @@ -971,7 +971,7 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] return ((string)(curObj["Status"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string[] StatusDescriptions { @@ -979,7 +979,7 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] return ((string[])(curObj["StatusDescriptions"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsTimeBeforeRemovalNull { @@ -992,7 +992,7 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -1006,7 +1006,7 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsTimeOfLastStateChangeNull { @@ -1019,7 +1019,7 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -1033,7 +1033,7 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsTimeSubmittedNull { @@ -1046,7 +1046,7 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -1060,7 +1060,7 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsUntilTimeNull { @@ -1073,7 +1073,7 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -1087,9 +1087,9 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] } } } - + private bool CheckIfProperClass(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions OptionsParam) { - if (((path != null) + if (((path != null) && (string.Compare(path.ClassName, this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -1097,9 +1097,9 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] return CheckIfProperClass(new System.Management.ManagementObject(mgmtScope, path, OptionsParam)); } } - + private bool CheckIfProperClass(System.Management.ManagementBaseObject theObj) { - if (((theObj != null) + if (((theObj != null) && (string.Compare(((string)(theObj["__CLASS"])), this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -1116,35 +1116,35 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] } return false; } - + private bool ShouldSerializeCancellable() { if ((this.IsCancellableNull == false)) { return true; } return false; } - + private bool ShouldSerializeCommunicationStatus() { if ((this.IsCommunicationStatusNull == false)) { return true; } return false; } - + private bool ShouldSerializeDeleteOnCompletion() { if ((this.IsDeleteOnCompletionNull == false)) { return true; } return false; } - + private bool ShouldSerializeDetailedStatus() { if ((this.IsDetailedStatusNull == false)) { return true; } return false; } - + // Converts a given datetime in DMTF format to System.DateTime object. static System.DateTime ToDateTime(string dmtfDate) { System.DateTime initializer = System.DateTime.MinValue; @@ -1196,13 +1196,13 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] if (("******" != tempString)) { ticks = (long.Parse(tempString) * ((long)((System.TimeSpan.TicksPerMillisecond / 1000)))); } - if (((((((((year < 0) - || (month < 0)) - || (day < 0)) - || (hour < 0)) - || (minute < 0)) - || (minute < 0)) - || (second < 0)) + if (((((((((year < 0) + || (month < 0)) + || (day < 0)) + || (hour < 0)) + || (minute < 0)) + || (minute < 0)) + || (second < 0)) || (ticks < 0))) { throw new System.ArgumentOutOfRangeException(); } @@ -1230,7 +1230,7 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] } return datetime; } - + // Converts a given System.DateTime object to DMTF datetime format. static string ToDmtfDateTime(System.DateTime date) { string utcString = string.Empty; @@ -1257,8 +1257,8 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] dmtfDateTime = string.Concat(dmtfDateTime, ((int)(date.Second)).ToString().PadLeft(2, '0')); dmtfDateTime = string.Concat(dmtfDateTime, "."); System.DateTime dtTemp = new System.DateTime(date.Year, date.Month, date.Day, date.Hour, date.Minute, date.Second, 0); - long microsec = ((long)((((date.Ticks - dtTemp.Ticks) - * 1000) + long microsec = ((long)((((date.Ticks - dtTemp.Ticks) + * 1000) / System.TimeSpan.TicksPerMillisecond))); string strMicrosec = ((long)(microsec)).ToString(); if ((strMicrosec.Length > 6)) { @@ -1268,200 +1268,200 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] dmtfDateTime = string.Concat(dmtfDateTime, utcString); return dmtfDateTime; } - + private bool ShouldSerializeElapsedTime() { if ((this.IsElapsedTimeNull == false)) { return true; } return false; } - + private bool ShouldSerializeErrorCode() { if ((this.IsErrorCodeNull == false)) { return true; } return false; } - + private bool ShouldSerializeHealthState() { if ((this.IsHealthStateNull == false)) { return true; } return false; } - + private bool ShouldSerializeInstallDate() { if ((this.IsInstallDateNull == false)) { return true; } return false; } - + private bool ShouldSerializeJobCompletionStatusCode() { if ((this.IsJobCompletionStatusCodeNull == false)) { return true; } return false; } - + private bool ShouldSerializeJobRunTimes() { if ((this.IsJobRunTimesNull == false)) { return true; } return false; } - + private bool ShouldSerializeJobState() { if ((this.IsJobStateNull == false)) { return true; } return false; } - + private bool ShouldSerializeJobType() { if ((this.IsJobTypeNull == false)) { return true; } return false; } - + private bool ShouldSerializeLocalOrUtcTime() { if ((this.IsLocalOrUtcTimeNull == false)) { return true; } return false; } - + private bool ShouldSerializeOperatingStatus() { if ((this.IsOperatingStatusNull == false)) { return true; } return false; } - + private bool ShouldSerializePercentComplete() { if ((this.IsPercentCompleteNull == false)) { return true; } return false; } - + private bool ShouldSerializePrimaryStatus() { if ((this.IsPrimaryStatusNull == false)) { return true; } return false; } - + private bool ShouldSerializePriority() { if ((this.IsPriorityNull == false)) { return true; } return false; } - + private bool ShouldSerializeRecoveryAction() { if ((this.IsRecoveryActionNull == false)) { return true; } return false; } - + private bool ShouldSerializeRunDay() { if ((this.IsRunDayNull == false)) { return true; } return false; } - + private bool ShouldSerializeRunDayOfWeek() { if ((this.IsRunDayOfWeekNull == false)) { return true; } return false; } - + private bool ShouldSerializeRunMonth() { if ((this.IsRunMonthNull == false)) { return true; } return false; } - + private bool ShouldSerializeRunStartInterval() { if ((this.IsRunStartIntervalNull == false)) { return true; } return false; } - + private bool ShouldSerializeScheduledStartTime() { if ((this.IsScheduledStartTimeNull == false)) { return true; } return false; } - + private bool ShouldSerializeStartTime() { if ((this.IsStartTimeNull == false)) { return true; } return false; } - + private bool ShouldSerializeTimeBeforeRemoval() { if ((this.IsTimeBeforeRemovalNull == false)) { return true; } return false; } - + private bool ShouldSerializeTimeOfLastStateChange() { if ((this.IsTimeOfLastStateChangeNull == false)) { return true; } return false; } - + private bool ShouldSerializeTimeSubmitted() { if ((this.IsTimeSubmittedNull == false)) { return true; } return false; } - + private bool ShouldSerializeUntilTime() { if ((this.IsUntilTimeNull == false)) { return true; } return false; } - + [Browsable(true)] public void CommitObject() { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(); } } - + [Browsable(true)] public void CommitObject(System.Management.PutOptions putOptions) { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(putOptions); } } - + private void Initialize() { AutoCommitProp = true; isEmbedded = false; } - + private static string ConstructPath(string keyInstanceID) { string strPath = "ROOT\\virtualization\\v2:Msvm_StorageJob"; strPath = string.Concat(strPath, string.Concat(".InstanceID=", string.Concat("\"", string.Concat(keyInstanceID, "\"")))); return strPath; } - + private void InitializeObject(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { Initialize(); if ((path != null)) { @@ -1473,24 +1473,24 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] PrivateSystemProperties = new ManagementSystemProperties(PrivateLateBoundObject); curObj = PrivateLateBoundObject; } - + // Different overloads of GetInstances() help in enumerating instances of the WMI class. public static StorageJobCollection GetInstances() { return GetInstances(null, null, null); } - + public static StorageJobCollection GetInstances(string condition) { return GetInstances(null, condition, null); } - + public static StorageJobCollection GetInstances(string[] selectedProperties) { return GetInstances(null, null, selectedProperties); } - + public static StorageJobCollection GetInstances(string condition, string[] selectedProperties) { return GetInstances(null, condition, selectedProperties); } - + public static StorageJobCollection GetInstances(System.Management.ManagementScope mgmtScope, System.Management.EnumerationOptions enumOptions) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -1511,15 +1511,15 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] } return new StorageJobCollection(clsObject.GetInstances(enumOptions)); } - + public static StorageJobCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition) { return GetInstances(mgmtScope, condition, null); } - + public static StorageJobCollection GetInstances(System.Management.ManagementScope mgmtScope, string[] selectedProperties) { return GetInstances(mgmtScope, null, selectedProperties); } - + public static StorageJobCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition, string[] selectedProperties) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -1536,7 +1536,7 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] ObjectSearcher.Options = enumOptions; return new StorageJobCollection(ObjectSearcher.Get()); } - + [Browsable(true)] public static StorageJob CreateInstance() { System.Management.ManagementScope mgmtScope = null; @@ -1551,12 +1551,12 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] System.Management.ManagementClass tmpMgmtClass = new System.Management.ManagementClass(mgmtScope, mgmtPath, null); return new StorageJob(tmpMgmtClass.CreateInstance()); } - + [Browsable(true)] public void Delete() { PrivateLateBoundObject.Delete(); } - + public uint GetError(out string Error) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1569,7 +1569,7 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] return System.Convert.ToUInt32(0); } } - + public uint GetErrorEx(out string[] Errors) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1582,7 +1582,7 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] return System.Convert.ToUInt32(0); } } - + public uint KillJob(bool DeleteOnKill) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1595,7 +1595,7 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] return System.Convert.ToUInt32(0); } } - + public uint RequestStateChange(ushort RequestedState, System.DateTime TimeoutPeriod) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1609,59 +1609,59 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] return System.Convert.ToUInt32(0); } } - + public enum JobTypeValues { - + Unknown0 = 0, - + VHD_Creation = 1, - + Floppy_Creation = 2, - + Compaction = 3, - + Expansion = 4, - + Merging = 5, - + Conversion = 6, - + Loopback_Mount = 7, - + Get_VHD_Info = 8, - + Validate_VHD_Image = 9, - + NULL_ENUM_VALUE = 10, } - + // Enumerator implementation for enumerating instances of the class. public class StorageJobCollection : object, ICollection { - + private ManagementObjectCollection privColObj; - + public StorageJobCollection(ManagementObjectCollection objCollection) { privColObj = objCollection; } - + public virtual int Count { get { return privColObj.Count; } } - + public virtual bool IsSynchronized { get { return privColObj.IsSynchronized; } } - + public virtual object SyncRoot { get { return this; } } - + public virtual void CopyTo(System.Array array, int index) { privColObj.CopyTo(array, index); int nCtr; @@ -1669,189 +1669,189 @@ Validate VHD Image: Validating a virtual hard disk image (VHD).")] array.SetValue(new StorageJob(((System.Management.ManagementObject)(array.GetValue(nCtr)))), nCtr); } } - + public virtual System.Collections.IEnumerator GetEnumerator() { return new StorageJobEnumerator(privColObj.GetEnumerator()); } - + public class StorageJobEnumerator : object, System.Collections.IEnumerator { - + private ManagementObjectCollection.ManagementObjectEnumerator privObjEnum; - + public StorageJobEnumerator(ManagementObjectCollection.ManagementObjectEnumerator objEnum) { privObjEnum = objEnum; } - + public virtual object Current { get { return new StorageJob(((System.Management.ManagementObject)(privObjEnum.Current))); } } - + public virtual bool MoveNext() { return privObjEnum.MoveNext(); } - + public virtual void Reset() { privObjEnum.Reset(); } } } - + // TypeConverter to handle null values for ValueType properties public class WMIValueTypeConverter : TypeConverter { - + private TypeConverter baseConverter; - + private System.Type baseType; - + public WMIValueTypeConverter(System.Type inBaseType) { baseConverter = TypeDescriptor.GetConverter(inBaseType); baseType = inBaseType; } - + 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 ((baseType.BaseType == typeof(System.Enum))) { if ((value.GetType() == destinationType)) { return value; } - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return "NULL_ENUM_VALUE" ; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((baseType == typeof(bool)) + if (((baseType == typeof(bool)) && (baseType.BaseType == typeof(System.ValueType)))) { - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((context != null) + if (((context != null) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } } - + // Embedded class to represent WMI system Properties. [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 { diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_SummaryInformation.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_SummaryInformation.cs index a9523b79851..b12d9c7eaad 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_SummaryInformation.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_SummaryInformation.cs @@ -23,102 +23,102 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { using System.Globalization; using System.ComponentModel.Design.Serialization; using System.Reflection; - - + + // Functions ShouldSerialize are functions used by VS property browser to check if a particular property has to be serialized. These functions are added for all ValueType properties ( properties of type Int32, BOOL etc.. which cannot be set to null). These functions use IsNull function. These functions are also used in the TypeConverter implementation for the properties to check for NULL value of property so that an empty value can be shown in Property browser in case of Drag and Drop in Visual studio. // Functions IsNull() are used to check if a property is NULL. // Functions Reset are added for Nullable Read/Write properties. These functions are used by VS designer in property browser to set a property to NULL. // Every property added to the class for WMI property has attributes set to define its behavior in Visual Studio designer and also to define a TypeConverter to be used. // Datetime conversion functions ToDateTime and ToDmtfDateTime are added to the class to convert DMTF datetime to System.DateTime and vice-versa. - // - // - // - // + // + // + // + // // If the embedded property is strongly typed then, to strongly type the property to the type of // the embedded object, you have to do the following things. // 1. Generate Managed class for the WMI class of the embedded property. This can be done with MgmtClassGen.exe tool or from Server Explorer. // 2. Include the namespace of the generated class. // 3. Change the property get/set functions so as return the instance of the Managed class. // Below is a sample code. - // + // // VB Code - // - // - // + // + // + // // Property name // Managed class name of Embedded Property - // - // - // - // - // - // + // + // + // + // + // + // // C# Code - // - // - // + // + // + // // Managed class name of Embedded property // Property name - // - // - // - // - // - // - // - // - // - // + // + // + // + // + // + // + // + // + // + // // An Early Bound class generated for the WMI class.Msvm_SummaryInformation public class SummaryInformation : System.ComponentModel.Component { - + // Private property to hold the WMI namespace in which the class resides. private static string CreatedWmiNamespace = "ROOT\\virtualization\\v2"; - + // Private property to hold the name of WMI class which created this class. private static string CreatedClassName = "Msvm_SummaryInformation"; - + // Private member variable to hold the ManagementScope which is used by the various methods. private static System.Management.ManagementScope statMgmtScope = null; - + private ManagementSystemProperties PrivateSystemProperties; - + // Underlying lateBound WMI object. private System.Management.ManagementObject PrivateLateBoundObject; - + // Member variable to store the 'automatic commit' behavior for the class. private bool AutoCommitProp; - + // Private variable to hold the embedded property representing the instance. private System.Management.ManagementBaseObject embeddedObj; - + // The current WMI object used private System.Management.ManagementBaseObject curObj; - + // Flag to indicate if the instance is an embedded object. private bool isEmbedded; - + // Below are different overloads of constructors to initialize an instance of the class with a WMI object. public SummaryInformation() { this.InitializeObject(null, null, null); } - + public SummaryInformation(System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(null, path, getOptions); } - + public SummaryInformation(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path) { this.InitializeObject(mgmtScope, path, null); } - + public SummaryInformation(System.Management.ManagementPath path) { this.InitializeObject(null, path, null); } - + public SummaryInformation(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(mgmtScope, path, getOptions); } - + public SummaryInformation(System.Management.ManagementObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -130,7 +130,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { throw new System.ArgumentException("Class name does not match."); } } - + public SummaryInformation(System.Management.ManagementBaseObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -143,7 +143,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { throw new System.ArgumentException("Class name does not match."); } } - + // Property returns the namespace of the WMI class. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -152,7 +152,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return "ROOT\\virtualization\\v2"; } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ManagementClassName { @@ -161,7 +161,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { if ((curObj != null)) { if ((curObj.ClassPath != null)) { strRet = ((string)(curObj["__CLASS"])); - if (((strRet == null) + if (((strRet == null) || (strRet == string.Empty))) { strRet = CreatedClassName; } @@ -170,7 +170,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return strRet; } } - + // Property pointing to an embedded object to get System properties of the WMI object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -179,7 +179,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return PrivateSystemProperties; } } - + // Property returning the underlying lateBound object. [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -188,7 +188,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return curObj; } } - + // ManagementScope of the object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -207,7 +207,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + // Property to show the commit behavior for the WMI object. If true, WMI object will be automatically saved after each property modification.(ie. Put() is called after modification of a property). [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -219,7 +219,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { AutoCommitProp = value; } } - + // The ManagementPath of the underlying WMI object. [Browsable(true)] public System.Management.ManagementPath Path { @@ -240,7 +240,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + // Public static scope property which is used by the various methods. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -252,7 +252,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { statMgmtScope = value; } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The identifier of the physical graphics processing unit (GPU) allocated to this v" + @@ -262,7 +262,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["AllocatedGPU"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsApplicationHealthNull { @@ -275,7 +275,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"The current application health status for the virtual system. This property may be one of the following values: ""OK""; ""Application Critical""; ""Disabled"".For more information, see the documentation for the StatusDescriptions property of the Msvm_HeartbeatComponent class. This property is not valid for instances of Msvm_SummaryInformation representing a virtual system snapshot.")] @@ -288,7 +288,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ApplicationHealthValues)(System.Convert.ToInt32(curObj["ApplicationHealth"]))); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("An array of Msvm_ConcreteJob instances representing any asynchronous operations r" + @@ -300,7 +300,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((System.Management.ManagementBaseObject[])(curObj["AsynchronousTasks"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsAvailableMemoryBufferNull { @@ -313,7 +313,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The available memory buffer percentage in the virtual system.")] @@ -326,7 +326,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((int)(curObj["AvailableMemoryBuffer"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsCreationTimeNull { @@ -339,7 +339,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The time at which the virtual system or snapshot was created.")] @@ -354,7 +354,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The friendly name for the virtual system or snapshot.")] @@ -363,7 +363,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["ElementName"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsEnabledStateNull { @@ -376,7 +376,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The current state of the virtual system or snapshot.")] @@ -389,7 +389,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["EnabledState"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The name of the guest operating system, if available. If this information is not " + @@ -400,7 +400,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["GuestOperatingSystem"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsHealthStateNull { @@ -413,7 +413,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The current health state for the virtual system. This property is not valid for i" + @@ -427,7 +427,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["HealthState"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsHeartbeatNull { @@ -440,7 +440,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"The current heartbeat status for the virtual system. This property may be one of the following values: ""OK""; ""Error""; ""No Contact""; or ""Lost Communication"". For more information, see the documentation for the StatusDescriptions property of the Msvm_HeartbeatComponent class. This property is not valid for instances of Msvm_SummaryInformation representing a virtual system snapshot.")] @@ -453,7 +453,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["Heartbeat"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsIntegrationServicesVersionStateNull { @@ -466,7 +466,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("Whether or not the integration services installed in the virtual machine are up t" + @@ -480,7 +480,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((IntegrationServicesVersionStateValues)(System.Convert.ToInt32(curObj["IntegrationServicesVersionState"]))); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsMemoryAvailableNull { @@ -493,7 +493,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The memory available percentage in the virtual system.")] @@ -506,7 +506,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((int)(curObj["MemoryAvailable"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsMemorySpansPhysicalNumaNodesNull { @@ -519,7 +519,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("Indicates whether or not the memory of the one or more of the virtual non-uniform" + @@ -534,7 +534,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((bool)(curObj["MemorySpansPhysicalNumaNodes"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsMemoryUsageNull { @@ -547,7 +547,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The current memory usage of the virtual system. This property is not valid for in" + @@ -561,7 +561,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ulong)(curObj["MemoryUsage"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The unique name for the virtual system or snapshot.")] @@ -570,7 +570,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Name"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The notes associated with the virtual system or snapshot.")] @@ -579,7 +579,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Notes"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsNumberOfProcessorsNull { @@ -592,7 +592,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The total number of virtual processors allocated to the virtual system or snapsho" + @@ -606,7 +606,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["NumberOfProcessors"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The current status of the element.")] @@ -615,7 +615,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort[])(curObj["OperationalStatus"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("A string that describes the enabled or disabled state of the element when the Ena" + @@ -626,7 +626,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["OtherEnabledState"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsProcessorLoadNull { @@ -639,7 +639,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The current processor usage of the virtual system. This property is not valid for" + @@ -653,7 +653,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["ProcessorLoad"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("An array of the previous 100 samples of the processor usage for the virtual syste" + @@ -664,7 +664,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort[])(curObj["ProcessorLoadHistory"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsReplicationHealthNull { @@ -677,7 +677,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("Replication health for the virtual machine.")] @@ -690,7 +690,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ReplicationHealthValues)(System.Convert.ToInt32(curObj["ReplicationHealth"]))); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsReplicationModeNull { @@ -703,7 +703,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("Identifies replication type for the virtual machine.")] @@ -716,7 +716,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ReplicationModeValues)(System.Convert.ToInt32(curObj["ReplicationMode"]))); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsReplicationStateNull { @@ -729,7 +729,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("Replication state for the virtual machine.")] @@ -742,7 +742,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ReplicationStateValues)(System.Convert.ToInt32(curObj["ReplicationState"]))); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("An array of Msvm_VirtualSystemSettingData instances representing the snapshots fo" + @@ -753,7 +753,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((System.Management.ManagementBaseObject[])(curObj["Snapshots"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("Strings that describe the various OperationalStatus array values.")] @@ -762,7 +762,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string[])(curObj["StatusDescriptions"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsSwapFilesInUseNull { @@ -775,7 +775,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("Indecates if smart paging is active.")] @@ -788,7 +788,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((bool)(curObj["SwapFilesInUse"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("Reference to the CIM_ComputerSystem instance representing the test replica virtua" + @@ -802,7 +802,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return null; } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("An array containing a small, thumbnail-sized image of the desktop for the virtual" + @@ -812,7 +812,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((byte[])(curObj["ThumbnailImage"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsUpTimeNull { @@ -825,7 +825,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The amount of time since the virtual system was last booted. This property is not" + @@ -840,9 +840,9 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ulong)(curObj["UpTime"])); } } - + private bool CheckIfProperClass(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions OptionsParam) { - if (((path != null) + if (((path != null) && (string.Compare(path.ClassName, this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -850,9 +850,9 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return CheckIfProperClass(new System.Management.ManagementObject(mgmtScope, path, OptionsParam)); } } - + private bool CheckIfProperClass(System.Management.ManagementBaseObject theObj) { - if (((theObj != null) + if (((theObj != null) && (string.Compare(((string)(theObj["__CLASS"])), this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -869,21 +869,21 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } return false; } - + private bool ShouldSerializeApplicationHealth() { if ((this.IsApplicationHealthNull == false)) { return true; } return false; } - + private bool ShouldSerializeAvailableMemoryBuffer() { if ((this.IsAvailableMemoryBufferNull == false)) { return true; } return false; } - + // Converts a given datetime in DMTF format to System.DateTime object. static System.DateTime ToDateTime(string dmtfDate) { System.DateTime initializer = System.DateTime.MinValue; @@ -935,13 +935,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { if (("******" != tempString)) { ticks = (long.Parse(tempString) * ((long)((System.TimeSpan.TicksPerMillisecond / 1000)))); } - if (((((((((year < 0) - || (month < 0)) - || (day < 0)) - || (hour < 0)) - || (minute < 0)) - || (minute < 0)) - || (second < 0)) + if (((((((((year < 0) + || (month < 0)) + || (day < 0)) + || (hour < 0)) + || (minute < 0)) + || (minute < 0)) + || (second < 0)) || (ticks < 0))) { throw new System.ArgumentOutOfRangeException(); } @@ -969,7 +969,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } return datetime; } - + // Converts a given System.DateTime object to DMTF datetime format. static string ToDmtfDateTime(System.DateTime date) { string utcString = string.Empty; @@ -996,8 +996,8 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { dmtfDateTime = string.Concat(dmtfDateTime, ((int)(date.Second)).ToString().PadLeft(2, '0')); dmtfDateTime = string.Concat(dmtfDateTime, "."); System.DateTime dtTemp = new System.DateTime(date.Year, date.Month, date.Day, date.Hour, date.Minute, date.Second, 0); - long microsec = ((long)((((date.Ticks - dtTemp.Ticks) - * 1000) + long microsec = ((long)((((date.Ticks - dtTemp.Ticks) + * 1000) / System.TimeSpan.TicksPerMillisecond))); string strMicrosec = ((long)(microsec)).ToString(); if ((strMicrosec.Length > 6)) { @@ -1007,136 +1007,136 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { dmtfDateTime = string.Concat(dmtfDateTime, utcString); return dmtfDateTime; } - + private bool ShouldSerializeCreationTime() { if ((this.IsCreationTimeNull == false)) { return true; } return false; } - + private bool ShouldSerializeEnabledState() { if ((this.IsEnabledStateNull == false)) { return true; } return false; } - + private bool ShouldSerializeHealthState() { if ((this.IsHealthStateNull == false)) { return true; } return false; } - + private bool ShouldSerializeHeartbeat() { if ((this.IsHeartbeatNull == false)) { return true; } return false; } - + private bool ShouldSerializeIntegrationServicesVersionState() { if ((this.IsIntegrationServicesVersionStateNull == false)) { return true; } return false; } - + private bool ShouldSerializeMemoryAvailable() { if ((this.IsMemoryAvailableNull == false)) { return true; } return false; } - + private bool ShouldSerializeMemorySpansPhysicalNumaNodes() { if ((this.IsMemorySpansPhysicalNumaNodesNull == false)) { return true; } return false; } - + private bool ShouldSerializeMemoryUsage() { if ((this.IsMemoryUsageNull == false)) { return true; } return false; } - + private bool ShouldSerializeNumberOfProcessors() { if ((this.IsNumberOfProcessorsNull == false)) { return true; } return false; } - + private bool ShouldSerializeProcessorLoad() { if ((this.IsProcessorLoadNull == false)) { return true; } return false; } - + private bool ShouldSerializeReplicationHealth() { if ((this.IsReplicationHealthNull == false)) { return true; } return false; } - + private bool ShouldSerializeReplicationMode() { if ((this.IsReplicationModeNull == false)) { return true; } return false; } - + private bool ShouldSerializeReplicationState() { if ((this.IsReplicationStateNull == false)) { return true; } return false; } - + private bool ShouldSerializeSwapFilesInUse() { if ((this.IsSwapFilesInUseNull == false)) { return true; } return false; } - + private bool ShouldSerializeUpTime() { if ((this.IsUpTimeNull == false)) { return true; } return false; } - + [Browsable(true)] public void CommitObject() { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(); } } - + [Browsable(true)] public void CommitObject(System.Management.PutOptions putOptions) { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(putOptions); } } - + private void Initialize() { AutoCommitProp = true; isEmbedded = false; } - + private static string ConstructPath() { string strPath = "ROOT\\virtualization\\v2:Msvm_SummaryInformation"; return strPath; } - + private void InitializeObject(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { Initialize(); if ((path != null)) { @@ -1148,24 +1148,24 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { PrivateSystemProperties = new ManagementSystemProperties(PrivateLateBoundObject); curObj = PrivateLateBoundObject; } - + // Different overloads of GetInstances() help in enumerating instances of the WMI class. public static SummaryInformationCollection GetInstances() { return GetInstances(null, null, null); } - + public static SummaryInformationCollection GetInstances(string condition) { return GetInstances(null, condition, null); } - + public static SummaryInformationCollection GetInstances(string[] selectedProperties) { return GetInstances(null, null, selectedProperties); } - + public static SummaryInformationCollection GetInstances(string condition, string[] selectedProperties) { return GetInstances(null, condition, selectedProperties); } - + public static SummaryInformationCollection GetInstances(System.Management.ManagementScope mgmtScope, System.Management.EnumerationOptions enumOptions) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -1186,15 +1186,15 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } return new SummaryInformationCollection(clsObject.GetInstances(enumOptions)); } - + public static SummaryInformationCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition) { return GetInstances(mgmtScope, condition, null); } - + public static SummaryInformationCollection GetInstances(System.Management.ManagementScope mgmtScope, string[] selectedProperties) { return GetInstances(mgmtScope, null, selectedProperties); } - + public static SummaryInformationCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition, string[] selectedProperties) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -1211,7 +1211,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { ObjectSearcher.Options = enumOptions; return new SummaryInformationCollection(ObjectSearcher.Get()); } - + [Browsable(true)] public static SummaryInformation CreateInstance() { System.Management.ManagementScope mgmtScope = null; @@ -1226,116 +1226,116 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { System.Management.ManagementClass tmpMgmtClass = new System.Management.ManagementClass(mgmtScope, mgmtPath, null); return new SummaryInformation(tmpMgmtClass.CreateInstance()); } - + [Browsable(true)] public void Delete() { PrivateLateBoundObject.Delete(); } - + public enum ApplicationHealthValues { - + OK = 2, - + Application_Critical = 32782, - + Disabled = 32896, - + NULL_ENUM_VALUE = 0, } - + public enum IntegrationServicesVersionStateValues { - + Unknown0 = 0, - + UpToDate = 1, - + Mismatch = 2, - + NULL_ENUM_VALUE = 3, } - + public enum ReplicationHealthValues { - + Not_applicable = 0, - + Ok = 1, - + Warning = 2, - + Critical = 3, - + NULL_ENUM_VALUE = 4, } - + public enum ReplicationModeValues { - + None = 0, - + Primary = 1, - + Recovery = 2, - + Test_Replica = 3, - + NULL_ENUM_VALUE = 4, } - + public enum ReplicationStateValues { - + Disabled = 0, - + Ready_for_replication = 1, - + Waiting_to_complete_initial_replication = 2, - + Replicating = 3, - + Synced_replication_complete = 4, - + Recovered = 5, - + Committed = 6, - + Suspended = 7, - + Critical = 8, - + Waiting_to_start_resynchronization = 9, - + Resynchronizing = 10, - + Resynchronization_suspended = 11, - + NULL_ENUM_VALUE = 12, } - + // Enumerator implementation for enumerating instances of the class. public class SummaryInformationCollection : object, ICollection { - + private ManagementObjectCollection privColObj; - + public SummaryInformationCollection(ManagementObjectCollection objCollection) { privColObj = objCollection; } - + public virtual int Count { get { return privColObj.Count; } } - + public virtual bool IsSynchronized { get { return privColObj.IsSynchronized; } } - + public virtual object SyncRoot { get { return this; } } - + public virtual void CopyTo(System.Array array, int index) { privColObj.CopyTo(array, index); int nCtr; @@ -1343,189 +1343,189 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { array.SetValue(new SummaryInformation(((System.Management.ManagementObject)(array.GetValue(nCtr)))), nCtr); } } - + public virtual System.Collections.IEnumerator GetEnumerator() { return new SummaryInformationEnumerator(privColObj.GetEnumerator()); } - + public class SummaryInformationEnumerator : object, System.Collections.IEnumerator { - + private ManagementObjectCollection.ManagementObjectEnumerator privObjEnum; - + public SummaryInformationEnumerator(ManagementObjectCollection.ManagementObjectEnumerator objEnum) { privObjEnum = objEnum; } - + public virtual object Current { get { return new SummaryInformation(((System.Management.ManagementObject)(privObjEnum.Current))); } } - + public virtual bool MoveNext() { return privObjEnum.MoveNext(); } - + public virtual void Reset() { privObjEnum.Reset(); } } } - + // TypeConverter to handle null values for ValueType properties public class WMIValueTypeConverter : TypeConverter { - + private TypeConverter baseConverter; - + private System.Type baseType; - + public WMIValueTypeConverter(System.Type inBaseType) { baseConverter = TypeDescriptor.GetConverter(inBaseType); baseType = inBaseType; } - + 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 ((baseType.BaseType == typeof(System.Enum))) { if ((value.GetType() == destinationType)) { return value; } - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return "NULL_ENUM_VALUE" ; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((baseType == typeof(bool)) + if (((baseType == typeof(bool)) && (baseType.BaseType == typeof(System.ValueType)))) { - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((context != null) + if (((context != null) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } } - + // Embedded class to represent WMI system Properties. [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 { diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_SyntheticEthernetPortSettingData.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_SyntheticEthernetPortSettingData.cs index caa74fe5ac0..2e04d854141 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_SyntheticEthernetPortSettingData.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_SyntheticEthernetPortSettingData.cs @@ -23,70 +23,70 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { using System.Globalization; using System.ComponentModel.Design.Serialization; using System.Reflection; - - + + // Functions ShouldSerialize are functions used by VS property browser to check if a particular property has to be serialized. These functions are added for all ValueType properties ( properties of type Int32, BOOL etc.. which cannot be set to null). These functions use IsNull function. These functions are also used in the TypeConverter implementation for the properties to check for NULL value of property so that an empty value can be shown in Property browser in case of Drag and Drop in Visual studio. // Functions IsNull() are used to check if a property is NULL. // Functions Reset are added for Nullable Read/Write properties. These functions are used by VS designer in property browser to set a property to NULL. // Every property added to the class for WMI property has attributes set to define its behavior in Visual Studio designer and also to define a TypeConverter to be used. // An Early Bound class generated for the WMI class.Msvm_SyntheticEthernetPortSettingData public class SyntheticEthernetPortSettingData : System.ComponentModel.Component { - + // Private property to hold the WMI namespace in which the class resides. private static string CreatedWmiNamespace = "ROOT\\virtualization\\v2"; - + // Private property to hold the name of WMI class which created this class. public static string CreatedClassName = "Msvm_SyntheticEthernetPortSettingData"; - + // Private member variable to hold the ManagementScope which is used by the various methods. private static System.Management.ManagementScope statMgmtScope = null; - + private ManagementSystemProperties PrivateSystemProperties; - + // Underlying lateBound WMI object. private System.Management.ManagementObject PrivateLateBoundObject; - + // Member variable to store the 'automatic commit' behavior for the class. private bool AutoCommitProp; - + // Private variable to hold the embedded property representing the instance. private System.Management.ManagementBaseObject embeddedObj; - + // The current WMI object used private System.Management.ManagementBaseObject curObj; - + // Flag to indicate if the instance is an embedded object. private bool isEmbedded; - + // Below are different overloads of constructors to initialize an instance of the class with a WMI object. public SyntheticEthernetPortSettingData() { this.InitializeObject(null, null, null); } - + public SyntheticEthernetPortSettingData(string keyInstanceID) { this.InitializeObject(null, new System.Management.ManagementPath(SyntheticEthernetPortSettingData.ConstructPath(keyInstanceID)), null); } - + public SyntheticEthernetPortSettingData(System.Management.ManagementScope mgmtScope, string keyInstanceID) { this.InitializeObject(((System.Management.ManagementScope)(mgmtScope)), new System.Management.ManagementPath(SyntheticEthernetPortSettingData.ConstructPath(keyInstanceID)), null); } - + public SyntheticEthernetPortSettingData(System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(null, path, getOptions); } - + public SyntheticEthernetPortSettingData(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path) { this.InitializeObject(mgmtScope, path, null); } - + public SyntheticEthernetPortSettingData(System.Management.ManagementPath path) { this.InitializeObject(null, path, null); } - + public SyntheticEthernetPortSettingData(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(mgmtScope, path, getOptions); } - + public SyntheticEthernetPortSettingData(System.Management.ManagementObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -98,7 +98,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { throw new System.ArgumentException("Class name does not match."); } } - + public SyntheticEthernetPortSettingData(System.Management.ManagementBaseObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -111,7 +111,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { throw new System.ArgumentException("Class name does not match."); } } - + // Property returns the namespace of the WMI class. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -120,7 +120,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return "ROOT\\virtualization\\v2"; } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ManagementClassName { @@ -129,7 +129,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { if ((curObj != null)) { if ((curObj.ClassPath != null)) { strRet = ((string)(curObj["__CLASS"])); - if (((strRet == null) + if (((strRet == null) || (strRet == string.Empty))) { strRet = CreatedClassName; } @@ -138,7 +138,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return strRet; } } - + // Property pointing to an embedded object to get System properties of the WMI object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -147,7 +147,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return PrivateSystemProperties; } } - + // Property returning the underlying lateBound object. [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -156,7 +156,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return curObj; } } - + // ManagementScope of the object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -175,7 +175,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + // Property to show the commit behavior for the WMI object. If true, WMI object will be automatically saved after each property modification.(ie. Put() is called after modification of a property). [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -187,7 +187,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { AutoCommitProp = value; } } - + // The ManagementPath of the underlying WMI object. [Browsable(true)] public System.Management.ManagementPath Path { @@ -208,7 +208,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + // Public static scope property which is used by the various methods. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -220,7 +220,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { statMgmtScope = value; } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Address { @@ -228,7 +228,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Address"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string AddressOnParent { @@ -236,7 +236,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["AddressOnParent"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string AllocationUnits { @@ -244,7 +244,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["AllocationUnits"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsAutomaticAllocationNull { @@ -257,7 +257,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -269,7 +269,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((bool)(curObj["AutomaticAllocation"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsAutomaticDeallocationNull { @@ -282,7 +282,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -294,7 +294,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((bool)(curObj["AutomaticDeallocation"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Caption { @@ -302,7 +302,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Caption"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string[] Connection { @@ -310,7 +310,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string[])(curObj["Connection"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsConsumerVisibilityNull { @@ -323,7 +323,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -335,7 +335,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["ConsumerVisibility"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Description { @@ -343,7 +343,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Description"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsDesiredVLANEndpointModeNull { @@ -356,7 +356,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -368,7 +368,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["DesiredVLANEndpointMode"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ElementName { @@ -376,7 +376,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["ElementName"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string[] HostResource { @@ -384,7 +384,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string[])(curObj["HostResource"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string InstanceID { @@ -392,7 +392,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["InstanceID"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsLimitNull { @@ -405,7 +405,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -417,7 +417,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ulong)(curObj["Limit"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsMappingBehaviorNull { @@ -430,7 +430,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -442,7 +442,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["MappingBehavior"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string OtherEndpointMode { @@ -450,7 +450,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["OtherEndpointMode"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string OtherResourceType { @@ -458,7 +458,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["OtherResourceType"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Parent { @@ -466,7 +466,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Parent"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string PoolID { @@ -474,7 +474,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["PoolID"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsReservationNull { @@ -487,7 +487,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -499,7 +499,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ulong)(curObj["Reservation"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ResourceSubType { @@ -507,7 +507,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["ResourceSubType"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsResourceTypeNull { @@ -520,7 +520,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -532,7 +532,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["ResourceType"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsStaticMacAddressNull { @@ -545,7 +545,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("Indicates a static MAC address.\nThis is a read-only property, but it can be chang" + @@ -560,7 +560,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((bool)(curObj["StaticMacAddress"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsVirtualQuantityNull { @@ -573,7 +573,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -585,7 +585,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ulong)(curObj["VirtualQuantity"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string VirtualQuantityUnits { @@ -593,7 +593,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["VirtualQuantityUnits"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"A free-form string array of identifiers of this resource presented to the virtual computer system's operating system. The indexes and values per index are defined on a per resource basis (that is, for each enumerated ResourceType value). This property is set to ""GUID"". @@ -603,7 +603,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste return ((string[])(curObj["VirtualSystemIdentifiers"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsWeightNull { @@ -616,7 +616,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -628,9 +628,9 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste return ((uint)(curObj["Weight"])); } } - + private bool CheckIfProperClass(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions OptionsParam) { - if (((path != null) + if (((path != null) && (string.Compare(path.ClassName, this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -638,9 +638,9 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste return CheckIfProperClass(new System.Management.ManagementObject(mgmtScope, path, OptionsParam)); } } - + private bool CheckIfProperClass(System.Management.ManagementBaseObject theObj) { - if (((theObj != null) + if (((theObj != null) && (string.Compare(((string)(theObj["__CLASS"])), this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -657,109 +657,109 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste } return false; } - + private bool ShouldSerializeAutomaticAllocation() { if ((this.IsAutomaticAllocationNull == false)) { return true; } return false; } - + private bool ShouldSerializeAutomaticDeallocation() { if ((this.IsAutomaticDeallocationNull == false)) { return true; } return false; } - + private bool ShouldSerializeConsumerVisibility() { if ((this.IsConsumerVisibilityNull == false)) { return true; } return false; } - + private bool ShouldSerializeDesiredVLANEndpointMode() { if ((this.IsDesiredVLANEndpointModeNull == false)) { return true; } return false; } - + private bool ShouldSerializeLimit() { if ((this.IsLimitNull == false)) { return true; } return false; } - + private bool ShouldSerializeMappingBehavior() { if ((this.IsMappingBehaviorNull == false)) { return true; } return false; } - + private bool ShouldSerializeReservation() { if ((this.IsReservationNull == false)) { return true; } return false; } - + private bool ShouldSerializeResourceType() { if ((this.IsResourceTypeNull == false)) { return true; } return false; } - + private bool ShouldSerializeStaticMacAddress() { if ((this.IsStaticMacAddressNull == false)) { return true; } return false; } - + private bool ShouldSerializeVirtualQuantity() { if ((this.IsVirtualQuantityNull == false)) { return true; } return false; } - + private bool ShouldSerializeWeight() { if ((this.IsWeightNull == false)) { return true; } return false; } - + [Browsable(true)] public void CommitObject() { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(); } } - + [Browsable(true)] public void CommitObject(System.Management.PutOptions putOptions) { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(putOptions); } } - + private void Initialize() { AutoCommitProp = true; isEmbedded = false; } - + private static string ConstructPath(string keyInstanceID) { string strPath = "ROOT\\virtualization\\v2:Msvm_SyntheticEthernetPortSettingData"; strPath = string.Concat(strPath, string.Concat(".InstanceID=", string.Concat("\"", string.Concat(keyInstanceID, "\"")))); return strPath; } - + private void InitializeObject(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { Initialize(); if ((path != null)) { @@ -771,24 +771,24 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste PrivateSystemProperties = new ManagementSystemProperties(PrivateLateBoundObject); curObj = PrivateLateBoundObject; } - + // Different overloads of GetInstances() help in enumerating instances of the WMI class. public static SyntheticEthernetPortSettingDataCollection GetInstances() { return GetInstances(null, null, null); } - + public static SyntheticEthernetPortSettingDataCollection GetInstances(string condition) { return GetInstances(null, condition, null); } - + public static SyntheticEthernetPortSettingDataCollection GetInstances(string[] selectedProperties) { return GetInstances(null, null, selectedProperties); } - + public static SyntheticEthernetPortSettingDataCollection GetInstances(string condition, string[] selectedProperties) { return GetInstances(null, condition, selectedProperties); } - + public static SyntheticEthernetPortSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, System.Management.EnumerationOptions enumOptions) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -809,15 +809,15 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste } return new SyntheticEthernetPortSettingDataCollection(clsObject.GetInstances(enumOptions)); } - + public static SyntheticEthernetPortSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition) { return GetInstances(mgmtScope, condition, null); } - + public static SyntheticEthernetPortSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string[] selectedProperties) { return GetInstances(mgmtScope, null, selectedProperties); } - + public static SyntheticEthernetPortSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition, string[] selectedProperties) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -834,7 +834,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste ObjectSearcher.Options = enumOptions; return new SyntheticEthernetPortSettingDataCollection(ObjectSearcher.Get()); } - + [Browsable(true)] public static SyntheticEthernetPortSettingData CreateInstance() { System.Management.ManagementScope mgmtScope = null; @@ -849,39 +849,39 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste System.Management.ManagementClass tmpMgmtClass = new System.Management.ManagementClass(mgmtScope, mgmtPath, null); return new SyntheticEthernetPortSettingData(tmpMgmtClass.CreateInstance()); } - + [Browsable(true)] public void Delete() { PrivateLateBoundObject.Delete(); } - + // Enumerator implementation for enumerating instances of the class. public class SyntheticEthernetPortSettingDataCollection : object, ICollection { - + private ManagementObjectCollection privColObj; - + public SyntheticEthernetPortSettingDataCollection(ManagementObjectCollection objCollection) { privColObj = objCollection; } - + public virtual int Count { get { return privColObj.Count; } } - + public virtual bool IsSynchronized { get { return privColObj.IsSynchronized; } } - + public virtual object SyncRoot { get { return this; } } - + public virtual void CopyTo(System.Array array, int index) { privColObj.CopyTo(array, index); int nCtr; @@ -889,189 +889,189 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste array.SetValue(new SyntheticEthernetPortSettingData(((System.Management.ManagementObject)(array.GetValue(nCtr)))), nCtr); } } - + public virtual System.Collections.IEnumerator GetEnumerator() { return new SyntheticEthernetPortSettingDataEnumerator(privColObj.GetEnumerator()); } - + public class SyntheticEthernetPortSettingDataEnumerator : object, System.Collections.IEnumerator { - + private ManagementObjectCollection.ManagementObjectEnumerator privObjEnum; - + public SyntheticEthernetPortSettingDataEnumerator(ManagementObjectCollection.ManagementObjectEnumerator objEnum) { privObjEnum = objEnum; } - + public virtual object Current { get { return new SyntheticEthernetPortSettingData(((System.Management.ManagementObject)(privObjEnum.Current))); } } - + public virtual bool MoveNext() { return privObjEnum.MoveNext(); } - + public virtual void Reset() { privObjEnum.Reset(); } } } - + // TypeConverter to handle null values for ValueType properties public class WMIValueTypeConverter : TypeConverter { - + private TypeConverter baseConverter; - + private System.Type baseType; - + public WMIValueTypeConverter(System.Type inBaseType) { baseConverter = TypeDescriptor.GetConverter(inBaseType); baseType = inBaseType; } - + 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 ((baseType.BaseType == typeof(System.Enum))) { if ((value.GetType() == destinationType)) { return value; } - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return "NULL_ENUM_VALUE" ; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((baseType == typeof(bool)) + if (((baseType == typeof(bool)) && (baseType.BaseType == typeof(System.ValueType)))) { - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((context != null) + if (((context != null) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } } - + // Embedded class to represent WMI system Properties. [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 { diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_VirtualEthernetSwitch.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_VirtualEthernetSwitch.cs index 1d54ea7be21..550494fe8fd 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_VirtualEthernetSwitch.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_VirtualEthernetSwitch.cs @@ -23,8 +23,8 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { using System.Globalization; using System.ComponentModel.Design.Serialization; using System.Reflection; - - + + // Functions ShouldSerialize are functions used by VS property browser to check if a particular property has to be serialized. These functions are added for all ValueType properties ( properties of type Int32, BOOL etc.. which cannot be set to null). These functions use IsNull function. These functions are also used in the TypeConverter implementation for the properties to check for NULL value of property so that an empty value can be shown in Property browser in case of Drag and Drop in Visual studio. // Functions IsNull() are used to check if a property is NULL. // Functions Reset are added for Nullable Read/Write properties. These functions are used by VS designer in property browser to set a property to NULL. @@ -32,62 +32,62 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { // Datetime conversion functions ToDateTime and ToDmtfDateTime are added to the class to convert DMTF datetime to System.DateTime and vice-versa. // An Early Bound class generated for the WMI class.Msvm_VirtualEthernetSwitch public class VirtualEthernetSwitch : System.ComponentModel.Component { - + // Private property to hold the WMI namespace in which the class resides. private static string CreatedWmiNamespace = "ROOT\\virtualization\\v2"; - + // Private property to hold the name of WMI class which created this class. public static string CreatedClassName = "Msvm_VirtualEthernetSwitch"; - + // Private member variable to hold the ManagementScope which is used by the various methods. private static System.Management.ManagementScope statMgmtScope = null; - + private ManagementSystemProperties PrivateSystemProperties; - + // Underlying lateBound WMI object. private System.Management.ManagementObject PrivateLateBoundObject; - + // Member variable to store the 'automatic commit' behavior for the class. private bool AutoCommitProp; - + // Private variable to hold the embedded property representing the instance. private System.Management.ManagementBaseObject embeddedObj; - + // The current WMI object used private System.Management.ManagementBaseObject curObj; - + // Flag to indicate if the instance is an embedded object. private bool isEmbedded; - + // Below are different overloads of constructors to initialize an instance of the class with a WMI object. public VirtualEthernetSwitch() { this.InitializeObject(null, null, null); } - + public VirtualEthernetSwitch(string keyCreationClassName, string keyName) { this.InitializeObject(null, new System.Management.ManagementPath(VirtualEthernetSwitch.ConstructPath(keyCreationClassName, keyName)), null); } - + public VirtualEthernetSwitch(System.Management.ManagementScope mgmtScope, string keyCreationClassName, string keyName) { this.InitializeObject(((System.Management.ManagementScope)(mgmtScope)), new System.Management.ManagementPath(VirtualEthernetSwitch.ConstructPath(keyCreationClassName, keyName)), null); } - + public VirtualEthernetSwitch(System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(null, path, getOptions); } - + public VirtualEthernetSwitch(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path) { this.InitializeObject(mgmtScope, path, null); } - + public VirtualEthernetSwitch(System.Management.ManagementPath path) { this.InitializeObject(null, path, null); } - + public VirtualEthernetSwitch(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(mgmtScope, path, getOptions); } - + public VirtualEthernetSwitch(System.Management.ManagementObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -99,7 +99,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { throw new System.ArgumentException("Class name does not match."); } } - + public VirtualEthernetSwitch(System.Management.ManagementBaseObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -112,7 +112,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { throw new System.ArgumentException("Class name does not match."); } } - + // Property returns the namespace of the WMI class. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -121,7 +121,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return "ROOT\\virtualization\\v2"; } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ManagementClassName { @@ -130,7 +130,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { if ((curObj != null)) { if ((curObj.ClassPath != null)) { strRet = ((string)(curObj["__CLASS"])); - if (((strRet == null) + if (((strRet == null) || (strRet == string.Empty))) { strRet = CreatedClassName; } @@ -139,7 +139,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return strRet; } } - + // Property pointing to an embedded object to get System properties of the WMI object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -148,7 +148,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return PrivateSystemProperties; } } - + // Property returning the underlying lateBound object. [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -157,7 +157,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return curObj; } } - + // ManagementScope of the object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -176,7 +176,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + // Property to show the commit behavior for the WMI object. If true, WMI object will be automatically saved after each property modification.(ie. Put() is called after modification of a property). [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -188,7 +188,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { AutoCommitProp = value; } } - + // The ManagementPath of the underlying WMI object. [Browsable(true)] public System.Management.ManagementPath Path { @@ -209,7 +209,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + // Public static scope property which is used by the various methods. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -221,7 +221,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { statMgmtScope = value; } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public ushort[] AvailableRequestedStates { @@ -229,7 +229,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort[])(curObj["AvailableRequestedStates"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Caption { @@ -237,7 +237,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Caption"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsCommunicationStatusNull { @@ -250,7 +250,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -262,7 +262,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["CommunicationStatus"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string CreationClassName { @@ -270,7 +270,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["CreationClassName"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public ushort[] Dedicated { @@ -278,7 +278,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort[])(curObj["Dedicated"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Description { @@ -286,7 +286,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Description"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsDetailedStatusNull { @@ -299,7 +299,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -311,7 +311,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["DetailedStatus"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ElementName { @@ -319,7 +319,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["ElementName"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsEnabledDefaultNull { @@ -332,7 +332,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -344,7 +344,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["EnabledDefault"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsEnabledStateNull { @@ -357,7 +357,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -369,7 +369,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["EnabledState"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsHealthStateNull { @@ -382,7 +382,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -394,7 +394,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["HealthState"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string[] IdentifyingDescriptions { @@ -402,7 +402,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string[])(curObj["IdentifyingDescriptions"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsInstallDateNull { @@ -415,7 +415,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -429,7 +429,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string InstanceID { @@ -437,7 +437,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["InstanceID"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsMaxIOVOffloadsNull { @@ -450,7 +450,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The maximum number of SR-IOV Virtual Function offloads available on this switch.")] @@ -463,7 +463,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((uint)(curObj["MaxIOVOffloads"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsMaxVMQOffloadsNull { @@ -476,7 +476,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The maximum number of VMQ offloads allowed for a port on this switch.")] @@ -490,13 +490,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } set { curObj["MaxVMQOffloads"] = value; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Name { @@ -504,7 +504,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Name"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string NameFormat { @@ -512,7 +512,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["NameFormat"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsOperatingStatusNull { @@ -525,7 +525,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -537,7 +537,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["OperatingStatus"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public ushort[] OperationalStatus { @@ -545,7 +545,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort[])(curObj["OperationalStatus"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string[] OtherDedicatedDescriptions { @@ -553,7 +553,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string[])(curObj["OtherDedicatedDescriptions"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string OtherEnabledState { @@ -561,7 +561,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["OtherEnabledState"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string[] OtherIdentifyingInfo { @@ -569,7 +569,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string[])(curObj["OtherIdentifyingInfo"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public ushort[] PowerManagementCapabilities { @@ -577,7 +577,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort[])(curObj["PowerManagementCapabilities"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string PrimaryOwnerContact { @@ -585,7 +585,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["PrimaryOwnerContact"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string PrimaryOwnerName { @@ -593,7 +593,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["PrimaryOwnerName"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPrimaryStatusNull { @@ -606,7 +606,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -618,7 +618,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["PrimaryStatus"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsRequestedStateNull { @@ -631,7 +631,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -643,7 +643,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["RequestedState"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsResetCapabilityNull { @@ -656,7 +656,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -668,7 +668,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["ResetCapability"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string[] Roles { @@ -676,7 +676,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string[])(curObj["Roles"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Status { @@ -684,7 +684,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Status"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string[] StatusDescriptions { @@ -692,7 +692,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string[])(curObj["StatusDescriptions"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsTimeOfLastStateChangeNull { @@ -705,7 +705,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -719,7 +719,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsTransitioningToStateNull { @@ -732,7 +732,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -744,9 +744,9 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["TransitioningToState"])); } } - + private bool CheckIfProperClass(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions OptionsParam) { - if (((path != null) + if (((path != null) && (string.Compare(path.ClassName, this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -754,9 +754,9 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return CheckIfProperClass(new System.Management.ManagementObject(mgmtScope, path, OptionsParam)); } } - + private bool CheckIfProperClass(System.Management.ManagementBaseObject theObj) { - if (((theObj != null) + if (((theObj != null) && (string.Compare(((string)(theObj["__CLASS"])), this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -773,42 +773,42 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } return false; } - + private bool ShouldSerializeCommunicationStatus() { if ((this.IsCommunicationStatusNull == false)) { return true; } return false; } - + private bool ShouldSerializeDetailedStatus() { if ((this.IsDetailedStatusNull == false)) { return true; } return false; } - + private bool ShouldSerializeEnabledDefault() { if ((this.IsEnabledDefaultNull == false)) { return true; } return false; } - + private bool ShouldSerializeEnabledState() { if ((this.IsEnabledStateNull == false)) { return true; } return false; } - + private bool ShouldSerializeHealthState() { if ((this.IsHealthStateNull == false)) { return true; } return false; } - + // Converts a given datetime in DMTF format to System.DateTime object. static System.DateTime ToDateTime(string dmtfDate) { System.DateTime initializer = System.DateTime.MinValue; @@ -860,13 +860,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { if (("******" != tempString)) { ticks = (long.Parse(tempString) * ((long)((System.TimeSpan.TicksPerMillisecond / 1000)))); } - if (((((((((year < 0) - || (month < 0)) - || (day < 0)) - || (hour < 0)) - || (minute < 0)) - || (minute < 0)) - || (second < 0)) + if (((((((((year < 0) + || (month < 0)) + || (day < 0)) + || (hour < 0)) + || (minute < 0)) + || (minute < 0)) + || (second < 0)) || (ticks < 0))) { throw new System.ArgumentOutOfRangeException(); } @@ -894,7 +894,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } return datetime; } - + // Converts a given System.DateTime object to DMTF datetime format. static string ToDmtfDateTime(System.DateTime date) { string utcString = string.Empty; @@ -921,8 +921,8 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { dmtfDateTime = string.Concat(dmtfDateTime, ((int)(date.Second)).ToString().PadLeft(2, '0')); dmtfDateTime = string.Concat(dmtfDateTime, "."); System.DateTime dtTemp = new System.DateTime(date.Year, date.Month, date.Day, date.Hour, date.Minute, date.Second, 0); - long microsec = ((long)((((date.Ticks - dtTemp.Ticks) - * 1000) + long microsec = ((long)((((date.Ticks - dtTemp.Ticks) + * 1000) / System.TimeSpan.TicksPerMillisecond))); string strMicrosec = ((long)(microsec)).ToString(); if ((strMicrosec.Length > 6)) { @@ -932,104 +932,104 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { dmtfDateTime = string.Concat(dmtfDateTime, utcString); return dmtfDateTime; } - + private bool ShouldSerializeInstallDate() { if ((this.IsInstallDateNull == false)) { return true; } return false; } - + private bool ShouldSerializeMaxIOVOffloads() { if ((this.IsMaxIOVOffloadsNull == false)) { return true; } return false; } - + private bool ShouldSerializeMaxVMQOffloads() { if ((this.IsMaxVMQOffloadsNull == false)) { return true; } return false; } - + private void ResetMaxVMQOffloads() { curObj["MaxVMQOffloads"] = null; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } - + private bool ShouldSerializeOperatingStatus() { if ((this.IsOperatingStatusNull == false)) { return true; } return false; } - + private bool ShouldSerializePrimaryStatus() { if ((this.IsPrimaryStatusNull == false)) { return true; } return false; } - + private bool ShouldSerializeRequestedState() { if ((this.IsRequestedStateNull == false)) { return true; } return false; } - + private bool ShouldSerializeResetCapability() { if ((this.IsResetCapabilityNull == false)) { return true; } return false; } - + private bool ShouldSerializeTimeOfLastStateChange() { if ((this.IsTimeOfLastStateChangeNull == false)) { return true; } return false; } - + private bool ShouldSerializeTransitioningToState() { if ((this.IsTransitioningToStateNull == false)) { return true; } return false; } - + [Browsable(true)] public void CommitObject() { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(); } } - + [Browsable(true)] public void CommitObject(System.Management.PutOptions putOptions) { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(putOptions); } } - + private void Initialize() { AutoCommitProp = true; isEmbedded = false; } - + private static string ConstructPath(string keyCreationClassName, string keyName) { string strPath = "ROOT\\virtualization\\v2:Msvm_VirtualEthernetSwitch"; strPath = string.Concat(strPath, string.Concat(".CreationClassName=", string.Concat("\"", string.Concat(keyCreationClassName, "\"")))); strPath = string.Concat(strPath, string.Concat(",Name=", string.Concat("\"", string.Concat(keyName, "\"")))); return strPath; } - + private void InitializeObject(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { Initialize(); if ((path != null)) { @@ -1041,24 +1041,24 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { PrivateSystemProperties = new ManagementSystemProperties(PrivateLateBoundObject); curObj = PrivateLateBoundObject; } - + // Different overloads of GetInstances() help in enumerating instances of the WMI class. public static VirtualEthernetSwitchCollection GetInstances() { return GetInstances(null, null, null); } - + public static VirtualEthernetSwitchCollection GetInstances(string condition) { return GetInstances(null, condition, null); } - + public static VirtualEthernetSwitchCollection GetInstances(string[] selectedProperties) { return GetInstances(null, null, selectedProperties); } - + public static VirtualEthernetSwitchCollection GetInstances(string condition, string[] selectedProperties) { return GetInstances(null, condition, selectedProperties); } - + public static VirtualEthernetSwitchCollection GetInstances(System.Management.ManagementScope mgmtScope, System.Management.EnumerationOptions enumOptions) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -1079,15 +1079,15 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } return new VirtualEthernetSwitchCollection(clsObject.GetInstances(enumOptions)); } - + public static VirtualEthernetSwitchCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition) { return GetInstances(mgmtScope, condition, null); } - + public static VirtualEthernetSwitchCollection GetInstances(System.Management.ManagementScope mgmtScope, string[] selectedProperties) { return GetInstances(mgmtScope, null, selectedProperties); } - + public static VirtualEthernetSwitchCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition, string[] selectedProperties) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -1104,7 +1104,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { ObjectSearcher.Options = enumOptions; return new VirtualEthernetSwitchCollection(ObjectSearcher.Get()); } - + [Browsable(true)] public static VirtualEthernetSwitch CreateInstance() { System.Management.ManagementScope mgmtScope = null; @@ -1119,12 +1119,12 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { System.Management.ManagementClass tmpMgmtClass = new System.Management.ManagementClass(mgmtScope, mgmtPath, null); return new VirtualEthernetSwitch(tmpMgmtClass.CreateInstance()); } - + [Browsable(true)] public void Delete() { PrivateLateBoundObject.Delete(); } - + public uint RequestStateChange(ushort RequestedState, System.DateTime TimeoutPeriod, out System.Management.ManagementPath Job) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1143,7 +1143,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint SetPowerState(uint PowerState, System.DateTime Time) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1157,34 +1157,34 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + // Enumerator implementation for enumerating instances of the class. public class VirtualEthernetSwitchCollection : object, ICollection { - + private ManagementObjectCollection privColObj; - + public VirtualEthernetSwitchCollection(ManagementObjectCollection objCollection) { privColObj = objCollection; } - + public virtual int Count { get { return privColObj.Count; } } - + public virtual bool IsSynchronized { get { return privColObj.IsSynchronized; } } - + public virtual object SyncRoot { get { return this; } } - + public virtual void CopyTo(System.Array array, int index) { privColObj.CopyTo(array, index); int nCtr; @@ -1192,189 +1192,189 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { array.SetValue(new VirtualEthernetSwitch(((System.Management.ManagementObject)(array.GetValue(nCtr)))), nCtr); } } - + public virtual System.Collections.IEnumerator GetEnumerator() { return new VirtualEthernetSwitchEnumerator(privColObj.GetEnumerator()); } - + public class VirtualEthernetSwitchEnumerator : object, System.Collections.IEnumerator { - + private ManagementObjectCollection.ManagementObjectEnumerator privObjEnum; - + public VirtualEthernetSwitchEnumerator(ManagementObjectCollection.ManagementObjectEnumerator objEnum) { privObjEnum = objEnum; } - + public virtual object Current { get { return new VirtualEthernetSwitch(((System.Management.ManagementObject)(privObjEnum.Current))); } } - + public virtual bool MoveNext() { return privObjEnum.MoveNext(); } - + public virtual void Reset() { privObjEnum.Reset(); } } } - + // TypeConverter to handle null values for ValueType properties public class WMIValueTypeConverter : TypeConverter { - + private TypeConverter baseConverter; - + private System.Type baseType; - + public WMIValueTypeConverter(System.Type inBaseType) { baseConverter = TypeDescriptor.GetConverter(inBaseType); baseType = inBaseType; } - + 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 ((baseType.BaseType == typeof(System.Enum))) { if ((value.GetType() == destinationType)) { return value; } - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return "NULL_ENUM_VALUE" ; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((baseType == typeof(bool)) + if (((baseType == typeof(bool)) && (baseType.BaseType == typeof(System.ValueType)))) { - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((context != null) + if (((context != null) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } } - + // Embedded class to represent WMI system Properties. [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 { diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_VirtualEthernetSwitchManagementService.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_VirtualEthernetSwitchManagementService.cs index 639e0070f52..89ac24ea755 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_VirtualEthernetSwitchManagementService.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_VirtualEthernetSwitchManagementService.cs @@ -23,8 +23,8 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { using System.Globalization; using System.ComponentModel.Design.Serialization; using System.Reflection; - - + + // Functions ShouldSerialize are functions used by VS property browser to check if a particular property has to be serialized. These functions are added for all ValueType properties ( properties of type Int32, BOOL etc.. which cannot be set to null). These functions use IsNull function. These functions are also used in the TypeConverter implementation for the properties to check for NULL value of property so that an empty value can be shown in Property browser in case of Drag and Drop in Visual studio. // Functions IsNull() are used to check if a property is NULL. // Functions Reset are added for Nullable Read/Write properties. These functions are used by VS designer in property browser to set a property to NULL. @@ -32,62 +32,62 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { // Datetime conversion functions ToDateTime and ToDmtfDateTime are added to the class to convert DMTF datetime to System.DateTime and vice-versa. // An Early Bound class generated for the WMI class.Msvm_VirtualEthernetSwitchManagementService public class VirtualEthernetSwitchManagementService : System.ComponentModel.Component { - + // Private property to hold the WMI namespace in which the class resides. private static string CreatedWmiNamespace = "ROOT\\virtualization\\v2"; - + // Private property to hold the name of WMI class which created this class. private static string CreatedClassName = "Msvm_VirtualEthernetSwitchManagementService"; - + // Private member variable to hold the ManagementScope which is used by the various methods. private static System.Management.ManagementScope statMgmtScope = null; - + private ManagementSystemProperties PrivateSystemProperties; - + // Underlying lateBound WMI object. private System.Management.ManagementObject PrivateLateBoundObject; - + // Member variable to store the 'automatic commit' behavior for the class. private bool AutoCommitProp; - + // Private variable to hold the embedded property representing the instance. private System.Management.ManagementBaseObject embeddedObj; - + // The current WMI object used private System.Management.ManagementBaseObject curObj; - + // Flag to indicate if the instance is an embedded object. private bool isEmbedded; - + // Below are different overloads of constructors to initialize an instance of the class with a WMI object. public VirtualEthernetSwitchManagementService() { this.InitializeObject(null, null, null); } - + public VirtualEthernetSwitchManagementService(string keyCreationClassName, string keyName, string keySystemCreationClassName, string keySystemName) { this.InitializeObject(null, new System.Management.ManagementPath(VirtualEthernetSwitchManagementService.ConstructPath(keyCreationClassName, keyName, keySystemCreationClassName, keySystemName)), null); } - + public VirtualEthernetSwitchManagementService(System.Management.ManagementScope mgmtScope, string keyCreationClassName, string keyName, string keySystemCreationClassName, string keySystemName) { this.InitializeObject(((System.Management.ManagementScope)(mgmtScope)), new System.Management.ManagementPath(VirtualEthernetSwitchManagementService.ConstructPath(keyCreationClassName, keyName, keySystemCreationClassName, keySystemName)), null); } - + public VirtualEthernetSwitchManagementService(System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(null, path, getOptions); } - + public VirtualEthernetSwitchManagementService(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path) { this.InitializeObject(mgmtScope, path, null); } - + public VirtualEthernetSwitchManagementService(System.Management.ManagementPath path) { this.InitializeObject(null, path, null); } - + public VirtualEthernetSwitchManagementService(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(mgmtScope, path, getOptions); } - + public VirtualEthernetSwitchManagementService(System.Management.ManagementObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -99,7 +99,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { throw new System.ArgumentException("Class name does not match."); } } - + public VirtualEthernetSwitchManagementService(System.Management.ManagementBaseObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -112,7 +112,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { throw new System.ArgumentException("Class name does not match."); } } - + // Property returns the namespace of the WMI class. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -121,7 +121,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return "ROOT\\virtualization\\v2"; } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ManagementClassName { @@ -130,7 +130,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { if ((curObj != null)) { if ((curObj.ClassPath != null)) { strRet = ((string)(curObj["__CLASS"])); - if (((strRet == null) + if (((strRet == null) || (strRet == string.Empty))) { strRet = CreatedClassName; } @@ -139,7 +139,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return strRet; } } - + // Property pointing to an embedded object to get System properties of the WMI object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -148,7 +148,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return PrivateSystemProperties; } } - + // Property returning the underlying lateBound object. [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -157,7 +157,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return curObj; } } - + // ManagementScope of the object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -176,7 +176,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + // Property to show the commit behavior for the WMI object. If true, WMI object will be automatically saved after each property modification.(ie. Put() is called after modification of a property). [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -188,7 +188,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { AutoCommitProp = value; } } - + // The ManagementPath of the underlying WMI object. [Browsable(true)] public System.Management.ManagementPath Path { @@ -209,7 +209,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + // Public static scope property which is used by the various methods. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -221,7 +221,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { statMgmtScope = value; } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public ushort[] AvailableRequestedStates { @@ -229,7 +229,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort[])(curObj["AvailableRequestedStates"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Caption { @@ -237,7 +237,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Caption"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsCommunicationStatusNull { @@ -250,7 +250,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -262,7 +262,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["CommunicationStatus"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string CreationClassName { @@ -270,7 +270,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["CreationClassName"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Description { @@ -278,7 +278,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Description"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsDetailedStatusNull { @@ -291,7 +291,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -303,7 +303,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["DetailedStatus"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ElementName { @@ -311,7 +311,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["ElementName"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsEnabledDefaultNull { @@ -324,7 +324,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -336,7 +336,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["EnabledDefault"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsEnabledStateNull { @@ -349,7 +349,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -361,7 +361,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["EnabledState"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsHealthStateNull { @@ -374,7 +374,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -386,7 +386,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["HealthState"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsInstallDateNull { @@ -399,7 +399,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -413,7 +413,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string InstanceID { @@ -421,7 +421,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["InstanceID"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Name { @@ -429,7 +429,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Name"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsOperatingStatusNull { @@ -442,7 +442,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -454,7 +454,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["OperatingStatus"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public ushort[] OperationalStatus { @@ -462,7 +462,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort[])(curObj["OperationalStatus"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string OtherEnabledState { @@ -470,7 +470,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["OtherEnabledState"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string PrimaryOwnerContact { @@ -478,7 +478,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["PrimaryOwnerContact"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string PrimaryOwnerName { @@ -486,7 +486,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["PrimaryOwnerName"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPrimaryStatusNull { @@ -499,7 +499,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -511,7 +511,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["PrimaryStatus"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsRequestedStateNull { @@ -524,7 +524,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -536,7 +536,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["RequestedState"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsStartedNull { @@ -549,7 +549,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -561,7 +561,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((bool)(curObj["Started"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string StartMode { @@ -569,7 +569,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["StartMode"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Status { @@ -577,7 +577,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Status"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string[] StatusDescriptions { @@ -585,7 +585,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string[])(curObj["StatusDescriptions"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string SystemCreationClassName { @@ -593,7 +593,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["SystemCreationClassName"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string SystemName { @@ -601,7 +601,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["SystemName"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsTimeOfLastStateChangeNull { @@ -614,7 +614,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -628,7 +628,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsTransitioningToStateNull { @@ -641,7 +641,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -653,9 +653,9 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["TransitioningToState"])); } } - + private bool CheckIfProperClass(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions OptionsParam) { - if (((path != null) + if (((path != null) && (string.Compare(path.ClassName, this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -663,9 +663,9 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return CheckIfProperClass(new System.Management.ManagementObject(mgmtScope, path, OptionsParam)); } } - + private bool CheckIfProperClass(System.Management.ManagementBaseObject theObj) { - if (((theObj != null) + if (((theObj != null) && (string.Compare(((string)(theObj["__CLASS"])), this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -682,42 +682,42 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } return false; } - + private bool ShouldSerializeCommunicationStatus() { if ((this.IsCommunicationStatusNull == false)) { return true; } return false; } - + private bool ShouldSerializeDetailedStatus() { if ((this.IsDetailedStatusNull == false)) { return true; } return false; } - + private bool ShouldSerializeEnabledDefault() { if ((this.IsEnabledDefaultNull == false)) { return true; } return false; } - + private bool ShouldSerializeEnabledState() { if ((this.IsEnabledStateNull == false)) { return true; } return false; } - + private bool ShouldSerializeHealthState() { if ((this.IsHealthStateNull == false)) { return true; } return false; } - + // Converts a given datetime in DMTF format to System.DateTime object. static System.DateTime ToDateTime(string dmtfDate) { System.DateTime initializer = System.DateTime.MinValue; @@ -769,13 +769,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { if (("******" != tempString)) { ticks = (long.Parse(tempString) * ((long)((System.TimeSpan.TicksPerMillisecond / 1000)))); } - if (((((((((year < 0) - || (month < 0)) - || (day < 0)) - || (hour < 0)) - || (minute < 0)) - || (minute < 0)) - || (second < 0)) + if (((((((((year < 0) + || (month < 0)) + || (day < 0)) + || (hour < 0)) + || (minute < 0)) + || (minute < 0)) + || (second < 0)) || (ticks < 0))) { throw new System.ArgumentOutOfRangeException(); } @@ -803,7 +803,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } return datetime; } - + // Converts a given System.DateTime object to DMTF datetime format. static string ToDmtfDateTime(System.DateTime date) { string utcString = string.Empty; @@ -830,8 +830,8 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { dmtfDateTime = string.Concat(dmtfDateTime, ((int)(date.Second)).ToString().PadLeft(2, '0')); dmtfDateTime = string.Concat(dmtfDateTime, "."); System.DateTime dtTemp = new System.DateTime(date.Year, date.Month, date.Day, date.Hour, date.Minute, date.Second, 0); - long microsec = ((long)((((date.Ticks - dtTemp.Ticks) - * 1000) + long microsec = ((long)((((date.Ticks - dtTemp.Ticks) + * 1000) / System.TimeSpan.TicksPerMillisecond))); string strMicrosec = ((long)(microsec)).ToString(); if ((strMicrosec.Length > 6)) { @@ -841,75 +841,75 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { dmtfDateTime = string.Concat(dmtfDateTime, utcString); return dmtfDateTime; } - + private bool ShouldSerializeInstallDate() { if ((this.IsInstallDateNull == false)) { return true; } return false; } - + private bool ShouldSerializeOperatingStatus() { if ((this.IsOperatingStatusNull == false)) { return true; } return false; } - + private bool ShouldSerializePrimaryStatus() { if ((this.IsPrimaryStatusNull == false)) { return true; } return false; } - + private bool ShouldSerializeRequestedState() { if ((this.IsRequestedStateNull == false)) { return true; } return false; } - + private bool ShouldSerializeStarted() { if ((this.IsStartedNull == false)) { return true; } return false; } - + private bool ShouldSerializeTimeOfLastStateChange() { if ((this.IsTimeOfLastStateChangeNull == false)) { return true; } return false; } - + private bool ShouldSerializeTransitioningToState() { if ((this.IsTransitioningToStateNull == false)) { return true; } return false; } - + [Browsable(true)] public void CommitObject() { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(); } } - + [Browsable(true)] public void CommitObject(System.Management.PutOptions putOptions) { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(putOptions); } } - + private void Initialize() { AutoCommitProp = true; isEmbedded = false; } - + private static string ConstructPath(string keyCreationClassName, string keyName, string keySystemCreationClassName, string keySystemName) { string strPath = "ROOT\\virtualization\\v2:Msvm_VirtualEthernetSwitchManagementService"; strPath = string.Concat(strPath, string.Concat(".CreationClassName=", string.Concat("\"", string.Concat(keyCreationClassName, "\"")))); @@ -918,7 +918,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { strPath = string.Concat(strPath, string.Concat(",SystemName=", string.Concat("\"", string.Concat(keySystemName, "\"")))); return strPath; } - + private void InitializeObject(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { Initialize(); if ((path != null)) { @@ -930,24 +930,24 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { PrivateSystemProperties = new ManagementSystemProperties(PrivateLateBoundObject); curObj = PrivateLateBoundObject; } - + // Different overloads of GetInstances() help in enumerating instances of the WMI class. public static VirtualEthernetSwitchManagementServiceCollection GetInstances() { return GetInstances(null, null, null); } - + public static VirtualEthernetSwitchManagementServiceCollection GetInstances(string condition) { return GetInstances(null, condition, null); } - + public static VirtualEthernetSwitchManagementServiceCollection GetInstances(string[] selectedProperties) { return GetInstances(null, null, selectedProperties); } - + public static VirtualEthernetSwitchManagementServiceCollection GetInstances(string condition, string[] selectedProperties) { return GetInstances(null, condition, selectedProperties); } - + public static VirtualEthernetSwitchManagementServiceCollection GetInstances(System.Management.ManagementScope mgmtScope, System.Management.EnumerationOptions enumOptions) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -968,15 +968,15 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } return new VirtualEthernetSwitchManagementServiceCollection(clsObject.GetInstances(enumOptions)); } - + public static VirtualEthernetSwitchManagementServiceCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition) { return GetInstances(mgmtScope, condition, null); } - + public static VirtualEthernetSwitchManagementServiceCollection GetInstances(System.Management.ManagementScope mgmtScope, string[] selectedProperties) { return GetInstances(mgmtScope, null, selectedProperties); } - + public static VirtualEthernetSwitchManagementServiceCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition, string[] selectedProperties) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -993,7 +993,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { ObjectSearcher.Options = enumOptions; return new VirtualEthernetSwitchManagementServiceCollection(ObjectSearcher.Get()); } - + [Browsable(true)] public static VirtualEthernetSwitchManagementService CreateInstance() { System.Management.ManagementScope mgmtScope = null; @@ -1008,12 +1008,12 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { System.Management.ManagementClass tmpMgmtClass = new System.Management.ManagementClass(mgmtScope, mgmtPath, null); return new VirtualEthernetSwitchManagementService(tmpMgmtClass.CreateInstance()); } - + [Browsable(true)] public void Delete() { PrivateLateBoundObject.Delete(); } - + public uint AddFeatureSettings(System.Management.ManagementPath AffectedConfiguration, string[] FeatureSettings, out System.Management.ManagementPath Job, out System.Management.ManagementPath[] ResultingFeatureSettings) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1042,7 +1042,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint AddResourceSettings(System.Management.ManagementPath AffectedConfiguration, string[] ResourceSettings, out System.Management.ManagementPath Job, out System.Management.ManagementPath[] ResultingResourceSettings) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1071,7 +1071,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint DefineSystem(System.Management.ManagementPath ReferenceConfiguration, string[] ResourceSettings, string SystemSettings, out System.Management.ManagementPath Job, out System.Management.ManagementPath ResultingSystem) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1096,7 +1096,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint DestroySystem(System.Management.ManagementPath AffectedSystem, out System.Management.ManagementPath Job) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1114,7 +1114,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint ModifyFeatureSettings(string[] FeatureSettings, out System.Management.ManagementPath Job, out System.Management.ManagementPath[] ResultingFeatureSettings) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1142,7 +1142,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint ModifyResourceSettings(string[] ResourceSettings, out System.Management.ManagementPath Job, out System.Management.ManagementPath[] ResultingResourceSettings) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1170,7 +1170,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint ModifySystemSettings(string SystemSettings, out System.Management.ManagementPath Job) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1188,7 +1188,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint RemoveFeatureSettings(System.Management.ManagementPath[] FeatureSettings, out System.Management.ManagementPath Job) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1216,7 +1216,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint RemoveResourceSettings(System.Management.ManagementPath[] ResourceSettings, out System.Management.ManagementPath Job) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1245,7 +1245,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint RequestStateChange(ushort RequestedState, System.DateTime TimeoutPeriod, out System.Management.ManagementPath Job) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1264,7 +1264,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint StartService() { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1275,7 +1275,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint StopService() { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1286,34 +1286,34 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + // Enumerator implementation for enumerating instances of the class. public class VirtualEthernetSwitchManagementServiceCollection : object, ICollection { - + private ManagementObjectCollection privColObj; - + public VirtualEthernetSwitchManagementServiceCollection(ManagementObjectCollection objCollection) { privColObj = objCollection; } - + public virtual int Count { get { return privColObj.Count; } } - + public virtual bool IsSynchronized { get { return privColObj.IsSynchronized; } } - + public virtual object SyncRoot { get { return this; } } - + public virtual void CopyTo(System.Array array, int index) { privColObj.CopyTo(array, index); int nCtr; @@ -1321,189 +1321,189 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { array.SetValue(new VirtualEthernetSwitchManagementService(((System.Management.ManagementObject)(array.GetValue(nCtr)))), nCtr); } } - + public virtual System.Collections.IEnumerator GetEnumerator() { return new VirtualEthernetSwitchManagementServiceEnumerator(privColObj.GetEnumerator()); } - + public class VirtualEthernetSwitchManagementServiceEnumerator : object, System.Collections.IEnumerator { - + private ManagementObjectCollection.ManagementObjectEnumerator privObjEnum; - + public VirtualEthernetSwitchManagementServiceEnumerator(ManagementObjectCollection.ManagementObjectEnumerator objEnum) { privObjEnum = objEnum; } - + public virtual object Current { get { return new VirtualEthernetSwitchManagementService(((System.Management.ManagementObject)(privObjEnum.Current))); } } - + public virtual bool MoveNext() { return privObjEnum.MoveNext(); } - + public virtual void Reset() { privObjEnum.Reset(); } } } - + // TypeConverter to handle null values for ValueType properties public class WMIValueTypeConverter : TypeConverter { - + private TypeConverter baseConverter; - + private System.Type baseType; - + public WMIValueTypeConverter(System.Type inBaseType) { baseConverter = TypeDescriptor.GetConverter(inBaseType); baseType = inBaseType; } - + 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 ((baseType.BaseType == typeof(System.Enum))) { if ((value.GetType() == destinationType)) { return value; } - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return "NULL_ENUM_VALUE" ; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((baseType == typeof(bool)) + if (((baseType == typeof(bool)) && (baseType.BaseType == typeof(System.ValueType)))) { - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((context != null) + if (((context != null) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } } - + // Embedded class to represent WMI system Properties. [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 { diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_VirtualHardDiskSettingData.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_VirtualHardDiskSettingData.cs index 0a8aec37e58..95b711f6489 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_VirtualHardDiskSettingData.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_VirtualHardDiskSettingData.cs @@ -23,70 +23,70 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { using System.Globalization; using System.ComponentModel.Design.Serialization; using System.Reflection; - - + + // Functions ShouldSerialize are functions used by VS property browser to check if a particular property has to be serialized. These functions are added for all ValueType properties ( properties of type Int32, BOOL etc.. which cannot be set to null). These functions use IsNull function. These functions are also used in the TypeConverter implementation for the properties to check for NULL value of property so that an empty value can be shown in Property browser in case of Drag and Drop in Visual studio. // Functions IsNull() are used to check if a property is NULL. // Functions Reset are added for Nullable Read/Write properties. These functions are used by VS designer in property browser to set a property to NULL. // Every property added to the class for WMI property has attributes set to define its behavior in Visual Studio designer and also to define a TypeConverter to be used. // An Early Bound class generated for the WMI class.Msvm_VirtualHardDiskSettingData public class VirtualHardDiskSettingData : System.ComponentModel.Component { - + // Private property to hold the WMI namespace in which the class resides. private static string CreatedWmiNamespace = "ROOT\\virtualization\\v2"; - + // Private property to hold the name of WMI class which created this class. private static string CreatedClassName = "Msvm_VirtualHardDiskSettingData"; - + // Private member variable to hold the ManagementScope which is used by the various methods. private static System.Management.ManagementScope statMgmtScope = null; - + private ManagementSystemProperties PrivateSystemProperties; - + // Underlying lateBound WMI object. private System.Management.ManagementObject PrivateLateBoundObject; - + // Member variable to store the 'automatic commit' behavior for the class. private bool AutoCommitProp; - + // Private variable to hold the embedded property representing the instance. private System.Management.ManagementBaseObject embeddedObj; - + // The current WMI object used private System.Management.ManagementBaseObject curObj; - + // Flag to indicate if the instance is an embedded object. private bool isEmbedded; - + // Below are different overloads of constructors to initialize an instance of the class with a WMI object. public VirtualHardDiskSettingData() { this.InitializeObject(null, null, null); } - + public VirtualHardDiskSettingData(string keyInstanceID) { this.InitializeObject(null, new System.Management.ManagementPath(VirtualHardDiskSettingData.ConstructPath(keyInstanceID)), null); } - + public VirtualHardDiskSettingData(System.Management.ManagementScope mgmtScope, string keyInstanceID) { this.InitializeObject(((System.Management.ManagementScope)(mgmtScope)), new System.Management.ManagementPath(VirtualHardDiskSettingData.ConstructPath(keyInstanceID)), null); } - + public VirtualHardDiskSettingData(System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(null, path, getOptions); } - + public VirtualHardDiskSettingData(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path) { this.InitializeObject(mgmtScope, path, null); } - + public VirtualHardDiskSettingData(System.Management.ManagementPath path) { this.InitializeObject(null, path, null); } - + public VirtualHardDiskSettingData(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(mgmtScope, path, getOptions); } - + public VirtualHardDiskSettingData(System.Management.ManagementObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -98,7 +98,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { throw new System.ArgumentException("Class name does not match."); } } - + public VirtualHardDiskSettingData(System.Management.ManagementBaseObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -111,7 +111,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { throw new System.ArgumentException("Class name does not match."); } } - + // Property returns the namespace of the WMI class. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -120,7 +120,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return "ROOT\\virtualization\\v2"; } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ManagementClassName { @@ -129,7 +129,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { if ((curObj != null)) { if ((curObj.ClassPath != null)) { strRet = ((string)(curObj["__CLASS"])); - if (((strRet == null) + if (((strRet == null) || (strRet == string.Empty))) { strRet = CreatedClassName; } @@ -138,7 +138,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return strRet; } } - + // Property pointing to an embedded object to get System properties of the WMI object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -147,7 +147,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return PrivateSystemProperties; } } - + // Property returning the underlying lateBound object. [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -156,7 +156,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return curObj; } } - + // ManagementScope of the object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -175,7 +175,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + // Property to show the commit behavior for the WMI object. If true, WMI object will be automatically saved after each property modification.(ie. Put() is called after modification of a property). [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -187,7 +187,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { AutoCommitProp = value; } } - + // The ManagementPath of the underlying WMI object. [Browsable(true)] public System.Management.ManagementPath Path { @@ -208,7 +208,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + // Public static scope property which is used by the various methods. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -220,7 +220,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { statMgmtScope = value; } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsBlockSizeNull { @@ -233,7 +233,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The block size used by the virtual hard disk")] @@ -247,13 +247,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } set { curObj["BlockSize"] = value; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Caption { @@ -262,13 +262,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } set { curObj["Caption"] = value; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Description { @@ -277,13 +277,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } set { curObj["Description"] = value; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ElementName { @@ -292,13 +292,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } set { curObj["ElementName"] = value; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsFormatNull { @@ -311,7 +311,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The format for the virtual hard disk.")] @@ -330,13 +330,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { else { curObj["Format"] = value; } - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string InstanceID { @@ -345,13 +345,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } set { curObj["InstanceID"] = value; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsLogicalSectorSizeNull { @@ -364,7 +364,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The logical sector size used by the virtual hard disk")] @@ -378,13 +378,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } set { curObj["LogicalSectorSize"] = value; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsMaxInternalSizeNull { @@ -397,7 +397,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The maximum size of the virtual hard disk as viewable by the virtual machine, in " + @@ -413,13 +413,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } set { curObj["MaxInternalSize"] = value; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The parent of the virtual hard disk. If the virtual hard disk does not have a par" + @@ -430,13 +430,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } set { curObj["ParentPath"] = value; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The path of the virtual hard disk.")] @@ -446,13 +446,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } set { curObj["Path"] = value; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPhysicalSectorSizeNull { @@ -465,7 +465,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The physical sector size used by the virtual hard disk")] @@ -479,13 +479,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } set { curObj["PhysicalSectorSize"] = value; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsTypeNull { @@ -498,7 +498,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The type of virtual hard disk.")] @@ -517,15 +517,15 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { else { curObj["Type"] = value; } - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } } - + private bool CheckIfProperClass(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions OptionsParam) { - if (((path != null) + if (((path != null) && (string.Compare(path.ClassName, this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -533,9 +533,9 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return CheckIfProperClass(new System.Management.ManagementObject(mgmtScope, path, OptionsParam)); } } - + private bool CheckIfProperClass(System.Management.ManagementBaseObject theObj) { - if (((theObj != null) + if (((theObj != null) && (string.Compare(((string)(theObj["__CLASS"])), this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -552,162 +552,162 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } return false; } - + private bool ShouldSerializeBlockSize() { if ((this.IsBlockSizeNull == false)) { return true; } return false; } - + private void ResetBlockSize() { curObj["BlockSize"] = null; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } - + private void ResetCaption() { curObj["Caption"] = null; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } - + private void ResetDescription() { curObj["Description"] = null; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } - + private void ResetElementName() { curObj["ElementName"] = null; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } - + private bool ShouldSerializeFormat() { if ((this.IsFormatNull == false)) { return true; } return false; } - + private void ResetFormat() { curObj["Format"] = null; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } - + private bool ShouldSerializeLogicalSectorSize() { if ((this.IsLogicalSectorSizeNull == false)) { return true; } return false; } - + private void ResetLogicalSectorSize() { curObj["LogicalSectorSize"] = null; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } - + private bool ShouldSerializeMaxInternalSize() { if ((this.IsMaxInternalSizeNull == false)) { return true; } return false; } - + private void ResetMaxInternalSize() { curObj["MaxInternalSize"] = null; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } - + private void ResetParentPath() { curObj["ParentPath"] = null; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } - + private void ResetPath0() { curObj["Path"] = null; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } - + private bool ShouldSerializePhysicalSectorSize() { if ((this.IsPhysicalSectorSizeNull == false)) { return true; } return false; } - + private void ResetPhysicalSectorSize() { curObj["PhysicalSectorSize"] = null; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } - + private bool ShouldSerializeType() { if ((this.IsTypeNull == false)) { return true; } return false; } - + private void ResetType() { curObj["Type"] = null; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } - + [Browsable(true)] public void CommitObject() { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(); } } - + [Browsable(true)] public void CommitObject(System.Management.PutOptions putOptions) { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(putOptions); } } - + private void Initialize() { AutoCommitProp = true; isEmbedded = false; } - + private static string ConstructPath(string keyInstanceID) { string strPath = "ROOT\\virtualization\\v2:Msvm_VirtualHardDiskSettingData"; strPath = string.Concat(strPath, string.Concat(".InstanceID=", string.Concat("\"", string.Concat(keyInstanceID, "\"")))); return strPath; } - + private void InitializeObject(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { Initialize(); if ((path != null)) { @@ -719,24 +719,24 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { PrivateSystemProperties = new ManagementSystemProperties(PrivateLateBoundObject); curObj = PrivateLateBoundObject; } - + // Different overloads of GetInstances() help in enumerating instances of the WMI class. public static VirtualHardDiskSettingDataCollection GetInstances() { return GetInstances(null, null, null); } - + public static VirtualHardDiskSettingDataCollection GetInstances(string condition) { return GetInstances(null, condition, null); } - + public static VirtualHardDiskSettingDataCollection GetInstances(string[] selectedProperties) { return GetInstances(null, null, selectedProperties); } - + public static VirtualHardDiskSettingDataCollection GetInstances(string condition, string[] selectedProperties) { return GetInstances(null, condition, selectedProperties); } - + public static VirtualHardDiskSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, System.Management.EnumerationOptions enumOptions) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -757,15 +757,15 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } return new VirtualHardDiskSettingDataCollection(clsObject.GetInstances(enumOptions)); } - + public static VirtualHardDiskSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition) { return GetInstances(mgmtScope, condition, null); } - + public static VirtualHardDiskSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string[] selectedProperties) { return GetInstances(mgmtScope, null, selectedProperties); } - + public static VirtualHardDiskSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition, string[] selectedProperties) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -782,7 +782,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { ObjectSearcher.Options = enumOptions; return new VirtualHardDiskSettingDataCollection(ObjectSearcher.Get()); } - + [Browsable(true)] public static VirtualHardDiskSettingData CreateInstance() { System.Management.ManagementScope mgmtScope = null; @@ -797,59 +797,59 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { System.Management.ManagementClass tmpMgmtClass = new System.Management.ManagementClass(mgmtScope, mgmtPath, null); return new VirtualHardDiskSettingData(tmpMgmtClass.CreateInstance()); } - + [Browsable(true)] public void Delete() { PrivateLateBoundObject.Delete(); } - + public enum FormatValues { - + VHD = 2, - + VHDX = 3, - + NULL_ENUM_VALUE = 0, } - + public enum TypeValues { - + Fixed = 2, - + Dynamic = 3, - + Differencing = 4, - + NULL_ENUM_VALUE = 0, } - + // Enumerator implementation for enumerating instances of the class. public class VirtualHardDiskSettingDataCollection : object, ICollection { - + private ManagementObjectCollection privColObj; - + public VirtualHardDiskSettingDataCollection(ManagementObjectCollection objCollection) { privColObj = objCollection; } - + public virtual int Count { get { return privColObj.Count; } } - + public virtual bool IsSynchronized { get { return privColObj.IsSynchronized; } } - + public virtual object SyncRoot { get { return this; } } - + public virtual void CopyTo(System.Array array, int index) { privColObj.CopyTo(array, index); int nCtr; @@ -857,189 +857,189 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { array.SetValue(new VirtualHardDiskSettingData(((System.Management.ManagementObject)(array.GetValue(nCtr)))), nCtr); } } - + public virtual System.Collections.IEnumerator GetEnumerator() { return new VirtualHardDiskSettingDataEnumerator(privColObj.GetEnumerator()); } - + public class VirtualHardDiskSettingDataEnumerator : object, System.Collections.IEnumerator { - + private ManagementObjectCollection.ManagementObjectEnumerator privObjEnum; - + public VirtualHardDiskSettingDataEnumerator(ManagementObjectCollection.ManagementObjectEnumerator objEnum) { privObjEnum = objEnum; } - + public virtual object Current { get { return new VirtualHardDiskSettingData(((System.Management.ManagementObject)(privObjEnum.Current))); } } - + public virtual bool MoveNext() { return privObjEnum.MoveNext(); } - + public virtual void Reset() { privObjEnum.Reset(); } } } - + // TypeConverter to handle null values for ValueType properties public class WMIValueTypeConverter : TypeConverter { - + private TypeConverter baseConverter; - + private System.Type baseType; - + public WMIValueTypeConverter(System.Type inBaseType) { baseConverter = TypeDescriptor.GetConverter(inBaseType); baseType = inBaseType; } - + 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 ((baseType.BaseType == typeof(System.Enum))) { if ((value.GetType() == destinationType)) { return value; } - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return "NULL_ENUM_VALUE" ; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((baseType == typeof(bool)) + if (((baseType == typeof(bool)) && (baseType.BaseType == typeof(System.ValueType)))) { - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((context != null) + if (((context != null) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } } - + // Embedded class to represent WMI system Properties. [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 { diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_VirtualSystemManagementService.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_VirtualSystemManagementService.cs index ba014b1e322..b327d81bf94 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_VirtualSystemManagementService.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_VirtualSystemManagementService.cs @@ -24,8 +24,8 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 using System.Globalization; using System.ComponentModel.Design.Serialization; using System.Reflection; - - + + // Functions ShouldSerialize are functions used by VS property browser to check if a particular property has to be serialized. These functions are added for all ValueType properties ( properties of type Int32, BOOL etc.. which cannot be set to null). These functions use IsNull function. These functions are also used in the TypeConverter implementation for the properties to check for NULL value of property so that an empty value can be shown in Property browser in case of Drag and Drop in Visual studio. // Functions IsNull() are used to check if a property is NULL. // Functions Reset are added for Nullable Read/Write properties. These functions are used by VS designer in property browser to set a property to NULL. @@ -33,62 +33,62 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 // Datetime conversion functions ToDateTime and ToDmtfDateTime are added to the class to convert DMTF datetime to System.DateTime and vice-versa. // An Early Bound class generated for the WMI class.Msvm_VirtualSystemManagementService public class VirtualSystemManagementService : System.ComponentModel.Component { - + // Private property to hold the WMI namespace in which the class resides. private static string CreatedWmiNamespace = "ROOT\\virtualization\\v2"; - + // Private property to hold the name of WMI class which created this class. private static string CreatedClassName = "Msvm_VirtualSystemManagementService"; - + // Private member variable to hold the ManagementScope which is used by the various methods. private static System.Management.ManagementScope statMgmtScope = null; - + private ManagementSystemProperties PrivateSystemProperties; - + // Underlying lateBound WMI object. private System.Management.ManagementObject PrivateLateBoundObject; - + // Member variable to store the 'automatic commit' behavior for the class. private bool AutoCommitProp; - + // Private variable to hold the embedded property representing the instance. private System.Management.ManagementBaseObject embeddedObj; - + // The current WMI object used private System.Management.ManagementBaseObject curObj; - + // Flag to indicate if the instance is an embedded object. private bool isEmbedded; - + // Below are different overloads of constructors to initialize an instance of the class with a WMI object. public VirtualSystemManagementService() { this.InitializeObject(null, null, null); } - + public VirtualSystemManagementService(string keyCreationClassName, string keyName, string keySystemCreationClassName, string keySystemName) { this.InitializeObject(null, new System.Management.ManagementPath(VirtualSystemManagementService.ConstructPath(keyCreationClassName, keyName, keySystemCreationClassName, keySystemName)), null); } - + public VirtualSystemManagementService(System.Management.ManagementScope mgmtScope, string keyCreationClassName, string keyName, string keySystemCreationClassName, string keySystemName) { this.InitializeObject(((System.Management.ManagementScope)(mgmtScope)), new System.Management.ManagementPath(VirtualSystemManagementService.ConstructPath(keyCreationClassName, keyName, keySystemCreationClassName, keySystemName)), null); } - + public VirtualSystemManagementService(System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(null, path, getOptions); } - + public VirtualSystemManagementService(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path) { this.InitializeObject(mgmtScope, path, null); } - + public VirtualSystemManagementService(System.Management.ManagementPath path) { this.InitializeObject(null, path, null); } - + public VirtualSystemManagementService(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(mgmtScope, path, getOptions); } - + public VirtualSystemManagementService(System.Management.ManagementObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -100,7 +100,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 throw new System.ArgumentException("Class name does not match."); } } - + public VirtualSystemManagementService(System.Management.ManagementBaseObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -113,7 +113,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 throw new System.ArgumentException("Class name does not match."); } } - + // Property returns the namespace of the WMI class. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -122,7 +122,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return "ROOT\\virtualization\\v2"; } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ManagementClassName { @@ -131,7 +131,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 if ((curObj != null)) { if ((curObj.ClassPath != null)) { strRet = ((string)(curObj["__CLASS"])); - if (((strRet == null) + if (((strRet == null) || (strRet == string.Empty))) { strRet = CreatedClassName; } @@ -140,7 +140,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return strRet; } } - + // Property pointing to an embedded object to get System properties of the WMI object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -149,7 +149,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return PrivateSystemProperties; } } - + // Property returning the underlying lateBound object. [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -158,7 +158,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return curObj; } } - + // ManagementScope of the object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -177,7 +177,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + // Property to show the commit behavior for the WMI object. If true, WMI object will be automatically saved after each property modification.(ie. Put() is called after modification of a property). [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -189,7 +189,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 AutoCommitProp = value; } } - + // The ManagementPath of the underlying WMI object. [Browsable(true)] public System.Management.ManagementPath Path { @@ -210,7 +210,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + // Public static scope property which is used by the various methods. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -222,7 +222,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 statMgmtScope = value; } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public ushort[] AvailableRequestedStates { @@ -230,7 +230,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((ushort[])(curObj["AvailableRequestedStates"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Caption { @@ -238,7 +238,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string)(curObj["Caption"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsCommunicationStatusNull { @@ -251,7 +251,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -263,7 +263,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((ushort)(curObj["CommunicationStatus"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string CreationClassName { @@ -271,7 +271,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string)(curObj["CreationClassName"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Description { @@ -279,7 +279,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string)(curObj["Description"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsDetailedStatusNull { @@ -292,7 +292,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -304,7 +304,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((ushort)(curObj["DetailedStatus"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ElementName { @@ -312,7 +312,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string)(curObj["ElementName"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsEnabledDefaultNull { @@ -325,7 +325,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -337,7 +337,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((ushort)(curObj["EnabledDefault"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsEnabledStateNull { @@ -350,7 +350,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -362,7 +362,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((ushort)(curObj["EnabledState"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsHealthStateNull { @@ -375,7 +375,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -387,7 +387,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((ushort)(curObj["HealthState"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsInstallDateNull { @@ -400,7 +400,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -414,7 +414,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string InstanceID { @@ -422,7 +422,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string)(curObj["InstanceID"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Name { @@ -430,7 +430,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string)(curObj["Name"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsOperatingStatusNull { @@ -443,7 +443,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -455,7 +455,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((ushort)(curObj["OperatingStatus"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public ushort[] OperationalStatus { @@ -463,7 +463,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((ushort[])(curObj["OperationalStatus"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string OtherEnabledState { @@ -471,7 +471,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string)(curObj["OtherEnabledState"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string PrimaryOwnerContact { @@ -479,7 +479,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string)(curObj["PrimaryOwnerContact"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string PrimaryOwnerName { @@ -487,7 +487,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string)(curObj["PrimaryOwnerName"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPrimaryStatusNull { @@ -500,7 +500,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -512,7 +512,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((ushort)(curObj["PrimaryStatus"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsRequestedStateNull { @@ -525,7 +525,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -537,7 +537,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((ushort)(curObj["RequestedState"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsStartedNull { @@ -550,7 +550,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -562,7 +562,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((bool)(curObj["Started"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string StartMode { @@ -570,7 +570,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string)(curObj["StartMode"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Status { @@ -578,7 +578,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string)(curObj["Status"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string[] StatusDescriptions { @@ -586,7 +586,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string[])(curObj["StatusDescriptions"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string SystemCreationClassName { @@ -594,7 +594,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string)(curObj["SystemCreationClassName"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string SystemName { @@ -602,7 +602,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((string)(curObj["SystemName"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsTimeOfLastStateChangeNull { @@ -615,7 +615,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -629,7 +629,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsTransitioningToStateNull { @@ -642,7 +642,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -654,9 +654,9 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return ((ushort)(curObj["TransitioningToState"])); } } - + private bool CheckIfProperClass(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions OptionsParam) { - if (((path != null) + if (((path != null) && (string.Compare(path.ClassName, this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -664,9 +664,9 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return CheckIfProperClass(new System.Management.ManagementObject(mgmtScope, path, OptionsParam)); } } - + private bool CheckIfProperClass(System.Management.ManagementBaseObject theObj) { - if (((theObj != null) + if (((theObj != null) && (string.Compare(((string)(theObj["__CLASS"])), this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -683,42 +683,42 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } return false; } - + private bool ShouldSerializeCommunicationStatus() { if ((this.IsCommunicationStatusNull == false)) { return true; } return false; } - + private bool ShouldSerializeDetailedStatus() { if ((this.IsDetailedStatusNull == false)) { return true; } return false; } - + private bool ShouldSerializeEnabledDefault() { if ((this.IsEnabledDefaultNull == false)) { return true; } return false; } - + private bool ShouldSerializeEnabledState() { if ((this.IsEnabledStateNull == false)) { return true; } return false; } - + private bool ShouldSerializeHealthState() { if ((this.IsHealthStateNull == false)) { return true; } return false; } - + // Converts a given datetime in DMTF format to System.DateTime object. static System.DateTime ToDateTime(string dmtfDate) { System.DateTime initializer = System.DateTime.MinValue; @@ -770,13 +770,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 if (("******" != tempString)) { ticks = (long.Parse(tempString) * ((long)((System.TimeSpan.TicksPerMillisecond / 1000)))); } - if (((((((((year < 0) - || (month < 0)) - || (day < 0)) - || (hour < 0)) - || (minute < 0)) - || (minute < 0)) - || (second < 0)) + if (((((((((year < 0) + || (month < 0)) + || (day < 0)) + || (hour < 0)) + || (minute < 0)) + || (minute < 0)) + || (second < 0)) || (ticks < 0))) { throw new System.ArgumentOutOfRangeException(); } @@ -804,7 +804,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } return datetime; } - + // Converts a given System.DateTime object to DMTF datetime format. static string ToDmtfDateTime(System.DateTime date) { string utcString = string.Empty; @@ -831,8 +831,8 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 dmtfDateTime = string.Concat(dmtfDateTime, ((int)(date.Second)).ToString().PadLeft(2, '0')); dmtfDateTime = string.Concat(dmtfDateTime, "."); System.DateTime dtTemp = new System.DateTime(date.Year, date.Month, date.Day, date.Hour, date.Minute, date.Second, 0); - long microsec = ((long)((((date.Ticks - dtTemp.Ticks) - * 1000) + long microsec = ((long)((((date.Ticks - dtTemp.Ticks) + * 1000) / System.TimeSpan.TicksPerMillisecond))); string strMicrosec = ((long)(microsec)).ToString(); if ((strMicrosec.Length > 6)) { @@ -842,75 +842,75 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 dmtfDateTime = string.Concat(dmtfDateTime, utcString); return dmtfDateTime; } - + private bool ShouldSerializeInstallDate() { if ((this.IsInstallDateNull == false)) { return true; } return false; } - + private bool ShouldSerializeOperatingStatus() { if ((this.IsOperatingStatusNull == false)) { return true; } return false; } - + private bool ShouldSerializePrimaryStatus() { if ((this.IsPrimaryStatusNull == false)) { return true; } return false; } - + private bool ShouldSerializeRequestedState() { if ((this.IsRequestedStateNull == false)) { return true; } return false; } - + private bool ShouldSerializeStarted() { if ((this.IsStartedNull == false)) { return true; } return false; } - + private bool ShouldSerializeTimeOfLastStateChange() { if ((this.IsTimeOfLastStateChangeNull == false)) { return true; } return false; } - + private bool ShouldSerializeTransitioningToState() { if ((this.IsTransitioningToStateNull == false)) { return true; } return false; } - + [Browsable(true)] public void CommitObject() { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(); } } - + [Browsable(true)] public void CommitObject(System.Management.PutOptions putOptions) { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(putOptions); } } - + private void Initialize() { AutoCommitProp = true; isEmbedded = false; } - + private static string ConstructPath(string keyCreationClassName, string keyName, string keySystemCreationClassName, string keySystemName) { string strPath = "ROOT\\virtualization\\v2:Msvm_VirtualSystemManagementService"; strPath = string.Concat(strPath, string.Concat(".CreationClassName=", string.Concat("\"", string.Concat(keyCreationClassName, "\"")))); @@ -919,7 +919,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 strPath = string.Concat(strPath, string.Concat(",SystemName=", string.Concat("\"", string.Concat(keySystemName, "\"")))); return strPath; } - + private void InitializeObject(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { Initialize(); if ((path != null)) { @@ -931,24 +931,24 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 PrivateSystemProperties = new ManagementSystemProperties(PrivateLateBoundObject); curObj = PrivateLateBoundObject; } - + // Different overloads of GetInstances() help in enumerating instances of the WMI class. public static VirtualSystemManagementServiceCollection GetInstances() { return GetInstances(null, null, null); } - + public static VirtualSystemManagementServiceCollection GetInstances(string condition) { return GetInstances(null, condition, null); } - + public static VirtualSystemManagementServiceCollection GetInstances(string[] selectedProperties) { return GetInstances(null, null, selectedProperties); } - + public static VirtualSystemManagementServiceCollection GetInstances(string condition, string[] selectedProperties) { return GetInstances(null, condition, selectedProperties); } - + public static VirtualSystemManagementServiceCollection GetInstances(System.Management.ManagementScope mgmtScope, System.Management.EnumerationOptions enumOptions) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -969,15 +969,15 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } return new VirtualSystemManagementServiceCollection(clsObject.GetInstances(enumOptions)); } - + public static VirtualSystemManagementServiceCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition) { return GetInstances(mgmtScope, condition, null); } - + public static VirtualSystemManagementServiceCollection GetInstances(System.Management.ManagementScope mgmtScope, string[] selectedProperties) { return GetInstances(mgmtScope, null, selectedProperties); } - + public static VirtualSystemManagementServiceCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition, string[] selectedProperties) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -994,7 +994,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 ObjectSearcher.Options = enumOptions; return new VirtualSystemManagementServiceCollection(ObjectSearcher.Get()); } - + [Browsable(true)] public static VirtualSystemManagementService CreateInstance() { System.Management.ManagementScope mgmtScope = null; @@ -1009,12 +1009,12 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 System.Management.ManagementClass tmpMgmtClass = new System.Management.ManagementClass(mgmtScope, mgmtPath, null); return new VirtualSystemManagementService(tmpMgmtClass.CreateInstance()); } - + [Browsable(true)] public void Delete() { PrivateLateBoundObject.Delete(); } - + public uint AddFeatureSettings(System.Management.ManagementPath AffectedConfiguration, string[] FeatureSettings, out System.Management.ManagementPath Job, out System.Management.ManagementPath[] ResultingFeatureSettings) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1045,7 +1045,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return System.Convert.ToUInt32(0); } } - + public uint AddFibreChannelChap(string[] FcPortSettings, byte SecretEncoding, byte[] SharedSecret) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1060,7 +1060,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return System.Convert.ToUInt32(0); } } - + public uint AddKvpItems(string[] DataItems, System.Management.ManagementPath TargetSystem, out System.Management.ManagementPath Job) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1080,7 +1080,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return System.Convert.ToUInt32(0); } } - + public uint AddResourceSettings(System.Management.ManagementPath AffectedConfiguration, string[] ResourceSettings, out System.Management.ManagementPath Job, out System.Management.ManagementPath[] ResultingResourceSettings) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1111,7 +1111,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return System.Convert.ToUInt32(0); } } - + public uint DefineSystem(string ReferenceConfigurationPath, string[] ResourceSettings, string SystemSettings, out System.Management.ManagementPath Job, out System.Management.ManagementPath ResultingSystem) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1138,7 +1138,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return System.Convert.ToUInt32(0); } } - + public uint DestroySystem(System.Management.ManagementPath AffectedSystem, out System.Management.ManagementPath Job) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1157,7 +1157,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return System.Convert.ToUInt32(0); } } - + public uint ExportSystemDefinition(System.Management.ManagementPath ComputerSystem, string ExportDirectory, string ExportSettingData, out System.Management.ManagementPath Job) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1179,7 +1179,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return System.Convert.ToUInt32(0); } } - + public uint FormatError(string[] Errors, out string ErrorMessage) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1194,7 +1194,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return System.Convert.ToUInt32(0); } } - + public uint GenerateWwpn(uint NumberOfWwpns, out string[] GeneratedWwpn) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1209,7 +1209,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return System.Convert.ToUInt32(0); } } - + public uint GetCurrentWwpnFromGenerator(out string CurrentWwpn) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1222,7 +1222,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return System.Convert.ToUInt32(0); } } - + public uint GetDefinitionFileSummaryInformation(string[] DefinitionFiles, out System.Management.ManagementBaseObject[] SummaryInformation) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1237,7 +1237,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return System.Convert.ToUInt32(0); } } - + public uint GetSizeOfSystemFiles(System.Management.ManagementPath Vssd, out ulong Size) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1252,7 +1252,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return System.Convert.ToUInt32(0); } } - + public uint GetSummaryInformation(uint[] RequestedInformation, System.Management.ManagementPath[] SettingData, out System.Management.ManagementBaseObject[] SummaryInformation) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1278,7 +1278,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return System.Convert.ToUInt32(0); } } - + public uint GetVirtualSystemThumbnailImage(ushort HeightPixels, System.Management.ManagementPath TargetSystem, ushort WidthPixels, out byte[] ImageData) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1295,7 +1295,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return System.Convert.ToUInt32(0); } } - + public uint ImportSnapshotDefinitions(System.Management.ManagementPath PlannedSystem, string SnapshotFolder, out System.Management.ManagementPath[] ImportedSnapshots, out System.Management.ManagementPath Job) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1326,7 +1326,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return System.Convert.ToUInt32(0); } } - + public uint ImportSystemDefinition(bool GenerateNewSystemIdentifier, string SnapshotFolder, string SystemDefinitionFile, out System.Management.ManagementPath ImportedSystem, out System.Management.ManagementPath Job) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1354,7 +1354,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return System.Convert.ToUInt32(0); } } - + public uint ModifyDiskMergeSettings(string SettingData, out System.Management.ManagementPath Job) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1373,7 +1373,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return System.Convert.ToUInt32(0); } } - + public uint ModifyFeatureSettings(string[] FeatureSettings, out System.Management.ManagementPath Job, out System.Management.ManagementPath[] ResultingFeatureSettings) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1403,7 +1403,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return System.Convert.ToUInt32(0); } } - + public uint ModifyKvpItems(string[] DataItems, System.Management.ManagementPath TargetSystem, out System.Management.ManagementPath Job) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1423,7 +1423,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return System.Convert.ToUInt32(0); } } - + public uint ModifyResourceSettings(string[] ResourceSettings, out System.Management.ManagementPath Job, out System.Management.ManagementPath[] ResultingResourceSettings) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1453,7 +1453,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return System.Convert.ToUInt32(0); } } - + public uint ModifyServiceSettings(string SettingData, out System.Management.ManagementPath Job) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1472,7 +1472,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return System.Convert.ToUInt32(0); } } - + public uint ModifySystemSettings(string SystemSettings, out System.Management.ManagementPath Job) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1491,7 +1491,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return System.Convert.ToUInt32(0); } } - + public uint RealizePlannedSystem(System.Management.ManagementPath PlannedSystem, out System.Management.ManagementPath Job, out System.Management.ManagementPath ResultingSystem) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1515,7 +1515,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return System.Convert.ToUInt32(0); } } - + public uint RemoveFeatureSettings(System.Management.ManagementPath[] FeatureSettings, out System.Management.ManagementPath Job) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1544,7 +1544,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return System.Convert.ToUInt32(0); } } - + public uint RemoveFibreChannelChap(string[] FcPortSettings) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1557,7 +1557,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return System.Convert.ToUInt32(0); } } - + public uint RemoveKvpItems(string[] DataItems, System.Management.ManagementPath TargetSystem, out System.Management.ManagementPath Job) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1577,7 +1577,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return System.Convert.ToUInt32(0); } } - + public uint RemoveResourceSettings(System.Management.ManagementPath[] ResourceSettings, out System.Management.ManagementPath Job) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1606,7 +1606,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return System.Convert.ToUInt32(0); } } - + public uint RequestStateChange(ushort RequestedState, System.DateTime TimeoutPeriod, out System.Management.ManagementPath Job) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1626,7 +1626,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return System.Convert.ToUInt32(0); } } - + public uint SetGuestNetworkAdapterConfiguration(System.Management.ManagementPath ComputerSystem, string[] NetworkConfiguration, out System.Management.ManagementPath Job) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1646,7 +1646,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return System.Convert.ToUInt32(0); } } - + public uint StartService() { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1657,7 +1657,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return System.Convert.ToUInt32(0); } } - + public uint StopService() { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1668,7 +1668,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return System.Convert.ToUInt32(0); } } - + public uint ValidatePlannedSystem(System.Management.ManagementPath PlannedSystem, out System.Management.ManagementPath Job) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1687,34 +1687,34 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return System.Convert.ToUInt32(0); } } - + // Enumerator implementation for enumerating instances of the class. public class VirtualSystemManagementServiceCollection : object, ICollection { - + private ManagementObjectCollection privColObj; - + public VirtualSystemManagementServiceCollection(ManagementObjectCollection objCollection) { privColObj = objCollection; } - + public virtual int Count { get { return privColObj.Count; } } - + public virtual bool IsSynchronized { get { return privColObj.IsSynchronized; } } - + public virtual object SyncRoot { get { return this; } } - + public virtual void CopyTo(System.Array array, int index) { privColObj.CopyTo(array, index); int nCtr; @@ -1722,189 +1722,189 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 array.SetValue(new VirtualSystemManagementService(((System.Management.ManagementObject)(array.GetValue(nCtr)))), nCtr); } } - + public virtual System.Collections.IEnumerator GetEnumerator() { return new VirtualSystemManagementServiceEnumerator(privColObj.GetEnumerator()); } - + public class VirtualSystemManagementServiceEnumerator : object, System.Collections.IEnumerator { - + private ManagementObjectCollection.ManagementObjectEnumerator privObjEnum; - + public VirtualSystemManagementServiceEnumerator(ManagementObjectCollection.ManagementObjectEnumerator objEnum) { privObjEnum = objEnum; } - + public virtual object Current { get { return new VirtualSystemManagementService(((System.Management.ManagementObject)(privObjEnum.Current))); } } - + public virtual bool MoveNext() { return privObjEnum.MoveNext(); } - + public virtual void Reset() { privObjEnum.Reset(); } } } - + // TypeConverter to handle null values for ValueType properties public class WMIValueTypeConverter : TypeConverter { - + private TypeConverter baseConverter; - + private System.Type baseType; - + public WMIValueTypeConverter(System.Type inBaseType) { baseConverter = TypeDescriptor.GetConverter(inBaseType); baseType = inBaseType; } - + 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 ((baseType.BaseType == typeof(System.Enum))) { if ((value.GetType() == destinationType)) { return value; } - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return "NULL_ENUM_VALUE" ; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((baseType == typeof(bool)) + if (((baseType == typeof(bool)) && (baseType.BaseType == typeof(System.ValueType)))) { - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((context != null) + if (((context != null) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } } - + // Embedded class to represent WMI system Properties. [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 { diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_VirtualSystemManagementServiceSettingData.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_VirtualSystemManagementServiceSettingData.cs index 390140f2b5e..c11e5cc27d6 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_VirtualSystemManagementServiceSettingData.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_VirtualSystemManagementServiceSettingData.cs @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 +namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { using System; using System.ComponentModel; @@ -24,70 +24,70 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 using System.Globalization; using System.ComponentModel.Design.Serialization; using System.Reflection; - - + + // Functions ShouldSerialize are functions used by VS property browser to check if a particular property has to be serialized. These functions are added for all ValueType properties ( properties of type Int32, BOOL etc.. which cannot be set to null). These functions use IsNull function. These functions are also used in the TypeConverter implementation for the properties to check for NULL value of property so that an empty value can be shown in Property browser in case of Drag and Drop in Visual studio. // Functions IsNull() are used to check if a property is NULL. // Functions Reset are added for Nullable Read/Write properties. These functions are used by VS designer in property browser to set a property to NULL. // Every property added to the class for WMI property has attributes set to define its behavior in Visual Studio designer and also to define a TypeConverter to be used. // An Early Bound class generated for the WMI class.Msvm_VirtualSystemManagementServiceSettingData public class VirtualSystemManagementServiceSettingData : System.ComponentModel.Component { - + // Private property to hold the WMI namespace in which the class resides. private static string CreatedWmiNamespace = "ROOT\\virtualization\\v2"; - + // Private property to hold the name of WMI class which created this class. public static string CreatedClassName = "Msvm_VirtualSystemManagementServiceSettingData"; - + // Private member variable to hold the ManagementScope which is used by the various methods. private static System.Management.ManagementScope statMgmtScope = null; - + private ManagementSystemProperties PrivateSystemProperties; - + // Underlying lateBound WMI object. private System.Management.ManagementObject PrivateLateBoundObject; - + // Member variable to store the 'automatic commit' behavior for the class. private bool AutoCommitProp; - + // Private variable to hold the embedded property representing the instance. private System.Management.ManagementBaseObject embeddedObj; - + // The current WMI object used private System.Management.ManagementBaseObject curObj; - + // Flag to indicate if the instance is an embedded object. private bool isEmbedded; - + // Below are different overloads of constructors to initialize an instance of the class with a WMI object. public VirtualSystemManagementServiceSettingData() { this.InitializeObject(null, null, null); } - + public VirtualSystemManagementServiceSettingData(string keyInstanceID) { this.InitializeObject(null, new System.Management.ManagementPath(VirtualSystemManagementServiceSettingData.ConstructPath(keyInstanceID)), null); } - + public VirtualSystemManagementServiceSettingData(System.Management.ManagementScope mgmtScope, string keyInstanceID) { this.InitializeObject(((System.Management.ManagementScope)(mgmtScope)), new System.Management.ManagementPath(VirtualSystemManagementServiceSettingData.ConstructPath(keyInstanceID)), null); } - + public VirtualSystemManagementServiceSettingData(System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(null, path, getOptions); } - + public VirtualSystemManagementServiceSettingData(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path) { this.InitializeObject(mgmtScope, path, null); } - + public VirtualSystemManagementServiceSettingData(System.Management.ManagementPath path) { this.InitializeObject(null, path, null); } - + public VirtualSystemManagementServiceSettingData(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(mgmtScope, path, getOptions); } - + public VirtualSystemManagementServiceSettingData(System.Management.ManagementObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -99,7 +99,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 throw new System.ArgumentException("Class name does not match."); } } - + public VirtualSystemManagementServiceSettingData(System.Management.ManagementBaseObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -112,7 +112,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 throw new System.ArgumentException("Class name does not match."); } } - + // Property returns the namespace of the WMI class. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -121,7 +121,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return "ROOT\\virtualization\\v2"; } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ManagementClassName { @@ -130,7 +130,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 if ((curObj != null)) { if ((curObj.ClassPath != null)) { strRet = ((string)(curObj["__CLASS"])); - if (((strRet == null) + if (((strRet == null) || (strRet == string.Empty))) { strRet = CreatedClassName; } @@ -139,7 +139,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return strRet; } } - + // Property pointing to an embedded object to get System properties of the WMI object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -148,7 +148,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return PrivateSystemProperties; } } - + // Property returning the underlying lateBound object. [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -157,7 +157,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 return curObj; } } - + // ManagementScope of the object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -176,7 +176,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + // Property to show the commit behavior for the WMI object. If true, WMI object will be automatically saved after each property modification.(ie. Put() is called after modification of a property). [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -188,7 +188,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 AutoCommitProp = value; } } - + // The ManagementPath of the underlying WMI object. [Browsable(true)] public System.Management.ManagementPath Path { @@ -209,7 +209,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 } } } - + // Public static scope property which is used by the various methods. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -221,7 +221,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 statMgmtScope = value; } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"Used by OEMs to allow BIOS-locked Windows operating systems to run in the virtual machine. This string must be exactly 32 characters in length. @@ -231,7 +231,7 @@ This is a read-only property, but it can be changed using the ModifyServiceSetti return ((string)(curObj["BiosLockString"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Caption { @@ -239,7 +239,7 @@ This is a read-only property, but it can be changed using the ModifyServiceSetti return ((string)(curObj["Caption"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The WorldWideNodeName address for dynamically generated WorldWideName addresses u" + @@ -251,7 +251,7 @@ This is a read-only property, but it can be changed using the ModifyServiceSetti return ((string)(curObj["CurrentWWNNAddress"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The default external data root. By default, \"root\\ProgramData\\Microsoft\\Windows\\V" + @@ -262,7 +262,7 @@ This is a read-only property, but it can be changed using the ModifyServiceSetti return ((string)(curObj["DefaultExternalDataRoot"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The default virtual hard disk path. By default, \"root\\Users\\Public\\Documents\\Virt" + @@ -273,7 +273,7 @@ This is a read-only property, but it can be changed using the ModifyServiceSetti return ((string)(curObj["DefaultVirtualHardDiskPath"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Description { @@ -281,7 +281,7 @@ This is a read-only property, but it can be changed using the ModifyServiceSetti return ((string)(curObj["Description"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ElementName { @@ -289,7 +289,7 @@ This is a read-only property, but it can be changed using the ModifyServiceSetti return ((string)(curObj["ElementName"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsHbaLunTimeoutNull { @@ -302,7 +302,7 @@ This is a read-only property, but it can be changed using the ModifyServiceSetti } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"This property describes the amount of time that the Synthetic FC virtual device will wait for a LUN to appear before starting a virtual machine. @@ -316,7 +316,7 @@ This is a read-only property, but it can be changed using the ModifyServiceSetti return ((uint)(curObj["HbaLunTimeout"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string InstanceID { @@ -324,7 +324,7 @@ This is a read-only property, but it can be changed using the ModifyServiceSetti return ((string)(curObj["InstanceID"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The maximum MAC address for dynamically generated MAC addresses.\nThis is a read-o" + @@ -335,7 +335,7 @@ This is a read-only property, but it can be changed using the ModifyServiceSetti return ((string)(curObj["MaximumMacAddress"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The maximum WorldWidePortName address for dynamically generated WorldWideName add" + @@ -347,7 +347,7 @@ This is a read-only property, but it can be changed using the ModifyServiceSetti return ((string)(curObj["MaximumWWPNAddress"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The minimum MAC address for dynamically generated MAC addresses.\nThis is a read-o" + @@ -358,7 +358,7 @@ This is a read-only property, but it can be changed using the ModifyServiceSetti return ((string)(curObj["MinimumMacAddress"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The minimum WorldWidePortName address for dynamically generated WorldWideName add" + @@ -370,7 +370,7 @@ This is a read-only property, but it can be changed using the ModifyServiceSetti return ((string)(curObj["MinimumWWPNAddress"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsNumaSpanningEnabledNull { @@ -383,7 +383,7 @@ This is a read-only property, but it can be changed using the ModifyServiceSetti } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("Reserved for future use.")] @@ -396,7 +396,7 @@ This is a read-only property, but it can be changed using the ModifyServiceSetti return ((bool)(curObj["NumaSpanningEnabled"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("Controls memory allocation for the VMs on non-uniform memory access (NUMA) system" + @@ -407,7 +407,7 @@ This is a read-only property, but it can be changed using the ModifyServiceSetti return ((string)(curObj["PrimaryOwnerContact"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"Describes how the primary system owner can be reached (for example, phone number or e-mail address). By default, empty. This name may not exceed 256 characters in length. @@ -417,9 +417,9 @@ This is a read-only property, but it can be changed using the ModifyServiceSetti return ((string)(curObj["PrimaryOwnerName"])); } } - + private bool CheckIfProperClass(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions OptionsParam) { - if (((path != null) + if (((path != null) && (string.Compare(path.ClassName, this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -427,9 +427,9 @@ This is a read-only property, but it can be changed using the ModifyServiceSetti return CheckIfProperClass(new System.Management.ManagementObject(mgmtScope, path, OptionsParam)); } } - + private bool CheckIfProperClass(System.Management.ManagementBaseObject theObj) { - if (((theObj != null) + if (((theObj != null) && (string.Compare(((string)(theObj["__CLASS"])), this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -446,46 +446,46 @@ This is a read-only property, but it can be changed using the ModifyServiceSetti } return false; } - + private bool ShouldSerializeHbaLunTimeout() { if ((this.IsHbaLunTimeoutNull == false)) { return true; } return false; } - + private bool ShouldSerializeNumaSpanningEnabled() { if ((this.IsNumaSpanningEnabledNull == false)) { return true; } return false; } - + [Browsable(true)] public void CommitObject() { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(); } } - + [Browsable(true)] public void CommitObject(System.Management.PutOptions putOptions) { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(putOptions); } } - + private void Initialize() { AutoCommitProp = true; isEmbedded = false; } - + private static string ConstructPath(string keyInstanceID) { string strPath = "ROOT\\virtualization\\v2:Msvm_VirtualSystemManagementServiceSettingData"; strPath = string.Concat(strPath, string.Concat(".InstanceID=", string.Concat("\"", string.Concat(keyInstanceID, "\"")))); return strPath; } - + private void InitializeObject(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { Initialize(); if ((path != null)) { @@ -497,24 +497,24 @@ This is a read-only property, but it can be changed using the ModifyServiceSetti PrivateSystemProperties = new ManagementSystemProperties(PrivateLateBoundObject); curObj = PrivateLateBoundObject; } - + // Different overloads of GetInstances() help in enumerating instances of the WMI class. public static VirtualSystemManagementServiceSettingDataCollection GetInstances() { return GetInstances(null, null, null); } - + public static VirtualSystemManagementServiceSettingDataCollection GetInstances(string condition) { return GetInstances(null, condition, null); } - + public static VirtualSystemManagementServiceSettingDataCollection GetInstances(string[] selectedProperties) { return GetInstances(null, null, selectedProperties); } - + public static VirtualSystemManagementServiceSettingDataCollection GetInstances(string condition, string[] selectedProperties) { return GetInstances(null, condition, selectedProperties); } - + public static VirtualSystemManagementServiceSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, System.Management.EnumerationOptions enumOptions) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -535,15 +535,15 @@ This is a read-only property, but it can be changed using the ModifyServiceSetti } return new VirtualSystemManagementServiceSettingDataCollection(clsObject.GetInstances(enumOptions)); } - + public static VirtualSystemManagementServiceSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition) { return GetInstances(mgmtScope, condition, null); } - + public static VirtualSystemManagementServiceSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string[] selectedProperties) { return GetInstances(mgmtScope, null, selectedProperties); } - + public static VirtualSystemManagementServiceSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition, string[] selectedProperties) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -560,7 +560,7 @@ This is a read-only property, but it can be changed using the ModifyServiceSetti ObjectSearcher.Options = enumOptions; return new VirtualSystemManagementServiceSettingDataCollection(ObjectSearcher.Get()); } - + [Browsable(true)] public static VirtualSystemManagementServiceSettingData CreateInstance() { System.Management.ManagementScope mgmtScope = null; @@ -575,39 +575,39 @@ This is a read-only property, but it can be changed using the ModifyServiceSetti System.Management.ManagementClass tmpMgmtClass = new System.Management.ManagementClass(mgmtScope, mgmtPath, null); return new VirtualSystemManagementServiceSettingData(tmpMgmtClass.CreateInstance()); } - + [Browsable(true)] public void Delete() { PrivateLateBoundObject.Delete(); } - + // Enumerator implementation for enumerating instances of the class. public class VirtualSystemManagementServiceSettingDataCollection : object, ICollection { - + private ManagementObjectCollection privColObj; - + public VirtualSystemManagementServiceSettingDataCollection(ManagementObjectCollection objCollection) { privColObj = objCollection; } - + public virtual int Count { get { return privColObj.Count; } } - + public virtual bool IsSynchronized { get { return privColObj.IsSynchronized; } } - + public virtual object SyncRoot { get { return this; } } - + public virtual void CopyTo(System.Array array, int index) { privColObj.CopyTo(array, index); int nCtr; @@ -615,189 +615,189 @@ This is a read-only property, but it can be changed using the ModifyServiceSetti array.SetValue(new VirtualSystemManagementServiceSettingData(((System.Management.ManagementObject)(array.GetValue(nCtr)))), nCtr); } } - + public virtual System.Collections.IEnumerator GetEnumerator() { return new VirtualSystemManagementServiceSettingDataEnumerator(privColObj.GetEnumerator()); } - + public class VirtualSystemManagementServiceSettingDataEnumerator : object, System.Collections.IEnumerator { - + private ManagementObjectCollection.ManagementObjectEnumerator privObjEnum; - + public VirtualSystemManagementServiceSettingDataEnumerator(ManagementObjectCollection.ManagementObjectEnumerator objEnum) { privObjEnum = objEnum; } - + public virtual object Current { get { return new VirtualSystemManagementServiceSettingData(((System.Management.ManagementObject)(privObjEnum.Current))); } } - + public virtual bool MoveNext() { return privObjEnum.MoveNext(); } - + public virtual void Reset() { privObjEnum.Reset(); } } } - + // TypeConverter to handle null values for ValueType properties public class WMIValueTypeConverter : TypeConverter { - + private TypeConverter baseConverter; - + private System.Type baseType; - + public WMIValueTypeConverter(System.Type inBaseType) { baseConverter = TypeDescriptor.GetConverter(inBaseType); baseType = inBaseType; } - + 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 ((baseType.BaseType == typeof(System.Enum))) { if ((value.GetType() == destinationType)) { return value; } - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return "NULL_ENUM_VALUE" ; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((baseType == typeof(bool)) + if (((baseType == typeof(bool)) && (baseType.BaseType == typeof(System.ValueType)))) { - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((context != null) + if (((context != null) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } } - + // Embedded class to represent WMI system Properties. [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 { diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_VirtualSystemMigrationService.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_VirtualSystemMigrationService.cs index 89592b1b900..4a00d23513c 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_VirtualSystemMigrationService.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_VirtualSystemMigrationService.cs @@ -23,8 +23,8 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { using System.Globalization; using System.ComponentModel.Design.Serialization; using System.Reflection; - - + + // Functions ShouldSerialize are functions used by VS property browser to check if a particular property has to be serialized. These functions are added for all ValueType properties ( properties of type Int32, BOOL etc.. which cannot be set to null). These functions use IsNull function. These functions are also used in the TypeConverter implementation for the properties to check for NULL value of property so that an empty value can be shown in Property browser in case of Drag and Drop in Visual studio. // Functions IsNull() are used to check if a property is NULL. // Functions Reset are added for Nullable Read/Write properties. These functions are used by VS designer in property browser to set a property to NULL. @@ -32,62 +32,62 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { // Datetime conversion functions ToDateTime and ToDmtfDateTime are added to the class to convert DMTF datetime to System.DateTime and vice-versa. // An Early Bound class generated for the WMI class.Msvm_VirtualSystemMigrationService public class VirtualSystemMigrationService : System.ComponentModel.Component { - + // Private property to hold the WMI namespace in which the class resides. private static string CreatedWmiNamespace = "ROOT\\virtualization\\v2"; - + // Private property to hold the name of WMI class which created this class. public static string CreatedClassName = "Msvm_VirtualSystemMigrationService"; - + // Private member variable to hold the ManagementScope which is used by the various methods. private static System.Management.ManagementScope statMgmtScope = null; - + private ManagementSystemProperties PrivateSystemProperties; - + // Underlying lateBound WMI object. private System.Management.ManagementObject PrivateLateBoundObject; - + // Member variable to store the 'automatic commit' behavior for the class. private bool AutoCommitProp; - + // Private variable to hold the embedded property representing the instance. private System.Management.ManagementBaseObject embeddedObj; - + // The current WMI object used private System.Management.ManagementBaseObject curObj; - + // Flag to indicate if the instance is an embedded object. private bool isEmbedded; - + // Below are different overloads of constructors to initialize an instance of the class with a WMI object. public VirtualSystemMigrationService() { this.InitializeObject(null, null, null); } - + public VirtualSystemMigrationService(string keyCreationClassName, string keyName, string keySystemCreationClassName, string keySystemName) { this.InitializeObject(null, new System.Management.ManagementPath(VirtualSystemMigrationService.ConstructPath(keyCreationClassName, keyName, keySystemCreationClassName, keySystemName)), null); } - + public VirtualSystemMigrationService(System.Management.ManagementScope mgmtScope, string keyCreationClassName, string keyName, string keySystemCreationClassName, string keySystemName) { this.InitializeObject(((System.Management.ManagementScope)(mgmtScope)), new System.Management.ManagementPath(VirtualSystemMigrationService.ConstructPath(keyCreationClassName, keyName, keySystemCreationClassName, keySystemName)), null); } - + public VirtualSystemMigrationService(System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(null, path, getOptions); } - + public VirtualSystemMigrationService(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path) { this.InitializeObject(mgmtScope, path, null); } - + public VirtualSystemMigrationService(System.Management.ManagementPath path) { this.InitializeObject(null, path, null); } - + public VirtualSystemMigrationService(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(mgmtScope, path, getOptions); } - + public VirtualSystemMigrationService(System.Management.ManagementObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -99,7 +99,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { throw new System.ArgumentException("Class name does not match."); } } - + public VirtualSystemMigrationService(System.Management.ManagementBaseObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -112,7 +112,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { throw new System.ArgumentException("Class name does not match."); } } - + // Property returns the namespace of the WMI class. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -121,7 +121,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return "ROOT\\virtualization\\v2"; } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ManagementClassName { @@ -130,7 +130,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { if ((curObj != null)) { if ((curObj.ClassPath != null)) { strRet = ((string)(curObj["__CLASS"])); - if (((strRet == null) + if (((strRet == null) || (strRet == string.Empty))) { strRet = CreatedClassName; } @@ -139,7 +139,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return strRet; } } - + // Property pointing to an embedded object to get System properties of the WMI object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -148,7 +148,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return PrivateSystemProperties; } } - + // Property returning the underlying lateBound object. [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -157,7 +157,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return curObj; } } - + // ManagementScope of the object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -176,7 +176,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + // Property to show the commit behavior for the WMI object. If true, WMI object will be automatically saved after each property modification.(ie. Put() is called after modification of a property). [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -188,7 +188,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { AutoCommitProp = value; } } - + // The ManagementPath of the underlying WMI object. [Browsable(true)] public System.Management.ManagementPath Path { @@ -209,7 +209,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + // Public static scope property which is used by the various methods. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -221,7 +221,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { statMgmtScope = value; } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsActiveStorageMigrationCountNull { @@ -234,7 +234,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The number of currently in-flight storage migrations.")] @@ -247,7 +247,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((uint)(curObj["ActiveStorageMigrationCount"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsActiveVirtualSystemMigrationCountNull { @@ -260,7 +260,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The number of currently in-flight virtual system migrations.")] @@ -273,7 +273,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((uint)(curObj["ActiveVirtualSystemMigrationCount"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public ushort[] AvailableRequestedStates { @@ -281,7 +281,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort[])(curObj["AvailableRequestedStates"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Caption { @@ -289,7 +289,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Caption"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsCommunicationStatusNull { @@ -302,7 +302,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -314,7 +314,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["CommunicationStatus"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string CreationClassName { @@ -322,7 +322,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["CreationClassName"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Description { @@ -330,7 +330,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Description"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsDetailedStatusNull { @@ -343,7 +343,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -355,7 +355,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["DetailedStatus"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ElementName { @@ -363,7 +363,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["ElementName"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsEnabledDefaultNull { @@ -376,7 +376,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -388,7 +388,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["EnabledDefault"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsEnabledStateNull { @@ -401,7 +401,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -413,7 +413,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["EnabledState"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsHealthStateNull { @@ -426,7 +426,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -438,7 +438,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["HealthState"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsInstallDateNull { @@ -451,7 +451,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -465,7 +465,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string InstanceID { @@ -473,7 +473,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["InstanceID"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The list of IP addresses of the host, which can be used for virtual system migra" + @@ -483,7 +483,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string[])(curObj["MigrationServiceListenerIPAddressList"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Name { @@ -491,7 +491,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Name"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsOperatingStatusNull { @@ -504,7 +504,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -516,7 +516,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["OperatingStatus"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public ushort[] OperationalStatus { @@ -524,7 +524,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort[])(curObj["OperationalStatus"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string OtherEnabledState { @@ -532,7 +532,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["OtherEnabledState"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string PrimaryOwnerContact { @@ -540,7 +540,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["PrimaryOwnerContact"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string PrimaryOwnerName { @@ -548,7 +548,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["PrimaryOwnerName"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPrimaryStatusNull { @@ -561,7 +561,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -573,7 +573,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["PrimaryStatus"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsRequestedStateNull { @@ -586,7 +586,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -598,7 +598,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["RequestedState"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsStartedNull { @@ -611,7 +611,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -623,7 +623,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((bool)(curObj["Started"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string StartMode { @@ -631,7 +631,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["StartMode"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Status { @@ -639,7 +639,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Status"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string[] StatusDescriptions { @@ -647,7 +647,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string[])(curObj["StatusDescriptions"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string SystemCreationClassName { @@ -655,7 +655,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["SystemCreationClassName"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string SystemName { @@ -663,7 +663,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["SystemName"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsTimeOfLastStateChangeNull { @@ -676,7 +676,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -690,7 +690,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsTransitioningToStateNull { @@ -703,7 +703,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -715,9 +715,9 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["TransitioningToState"])); } } - + private bool CheckIfProperClass(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions OptionsParam) { - if (((path != null) + if (((path != null) && (string.Compare(path.ClassName, this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -725,9 +725,9 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return CheckIfProperClass(new System.Management.ManagementObject(mgmtScope, path, OptionsParam)); } } - + private bool CheckIfProperClass(System.Management.ManagementBaseObject theObj) { - if (((theObj != null) + if (((theObj != null) && (string.Compare(((string)(theObj["__CLASS"])), this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -744,56 +744,56 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } return false; } - + private bool ShouldSerializeActiveStorageMigrationCount() { if ((this.IsActiveStorageMigrationCountNull == false)) { return true; } return false; } - + private bool ShouldSerializeActiveVirtualSystemMigrationCount() { if ((this.IsActiveVirtualSystemMigrationCountNull == false)) { return true; } return false; } - + private bool ShouldSerializeCommunicationStatus() { if ((this.IsCommunicationStatusNull == false)) { return true; } return false; } - + private bool ShouldSerializeDetailedStatus() { if ((this.IsDetailedStatusNull == false)) { return true; } return false; } - + private bool ShouldSerializeEnabledDefault() { if ((this.IsEnabledDefaultNull == false)) { return true; } return false; } - + private bool ShouldSerializeEnabledState() { if ((this.IsEnabledStateNull == false)) { return true; } return false; } - + private bool ShouldSerializeHealthState() { if ((this.IsHealthStateNull == false)) { return true; } return false; } - + // Converts a given datetime in DMTF format to System.DateTime object. static System.DateTime ToDateTime(string dmtfDate) { System.DateTime initializer = System.DateTime.MinValue; @@ -845,13 +845,13 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { if (("******" != tempString)) { ticks = (long.Parse(tempString) * ((long)((System.TimeSpan.TicksPerMillisecond / 1000)))); } - if (((((((((year < 0) - || (month < 0)) - || (day < 0)) - || (hour < 0)) - || (minute < 0)) - || (minute < 0)) - || (second < 0)) + if (((((((((year < 0) + || (month < 0)) + || (day < 0)) + || (hour < 0)) + || (minute < 0)) + || (minute < 0)) + || (second < 0)) || (ticks < 0))) { throw new System.ArgumentOutOfRangeException(); } @@ -879,7 +879,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } return datetime; } - + // Converts a given System.DateTime object to DMTF datetime format. static string ToDmtfDateTime(System.DateTime date) { string utcString = string.Empty; @@ -906,8 +906,8 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { dmtfDateTime = string.Concat(dmtfDateTime, ((int)(date.Second)).ToString().PadLeft(2, '0')); dmtfDateTime = string.Concat(dmtfDateTime, "."); System.DateTime dtTemp = new System.DateTime(date.Year, date.Month, date.Day, date.Hour, date.Minute, date.Second, 0); - long microsec = ((long)((((date.Ticks - dtTemp.Ticks) - * 1000) + long microsec = ((long)((((date.Ticks - dtTemp.Ticks) + * 1000) / System.TimeSpan.TicksPerMillisecond))); string strMicrosec = ((long)(microsec)).ToString(); if ((strMicrosec.Length > 6)) { @@ -917,75 +917,75 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { dmtfDateTime = string.Concat(dmtfDateTime, utcString); return dmtfDateTime; } - + private bool ShouldSerializeInstallDate() { if ((this.IsInstallDateNull == false)) { return true; } return false; } - + private bool ShouldSerializeOperatingStatus() { if ((this.IsOperatingStatusNull == false)) { return true; } return false; } - + private bool ShouldSerializePrimaryStatus() { if ((this.IsPrimaryStatusNull == false)) { return true; } return false; } - + private bool ShouldSerializeRequestedState() { if ((this.IsRequestedStateNull == false)) { return true; } return false; } - + private bool ShouldSerializeStarted() { if ((this.IsStartedNull == false)) { return true; } return false; } - + private bool ShouldSerializeTimeOfLastStateChange() { if ((this.IsTimeOfLastStateChangeNull == false)) { return true; } return false; } - + private bool ShouldSerializeTransitioningToState() { if ((this.IsTransitioningToStateNull == false)) { return true; } return false; } - + [Browsable(true)] public void CommitObject() { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(); } } - + [Browsable(true)] public void CommitObject(System.Management.PutOptions putOptions) { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(putOptions); } } - + private void Initialize() { AutoCommitProp = true; isEmbedded = false; } - + private static string ConstructPath(string keyCreationClassName, string keyName, string keySystemCreationClassName, string keySystemName) { string strPath = "ROOT\\virtualization\\v2:Msvm_VirtualSystemMigrationService"; strPath = string.Concat(strPath, string.Concat(".CreationClassName=", string.Concat("\"", string.Concat(keyCreationClassName, "\"")))); @@ -994,7 +994,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { strPath = string.Concat(strPath, string.Concat(",SystemName=", string.Concat("\"", string.Concat(keySystemName, "\"")))); return strPath; } - + private void InitializeObject(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { Initialize(); if ((path != null)) { @@ -1006,24 +1006,24 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { PrivateSystemProperties = new ManagementSystemProperties(PrivateLateBoundObject); curObj = PrivateLateBoundObject; } - + // Different overloads of GetInstances() help in enumerating instances of the WMI class. public static VirtualSystemMigrationServiceCollection GetInstances() { return GetInstances(null, null, null); } - + public static VirtualSystemMigrationServiceCollection GetInstances(string condition) { return GetInstances(null, condition, null); } - + public static VirtualSystemMigrationServiceCollection GetInstances(string[] selectedProperties) { return GetInstances(null, null, selectedProperties); } - + public static VirtualSystemMigrationServiceCollection GetInstances(string condition, string[] selectedProperties) { return GetInstances(null, condition, selectedProperties); } - + public static VirtualSystemMigrationServiceCollection GetInstances(System.Management.ManagementScope mgmtScope, System.Management.EnumerationOptions enumOptions) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -1044,15 +1044,15 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } return new VirtualSystemMigrationServiceCollection(clsObject.GetInstances(enumOptions)); } - + public static VirtualSystemMigrationServiceCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition) { return GetInstances(mgmtScope, condition, null); } - + public static VirtualSystemMigrationServiceCollection GetInstances(System.Management.ManagementScope mgmtScope, string[] selectedProperties) { return GetInstances(mgmtScope, null, selectedProperties); } - + public static VirtualSystemMigrationServiceCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition, string[] selectedProperties) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -1069,7 +1069,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { ObjectSearcher.Options = enumOptions; return new VirtualSystemMigrationServiceCollection(ObjectSearcher.Get()); } - + [Browsable(true)] public static VirtualSystemMigrationService CreateInstance() { System.Management.ManagementScope mgmtScope = null; @@ -1084,12 +1084,12 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { System.Management.ManagementClass tmpMgmtClass = new System.Management.ManagementClass(mgmtScope, mgmtPath, null); return new VirtualSystemMigrationService(tmpMgmtClass.CreateInstance()); } - + [Browsable(true)] public void Delete() { PrivateLateBoundObject.Delete(); } - + public uint AddNetworkSettings(string[] NetworkSettings, out System.Management.ManagementPath Job) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1107,7 +1107,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint CheckSystemCompatibilityInfo(byte[] CompatibilityInfo, out string[] Reasons) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1122,7 +1122,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint CheckVirtualSystemIsMigratable(System.Management.ManagementPath ComputerSystem, string DestinationHost, string MigrationSettingData, string[] NewResourceSettingData, string NewSystemSettingData, out System.Management.ManagementPath Job) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1144,7 +1144,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint CheckVirtualSystemIsMigratableToHost(System.Management.ManagementPath ComputerSystem, string DestinationHost, string MigrationSettingData, string[] NewResourceSettingData, string NewSystemSettingData, out bool IsMigratable) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1163,7 +1163,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint CheckVirtualSystemIsMigratableToSystem(System.Management.ManagementPath ComputerSystem, System.Management.ManagementPath DestinationSystem, string MigrationSettingData, string[] NewResourceSettingData, string NewSystemSettingData, out bool IsMigratable) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1182,7 +1182,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint GetSystemCompatibilityInfo(System.Management.ManagementPath ComputerSystem, out byte[] CompatibilityInfo) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1197,7 +1197,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint MigrateVirtualSystemToHost(System.Management.ManagementPath ComputerSystem, string DestinationHost, string MigrationSettingData, string[] NewResourceSettingData, string NewSystemSettingData, out System.Management.ManagementPath Job) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1220,7 +1220,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint MigrateVirtualSystemToSystem(System.Management.ManagementPath ComputerSystem, System.Management.ManagementPath DestinationSystem, string MigrationSettingData, string[] NewResourceSettingData, string NewSystemSettingData, out System.Management.ManagementPath Job, out System.Management.ManagementPath NewComputerSystem) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1247,7 +1247,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint ModifyNetworkSettings(string[] NetworkSettings, out System.Management.ManagementPath Job) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1265,7 +1265,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint ModifyServiceSettings(string ServiceSettingData, out System.Management.ManagementPath Job) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1283,7 +1283,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint RemoveNetworkSettings(System.Management.ManagementPath[] NetworkSettings, out System.Management.ManagementPath Job) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1311,7 +1311,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint RequestStateChange(ushort RequestedState, System.DateTime TimeoutPeriod, out System.Management.ManagementPath Job) { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1330,7 +1330,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint StartService() { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1341,7 +1341,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + public uint StopService() { if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; @@ -1352,34 +1352,34 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return System.Convert.ToUInt32(0); } } - + // Enumerator implementation for enumerating instances of the class. public class VirtualSystemMigrationServiceCollection : object, ICollection { - + private ManagementObjectCollection privColObj; - + public VirtualSystemMigrationServiceCollection(ManagementObjectCollection objCollection) { privColObj = objCollection; } - + public virtual int Count { get { return privColObj.Count; } } - + public virtual bool IsSynchronized { get { return privColObj.IsSynchronized; } } - + public virtual object SyncRoot { get { return this; } } - + public virtual void CopyTo(System.Array array, int index) { privColObj.CopyTo(array, index); int nCtr; @@ -1387,189 +1387,189 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { array.SetValue(new VirtualSystemMigrationService(((System.Management.ManagementObject)(array.GetValue(nCtr)))), nCtr); } } - + public virtual System.Collections.IEnumerator GetEnumerator() { return new VirtualSystemMigrationServiceEnumerator(privColObj.GetEnumerator()); } - + public class VirtualSystemMigrationServiceEnumerator : object, System.Collections.IEnumerator { - + private ManagementObjectCollection.ManagementObjectEnumerator privObjEnum; - + public VirtualSystemMigrationServiceEnumerator(ManagementObjectCollection.ManagementObjectEnumerator objEnum) { privObjEnum = objEnum; } - + public virtual object Current { get { return new VirtualSystemMigrationService(((System.Management.ManagementObject)(privObjEnum.Current))); } } - + public virtual bool MoveNext() { return privObjEnum.MoveNext(); } - + public virtual void Reset() { privObjEnum.Reset(); } } } - + // TypeConverter to handle null values for ValueType properties public class WMIValueTypeConverter : TypeConverter { - + private TypeConverter baseConverter; - + private System.Type baseType; - + public WMIValueTypeConverter(System.Type inBaseType) { baseConverter = TypeDescriptor.GetConverter(inBaseType); baseType = inBaseType; } - + 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 ((baseType.BaseType == typeof(System.Enum))) { if ((value.GetType() == destinationType)) { return value; } - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return "NULL_ENUM_VALUE" ; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((baseType == typeof(bool)) + if (((baseType == typeof(bool)) && (baseType.BaseType == typeof(System.ValueType)))) { - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((context != null) + if (((context != null) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } } - + // Embedded class to represent WMI system Properties. [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 { diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_VirtualSystemMigrationSettingData.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_VirtualSystemMigrationSettingData.cs index f7642dffa28..55e3cab6c2a 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_VirtualSystemMigrationSettingData.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_VirtualSystemMigrationSettingData.cs @@ -23,70 +23,70 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { using System.Globalization; using System.ComponentModel.Design.Serialization; using System.Reflection; - - + + // Functions ShouldSerialize are functions used by VS property browser to check if a particular property has to be serialized. These functions are added for all ValueType properties ( properties of type Int32, BOOL etc.. which cannot be set to null). These functions use IsNull function. These functions are also used in the TypeConverter implementation for the properties to check for NULL value of property so that an empty value can be shown in Property browser in case of Drag and Drop in Visual studio. // Functions IsNull() are used to check if a property is NULL. // Functions Reset are added for Nullable Read/Write properties. These functions are used by VS designer in property browser to set a property to NULL. // Every property added to the class for WMI property has attributes set to define its behavior in Visual Studio designer and also to define a TypeConverter to be used. // An Early Bound class generated for the WMI class.Msvm_VirtualSystemMigrationSettingData public class VirtualSystemMigrationSettingData : System.ComponentModel.Component { - + // Private property to hold the WMI namespace in which the class resides. private static string CreatedWmiNamespace = "ROOT\\virtualization\\v2"; - + // Private property to hold the name of WMI class which created this class. public static string CreatedClassName = "Msvm_VirtualSystemMigrationSettingData"; - + // Private member variable to hold the ManagementScope which is used by the various methods. private static System.Management.ManagementScope statMgmtScope = null; - + private ManagementSystemProperties PrivateSystemProperties; - + // Underlying lateBound WMI object. private System.Management.ManagementObject PrivateLateBoundObject; - + // Member variable to store the 'automatic commit' behavior for the class. private bool AutoCommitProp; - + // Private variable to hold the embedded property representing the instance. private System.Management.ManagementBaseObject embeddedObj; - + // The current WMI object used private System.Management.ManagementBaseObject curObj; - + // Flag to indicate if the instance is an embedded object. private bool isEmbedded; - + // Below are different overloads of constructors to initialize an instance of the class with a WMI object. public VirtualSystemMigrationSettingData() { this.InitializeObject(null, null, null); } - + public VirtualSystemMigrationSettingData(string keyInstanceID) { this.InitializeObject(null, new System.Management.ManagementPath(VirtualSystemMigrationSettingData.ConstructPath(keyInstanceID)), null); } - + public VirtualSystemMigrationSettingData(System.Management.ManagementScope mgmtScope, string keyInstanceID) { this.InitializeObject(((System.Management.ManagementScope)(mgmtScope)), new System.Management.ManagementPath(VirtualSystemMigrationSettingData.ConstructPath(keyInstanceID)), null); } - + public VirtualSystemMigrationSettingData(System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(null, path, getOptions); } - + public VirtualSystemMigrationSettingData(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path) { this.InitializeObject(mgmtScope, path, null); } - + public VirtualSystemMigrationSettingData(System.Management.ManagementPath path) { this.InitializeObject(null, path, null); } - + public VirtualSystemMigrationSettingData(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(mgmtScope, path, getOptions); } - + public VirtualSystemMigrationSettingData(System.Management.ManagementObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -98,7 +98,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { throw new System.ArgumentException("Class name does not match."); } } - + public VirtualSystemMigrationSettingData(System.Management.ManagementBaseObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -111,7 +111,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { throw new System.ArgumentException("Class name does not match."); } } - + // Property returns the namespace of the WMI class. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -120,7 +120,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return "ROOT\\virtualization\\v2"; } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ManagementClassName { @@ -129,7 +129,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { if ((curObj != null)) { if ((curObj.ClassPath != null)) { strRet = ((string)(curObj["__CLASS"])); - if (((strRet == null) + if (((strRet == null) || (strRet == string.Empty))) { strRet = CreatedClassName; } @@ -138,7 +138,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return strRet; } } - + // Property pointing to an embedded object to get System properties of the WMI object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -147,7 +147,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return PrivateSystemProperties; } } - + // Property returning the underlying lateBound object. [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -156,7 +156,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return curObj; } } - + // ManagementScope of the object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -175,7 +175,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + // Property to show the commit behavior for the WMI object. If true, WMI object will be automatically saved after each property modification.(ie. Put() is called after modification of a property). [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -187,7 +187,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { AutoCommitProp = value; } } - + // The ManagementPath of the underlying WMI object. [Browsable(true)] public System.Management.ManagementPath Path { @@ -208,7 +208,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + // Public static scope property which is used by the various methods. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -220,7 +220,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { statMgmtScope = value; } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsBandwidthNull { @@ -233,7 +233,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -245,7 +245,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((ushort)(curObj["Bandwidth"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string BandwidthUnit { @@ -253,7 +253,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["BandwidthUnit"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Caption { @@ -261,7 +261,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Caption"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Description { @@ -269,7 +269,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return ((string)(curObj["Description"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("For storage migration it will be NULL. For virtual system \nmigration, client can " + @@ -280,19 +280,19 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } set { curObj["DestinationIPAddressList"] = value; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - [Description(@"If we have a planned computer system at migration destination then DestinationPlannedVirtualSystemId could be set to -the GUID of the destination Planned VM where the VM needs to -migrate. This is useful for cases where user has created a -planned VM at the destination along with resource fixup, and + [Description(@"If we have a planned computer system at migration destination then DestinationPlannedVirtualSystemId could be set to +the GUID of the destination Planned VM where the VM needs to +migrate. This is useful for cases where user has created a +planned VM at the destination along with resource fixup, and wants a VM from source to migrate into this planned VM.")] public string DestinationPlannedVirtualSystemId { get { @@ -300,13 +300,13 @@ wants a VM from source to migrate into this planned VM.")] } set { curObj["DestinationPlannedVirtualSystemId"] = value; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ElementName { @@ -314,7 +314,7 @@ wants a VM from source to migrate into this planned VM.")] return ((string)(curObj["ElementName"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string InstanceID { @@ -322,7 +322,7 @@ wants a VM from source to migrate into this planned VM.")] return ((string)(curObj["InstanceID"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsMigrationTypeNull { @@ -335,7 +335,7 @@ wants a VM from source to migrate into this planned VM.")] } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("MigrationType describes the type of migration operation to \nbe performed.\n")] @@ -354,13 +354,13 @@ wants a VM from source to migrate into this planned VM.")] else { curObj["MigrationType"] = value; } - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string OtherTransportType { @@ -368,7 +368,7 @@ wants a VM from source to migrate into this planned VM.")] return ((string)(curObj["OtherTransportType"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPriorityNull { @@ -381,7 +381,7 @@ wants a VM from source to migrate into this planned VM.")] } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -393,7 +393,7 @@ wants a VM from source to migrate into this planned VM.")] return ((ushort)(curObj["Priority"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsRetainVhdCopiesOnSourceNull { @@ -406,7 +406,7 @@ wants a VM from source to migrate into this planned VM.")] } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("For storage migration, this could be set to TRUE or FALSE\nto determine wheither, " + @@ -422,13 +422,13 @@ wants a VM from source to migrate into this planned VM.")] } set { curObj["RetainVhdCopiesOnSource"] = value; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsTransportTypeNull { @@ -441,7 +441,7 @@ wants a VM from source to migrate into this planned VM.")] } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -453,9 +453,9 @@ wants a VM from source to migrate into this planned VM.")] return ((ushort)(curObj["TransportType"])); } } - + private bool CheckIfProperClass(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions OptionsParam) { - if (((path != null) + if (((path != null) && (string.Compare(path.ClassName, this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -463,9 +463,9 @@ wants a VM from source to migrate into this planned VM.")] return CheckIfProperClass(new System.Management.ManagementObject(mgmtScope, path, OptionsParam)); } } - + private bool CheckIfProperClass(System.Management.ManagementBaseObject theObj) { - if (((theObj != null) + if (((theObj != null) && (string.Compare(((string)(theObj["__CLASS"])), this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -482,99 +482,99 @@ wants a VM from source to migrate into this planned VM.")] } return false; } - + private bool ShouldSerializeBandwidth() { if ((this.IsBandwidthNull == false)) { return true; } return false; } - + private void ResetDestinationIPAddressList() { curObj["DestinationIPAddressList"] = null; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } - + private void ResetDestinationPlannedVirtualSystemId() { curObj["DestinationPlannedVirtualSystemId"] = null; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } - + private bool ShouldSerializeMigrationType() { if ((this.IsMigrationTypeNull == false)) { return true; } return false; } - + private void ResetMigrationType() { curObj["MigrationType"] = null; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } - + private bool ShouldSerializePriority() { if ((this.IsPriorityNull == false)) { return true; } return false; } - + private bool ShouldSerializeRetainVhdCopiesOnSource() { if ((this.IsRetainVhdCopiesOnSourceNull == false)) { return true; } return false; } - + private void ResetRetainVhdCopiesOnSource() { curObj["RetainVhdCopiesOnSource"] = null; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } - + private bool ShouldSerializeTransportType() { if ((this.IsTransportTypeNull == false)) { return true; } return false; } - + [Browsable(true)] public void CommitObject() { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(); } } - + [Browsable(true)] public void CommitObject(System.Management.PutOptions putOptions) { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(putOptions); } } - + private void Initialize() { AutoCommitProp = true; isEmbedded = false; } - + private static string ConstructPath(string keyInstanceID) { string strPath = "ROOT\\virtualization\\v2:Msvm_VirtualSystemMigrationSettingData"; strPath = string.Concat(strPath, string.Concat(".InstanceID=", string.Concat("\"", string.Concat(keyInstanceID, "\"")))); return strPath; } - + private void InitializeObject(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { Initialize(); if ((path != null)) { @@ -586,24 +586,24 @@ wants a VM from source to migrate into this planned VM.")] PrivateSystemProperties = new ManagementSystemProperties(PrivateLateBoundObject); curObj = PrivateLateBoundObject; } - + // Different overloads of GetInstances() help in enumerating instances of the WMI class. public static VirtualSystemMigrationSettingDataCollection GetInstances() { return GetInstances(null, null, null); } - + public static VirtualSystemMigrationSettingDataCollection GetInstances(string condition) { return GetInstances(null, condition, null); } - + public static VirtualSystemMigrationSettingDataCollection GetInstances(string[] selectedProperties) { return GetInstances(null, null, selectedProperties); } - + public static VirtualSystemMigrationSettingDataCollection GetInstances(string condition, string[] selectedProperties) { return GetInstances(null, condition, selectedProperties); } - + public static VirtualSystemMigrationSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, System.Management.EnumerationOptions enumOptions) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -624,15 +624,15 @@ wants a VM from source to migrate into this planned VM.")] } return new VirtualSystemMigrationSettingDataCollection(clsObject.GetInstances(enumOptions)); } - + public static VirtualSystemMigrationSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition) { return GetInstances(mgmtScope, condition, null); } - + public static VirtualSystemMigrationSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string[] selectedProperties) { return GetInstances(mgmtScope, null, selectedProperties); } - + public static VirtualSystemMigrationSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition, string[] selectedProperties) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -649,7 +649,7 @@ wants a VM from source to migrate into this planned VM.")] ObjectSearcher.Options = enumOptions; return new VirtualSystemMigrationSettingDataCollection(ObjectSearcher.Get()); } - + [Browsable(true)] public static VirtualSystemMigrationSettingData CreateInstance() { System.Management.ManagementScope mgmtScope = null; @@ -664,56 +664,56 @@ wants a VM from source to migrate into this planned VM.")] System.Management.ManagementClass tmpMgmtClass = new System.Management.ManagementClass(mgmtScope, mgmtPath, null); return new VirtualSystemMigrationSettingData(tmpMgmtClass.CreateInstance()); } - + [Browsable(true)] public void Delete() { PrivateLateBoundObject.Delete(); } - + public enum MigrationTypeValues { - + Unknown0 = 0, - + VirtualSystem = 32768, - + Storage = 32769, - + Staged = 32770, - + VirtualSystemAndStorage = 32771, - + StorageDeepCheck = 32772, - + NULL_ENUM_VALUE = 32773, } - + // Enumerator implementation for enumerating instances of the class. public class VirtualSystemMigrationSettingDataCollection : object, ICollection { - + private ManagementObjectCollection privColObj; - + public VirtualSystemMigrationSettingDataCollection(ManagementObjectCollection objCollection) { privColObj = objCollection; } - + public virtual int Count { get { return privColObj.Count; } } - + public virtual bool IsSynchronized { get { return privColObj.IsSynchronized; } } - + public virtual object SyncRoot { get { return this; } } - + public virtual void CopyTo(System.Array array, int index) { privColObj.CopyTo(array, index); int nCtr; @@ -721,189 +721,189 @@ wants a VM from source to migrate into this planned VM.")] array.SetValue(new VirtualSystemMigrationSettingData(((System.Management.ManagementObject)(array.GetValue(nCtr)))), nCtr); } } - + public virtual System.Collections.IEnumerator GetEnumerator() { return new VirtualSystemMigrationSettingDataEnumerator(privColObj.GetEnumerator()); } - + public class VirtualSystemMigrationSettingDataEnumerator : object, System.Collections.IEnumerator { - + private ManagementObjectCollection.ManagementObjectEnumerator privObjEnum; - + public VirtualSystemMigrationSettingDataEnumerator(ManagementObjectCollection.ManagementObjectEnumerator objEnum) { privObjEnum = objEnum; } - + public virtual object Current { get { return new VirtualSystemMigrationSettingData(((System.Management.ManagementObject)(privObjEnum.Current))); } } - + public virtual bool MoveNext() { return privObjEnum.MoveNext(); } - + public virtual void Reset() { privObjEnum.Reset(); } } } - + // TypeConverter to handle null values for ValueType properties public class WMIValueTypeConverter : TypeConverter { - + private TypeConverter baseConverter; - + private System.Type baseType; - + public WMIValueTypeConverter(System.Type inBaseType) { baseConverter = TypeDescriptor.GetConverter(inBaseType); baseType = inBaseType; } - + 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 ((baseType.BaseType == typeof(System.Enum))) { if ((value.GetType() == destinationType)) { return value; } - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return "NULL_ENUM_VALUE" ; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((baseType == typeof(bool)) + if (((baseType == typeof(bool)) && (baseType.BaseType == typeof(System.ValueType)))) { - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((context != null) + if (((context != null) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } } - + // Embedded class to represent WMI system Properties. [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 { diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_VirtualSystemSettingData.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_VirtualSystemSettingData.cs index 4877957ad6b..bc1e1fd3618 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_VirtualSystemSettingData.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/ROOT.virtualization.v2.Msvm_VirtualSystemSettingData.cs @@ -23,8 +23,8 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { using System.Globalization; using System.ComponentModel.Design.Serialization; using System.Reflection; - - + + // Functions ShouldSerialize are functions used by VS property browser to check if a particular property has to be serialized. These functions are added for all ValueType properties ( properties of type Int32, BOOL etc.. which cannot be set to null). These functions use IsNull function. These functions are also used in the TypeConverter implementation for the properties to check for NULL value of property so that an empty value can be shown in Property browser in case of Drag and Drop in Visual studio. // Functions IsNull() are used to check if a property is NULL. // Functions Reset are added for Nullable Read/Write properties. These functions are used by VS designer in property browser to set a property to NULL. @@ -32,62 +32,62 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { // Datetime conversion functions ToDateTime and ToDmtfDateTime are added to the class to convert DMTF datetime to System.DateTime and vice-versa. // An Early Bound class generated for the WMI class.Msvm_VirtualSystemSettingData public class VirtualSystemSettingData : System.ComponentModel.Component { - + // Private property to hold the WMI namespace in which the class resides. private static string CreatedWmiNamespace = "ROOT\\virtualization\\v2"; - + // Private property to hold the name of WMI class which created this class. public static string CreatedClassName = "Msvm_VirtualSystemSettingData"; - + // Private member variable to hold the ManagementScope which is used by the various methods. private static System.Management.ManagementScope statMgmtScope = null; - + private ManagementSystemProperties PrivateSystemProperties; - + // Underlying lateBound WMI object. private System.Management.ManagementObject PrivateLateBoundObject; - + // Member variable to store the 'automatic commit' behavior for the class. private bool AutoCommitProp; - + // Private variable to hold the embedded property representing the instance. private System.Management.ManagementBaseObject embeddedObj; - + // The current WMI object used private System.Management.ManagementBaseObject curObj; - + // Flag to indicate if the instance is an embedded object. private bool isEmbedded; - + // Below are different overloads of constructors to initialize an instance of the class with a WMI object. public VirtualSystemSettingData() { this.InitializeObject(null, null, null); } - + public VirtualSystemSettingData(string keyInstanceID) { this.InitializeObject(null, new System.Management.ManagementPath(VirtualSystemSettingData.ConstructPath(keyInstanceID)), null); } - + public VirtualSystemSettingData(System.Management.ManagementScope mgmtScope, string keyInstanceID) { this.InitializeObject(((System.Management.ManagementScope)(mgmtScope)), new System.Management.ManagementPath(VirtualSystemSettingData.ConstructPath(keyInstanceID)), null); } - + public VirtualSystemSettingData(System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(null, path, getOptions); } - + public VirtualSystemSettingData(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path) { this.InitializeObject(mgmtScope, path, null); } - + public VirtualSystemSettingData(System.Management.ManagementPath path) { this.InitializeObject(null, path, null); } - + public VirtualSystemSettingData(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(mgmtScope, path, getOptions); } - + public VirtualSystemSettingData(System.Management.ManagementObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -99,7 +99,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { throw new System.ArgumentException("Class name does not match."); } } - + public VirtualSystemSettingData(System.Management.ManagementBaseObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -112,7 +112,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { throw new System.ArgumentException("Class name does not match."); } } - + // Property returns the namespace of the WMI class. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -121,7 +121,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return "ROOT\\virtualization\\v2"; } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ManagementClassName { @@ -130,7 +130,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { if ((curObj != null)) { if ((curObj.ClassPath != null)) { strRet = ((string)(curObj["__CLASS"])); - if (((strRet == null) + if (((strRet == null) || (strRet == string.Empty))) { strRet = CreatedClassName; } @@ -139,7 +139,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return strRet; } } - + // Property pointing to an embedded object to get System properties of the WMI object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -148,7 +148,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return PrivateSystemProperties; } } - + // Property returning the underlying lateBound object. [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -157,7 +157,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { return curObj; } } - + // ManagementScope of the object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -176,7 +176,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + // Property to show the commit behavior for the WMI object. If true, WMI object will be automatically saved after each property modification.(ie. Put() is called after modification of a property). [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -188,7 +188,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { AutoCommitProp = value; } } - + // The ManagementPath of the underlying WMI object. [Browsable(true)] public System.Management.ManagementPath Path { @@ -209,7 +209,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { } } } - + // Public static scope property which is used by the various methods. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -221,7 +221,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.VIRTUALIZATION.V2 { statMgmtScope = value; } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"Any additional information provided to the recovery action. The meaning of this property is defined by the action in AutomaticRecoveryAction. If AutomaticRecoveryAction is 0 (""None"") or 1 (""Restart""), this value is NULL. If AutomaticRecoveryAction is 2 (""Revert to Snapshot""), this is the object path to a snapshot that should be applied on failure of the virtual machine worker process. @@ -232,13 +232,13 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste } set { curObj["AdditionalRecoveryInformation"] = value; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsAllowFullSCSICommandSetNull { @@ -251,7 +251,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"Indicates whether SCSI commands from the guest operating system are passed to pass-through disks. If TRUE, SCSI commands emitted by the guest operating system to pass-through disks are not filtered.It is recommended that SCSI filtering remains enabled for production deployments. @@ -267,13 +267,13 @@ Windows Server 2008: The AllowFullSCSICommandSet property is not supported.")] } set { curObj["AllowFullSCSICommandSet"] = value; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsAllowReducedFcRedundancyNull { @@ -286,11 +286,11 @@ Windows Server 2008: The AllowFullSCSICommandSet property is not supported.")] } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - [Description(@"Indicates whether live migration of a virtual machine that is configured with a virtual FC adapter is allowed to a destination machine, without doing any checks for the existence of paths to the storage devices on the destination -The default value of this property is FALSE. If set to TRUE, the VM can be live migrated to a target machine which may have no or reduced paths to the target FC devices. The guest operating system may lose connectivity to storage and may behave in an unpredictable manner. + [Description(@"Indicates whether live migration of a virtual machine that is configured with a virtual FC adapter is allowed to a destination machine, without doing any checks for the existence of paths to the storage devices on the destination +The default value of this property is FALSE. If set to TRUE, the VM can be live migrated to a target machine which may have no or reduced paths to the target FC devices. The guest operating system may lose connectivity to storage and may behave in an unpredictable manner. This property should be cleared after a live migration")] [TypeConverter(typeof(WMIValueTypeConverter))] public bool AllowReducedFcRedundancy { @@ -302,13 +302,13 @@ The default value of this property is FALSE. If set to TRUE, the VM can be live } set { curObj["AllowReducedFcRedundancy"] = value; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsAutomaticRecoveryActionNull { @@ -321,7 +321,7 @@ The default value of this property is FALSE. If set to TRUE, the VM can be live } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -333,7 +333,7 @@ The default value of this property is FALSE. If set to TRUE, the VM can be live return ((ushort)(curObj["AutomaticRecoveryAction"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsAutomaticShutdownActionNull { @@ -346,7 +346,7 @@ The default value of this property is FALSE. If set to TRUE, the VM can be live } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -358,7 +358,7 @@ The default value of this property is FALSE. If set to TRUE, the VM can be live return ((ushort)(curObj["AutomaticShutdownAction"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsAutomaticStartupActionNull { @@ -371,7 +371,7 @@ The default value of this property is FALSE. If set to TRUE, the VM can be live } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -383,7 +383,7 @@ The default value of this property is FALSE. If set to TRUE, the VM can be live return ((ushort)(curObj["AutomaticStartupAction"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsAutomaticStartupActionDelayNull { @@ -396,7 +396,7 @@ The default value of this property is FALSE. If set to TRUE, the VM can be live } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -410,7 +410,7 @@ The default value of this property is FALSE. If set to TRUE, the VM can be live } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsAutomaticStartupActionSequenceNumberNull { @@ -423,7 +423,7 @@ The default value of this property is FALSE. If set to TRUE, the VM can be live } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -435,7 +435,7 @@ The default value of this property is FALSE. If set to TRUE, the VM can be live return ((ushort)(curObj["AutomaticStartupActionSequenceNumber"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The serial number of the base board for the virtual computer system.\nThis is a re" + @@ -447,13 +447,13 @@ The default value of this property is FALSE. If set to TRUE, the VM can be live } set { curObj["BaseBoardSerialNumber"] = value; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The globally-unique identifier for the BIOS of the virtual computer system.\nThis " + @@ -465,13 +465,13 @@ The default value of this property is FALSE. If set to TRUE, the VM can be live } set { curObj["BIOSGUID"] = value; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsBIOSNumLockNull { @@ -484,7 +484,7 @@ The default value of this property is FALSE. If set to TRUE, the VM can be live } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"This property is set to TRUE if the num lock key is set to on by the BIOS, FALSE if the num lock key is set to off by the BIOS. @@ -499,13 +499,13 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste } set { curObj["BIOSNumLock"] = value; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The serial number of the BIOS for the virtual computer system.\nThis is a read-onl" + @@ -517,13 +517,13 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste } set { curObj["BIOSSerialNumber"] = value; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"The boot order set within the BIOS of the virtual computer system. This property is an array of values, max length 4, where each value indicates a device to boot from. The virtual computer system will first attempt to boot from the device indicated by the first value within the array. If that device does not contain a boot sector, the virtual computer system will attempt to boot from the next device specified by the BootOrder property and so on. If no device specified within the BootOrder contains a boot sector the virtual computer system will fail to boot. The default value for a virtual computer system is [0, 1, 2, 3, 4]. @@ -541,13 +541,13 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste } set { curObj["BootOrder"] = value; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Caption { @@ -555,7 +555,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste return ((string)(curObj["Caption"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The asset tag of the chassis for the virtual computer system.\nThis is a read-only" + @@ -567,13 +567,13 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste } set { curObj["ChassisAssetTag"] = value; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The serial number of the chassis for the virtual computer system.\nThis is a read-" + @@ -585,13 +585,13 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste } set { curObj["ChassisSerialNumber"] = value; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ConfigurationDataRoot { @@ -599,7 +599,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste return ((string)(curObj["ConfigurationDataRoot"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ConfigurationFile { @@ -607,7 +607,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste return ((string)(curObj["ConfigurationFile"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ConfigurationID { @@ -615,7 +615,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste return ((string)(curObj["ConfigurationID"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsCreationTimeNull { @@ -628,7 +628,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -642,7 +642,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsDebugChannelIdNull { @@ -655,7 +655,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The channel identifier used to debug the virtual system using the VUD unified deb" + @@ -670,13 +670,13 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste } set { curObj["DebugChannelId"] = value; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsDebugPortNull { @@ -689,7 +689,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The tcpip port used to debug the virtual system using synthetic debugging.")] @@ -703,13 +703,13 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste } set { curObj["DebugPort"] = value; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsDebugPortEnabledNull { @@ -722,7 +722,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("Whether the virtual system is using synthetic debugging.")] @@ -741,13 +741,13 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste else { curObj["DebugPortEnabled"] = value; } - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Description { @@ -755,7 +755,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste return ((string)(curObj["Description"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ElementName { @@ -763,7 +763,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste return ((string)(curObj["ElementName"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsIncrementalBackupEnabledNull { @@ -776,7 +776,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("Indicates whether the Hyper-V VSS writer supports taking incremental backup of th" + @@ -791,13 +791,13 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste } set { curObj["IncrementalBackupEnabled"] = value; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string InstanceID { @@ -805,7 +805,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste return ((string)(curObj["InstanceID"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsIsSavedNull { @@ -818,7 +818,7 @@ This is a read-only property, but it can be changed using the ModifyVirtualSyste } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"This property is set to TRUE if the configuration has a reference to a saved state file, FALSE if not. Note that this does not indicate the presence of such a file, only that the configuration specifies one. @@ -832,7 +832,7 @@ This is a read-only property, it cannot be changed.")] return ((bool)(curObj["IsSaved"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string LogDataRoot { @@ -840,7 +840,7 @@ This is a read-only property, it cannot be changed.")] return ((string)(curObj["LogDataRoot"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string[] Notes { @@ -848,7 +848,7 @@ This is a read-only property, it cannot be changed.")] return ((string[])(curObj["Notes"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The object path for the snapshot Msvm_VirtualSystemSettingData from which this ob" + @@ -859,7 +859,7 @@ This is a read-only property, it cannot be changed.")] return ((string)(curObj["Parent"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string RecoveryFile { @@ -867,7 +867,7 @@ This is a read-only property, it cannot be changed.")] return ((string)(curObj["RecoveryFile"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string SnapshotDataRoot { @@ -875,7 +875,7 @@ This is a read-only property, it cannot be changed.")] return ((string)(curObj["SnapshotDataRoot"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string SuspendDataRoot { @@ -883,7 +883,7 @@ This is a read-only property, it cannot be changed.")] return ((string)(curObj["SuspendDataRoot"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string SwapFileDataRoot { @@ -891,7 +891,7 @@ This is a read-only property, it cannot be changed.")] return ((string)(curObj["SwapFileDataRoot"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The version of the virtual system in a format of \"major.minor\", for example \"2.0\"" + @@ -901,7 +901,7 @@ This is a read-only property, it cannot be changed.")] return ((string)(curObj["Version"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsVirtualNumaEnabledNull { @@ -914,7 +914,7 @@ This is a read-only property, it cannot be changed.")] } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"Indicates whether virtual non-uniform memory access (NUMA) nodes are projected into the virtual machine. If FALSE, the virtual machine will have a single node. If TRUE, the number of virtual NUMA nodes projected into the virtual machine is determined from the values of the Msvm_ProcessorSettingData.MaxProcessorsPerNumaNode and Msvm_MemorySettingData.MaxMemoryBlocksPerNumaNode properties. @@ -929,13 +929,13 @@ This is a read-only property, it cannot be changed.")] } set { curObj["VirtualNumaEnabled"] = value; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The name of the CIM_ComputerSystem to which this setting data belongs")] @@ -944,7 +944,7 @@ This is a read-only property, it cannot be changed.")] return ((string)(curObj["VirtualSystemIdentifier"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string VirtualSystemType { @@ -952,9 +952,9 @@ This is a read-only property, it cannot be changed.")] return ((string)(curObj["VirtualSystemType"])); } } - + private bool CheckIfProperClass(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions OptionsParam) { - if (((path != null) + if (((path != null) && (string.Compare(path.ClassName, this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -962,9 +962,9 @@ This is a read-only property, it cannot be changed.")] return CheckIfProperClass(new System.Management.ManagementObject(mgmtScope, path, OptionsParam)); } } - + private bool CheckIfProperClass(System.Management.ManagementBaseObject theObj) { - if (((theObj != null) + if (((theObj != null) && (string.Compare(((string)(theObj["__CLASS"])), this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -981,66 +981,66 @@ This is a read-only property, it cannot be changed.")] } return false; } - + private void ResetAdditionalRecoveryInformation() { curObj["AdditionalRecoveryInformation"] = null; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } - + private bool ShouldSerializeAllowFullSCSICommandSet() { if ((this.IsAllowFullSCSICommandSetNull == false)) { return true; } return false; } - + private void ResetAllowFullSCSICommandSet() { curObj["AllowFullSCSICommandSet"] = null; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } - + private bool ShouldSerializeAllowReducedFcRedundancy() { if ((this.IsAllowReducedFcRedundancyNull == false)) { return true; } return false; } - + private void ResetAllowReducedFcRedundancy() { curObj["AllowReducedFcRedundancy"] = null; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } - + private bool ShouldSerializeAutomaticRecoveryAction() { if ((this.IsAutomaticRecoveryActionNull == false)) { return true; } return false; } - + private bool ShouldSerializeAutomaticShutdownAction() { if ((this.IsAutomaticShutdownActionNull == false)) { return true; } return false; } - + private bool ShouldSerializeAutomaticStartupAction() { if ((this.IsAutomaticStartupActionNull == false)) { return true; } return false; } - + // Converts a given datetime in DMTF format to System.DateTime object. static System.DateTime ToDateTime(string dmtfDate) { System.DateTime initializer = System.DateTime.MinValue; @@ -1092,13 +1092,13 @@ This is a read-only property, it cannot be changed.")] if (("******" != tempString)) { ticks = (long.Parse(tempString) * ((long)((System.TimeSpan.TicksPerMillisecond / 1000)))); } - if (((((((((year < 0) - || (month < 0)) - || (day < 0)) - || (hour < 0)) - || (minute < 0)) - || (minute < 0)) - || (second < 0)) + if (((((((((year < 0) + || (month < 0)) + || (day < 0)) + || (hour < 0)) + || (minute < 0)) + || (minute < 0)) + || (second < 0)) || (ticks < 0))) { throw new System.ArgumentOutOfRangeException(); } @@ -1126,7 +1126,7 @@ This is a read-only property, it cannot be changed.")] } return datetime; } - + // Converts a given System.DateTime object to DMTF datetime format. static string ToDmtfDateTime(System.DateTime date) { string utcString = string.Empty; @@ -1153,8 +1153,8 @@ This is a read-only property, it cannot be changed.")] dmtfDateTime = string.Concat(dmtfDateTime, ((int)(date.Second)).ToString().PadLeft(2, '0')); dmtfDateTime = string.Concat(dmtfDateTime, "."); System.DateTime dtTemp = new System.DateTime(date.Year, date.Month, date.Day, date.Hour, date.Minute, date.Second, 0); - long microsec = ((long)((((date.Ticks - dtTemp.Ticks) - * 1000) + long microsec = ((long)((((date.Ticks - dtTemp.Ticks) + * 1000) / System.TimeSpan.TicksPerMillisecond))); string strMicrosec = ((long)(microsec)).ToString(); if ((strMicrosec.Length > 6)) { @@ -1164,198 +1164,198 @@ This is a read-only property, it cannot be changed.")] dmtfDateTime = string.Concat(dmtfDateTime, utcString); return dmtfDateTime; } - + private bool ShouldSerializeAutomaticStartupActionDelay() { if ((this.IsAutomaticStartupActionDelayNull == false)) { return true; } return false; } - + private bool ShouldSerializeAutomaticStartupActionSequenceNumber() { if ((this.IsAutomaticStartupActionSequenceNumberNull == false)) { return true; } return false; } - + private void ResetBaseBoardSerialNumber() { curObj["BaseBoardSerialNumber"] = null; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } - + private void ResetBIOSGUID() { curObj["BIOSGUID"] = null; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } - + private bool ShouldSerializeBIOSNumLock() { if ((this.IsBIOSNumLockNull == false)) { return true; } return false; } - + private void ResetBIOSNumLock() { curObj["BIOSNumLock"] = null; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } - + private void ResetBIOSSerialNumber() { curObj["BIOSSerialNumber"] = null; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } - + private void ResetBootOrder() { curObj["BootOrder"] = null; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } - + private void ResetChassisAssetTag() { curObj["ChassisAssetTag"] = null; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } - + private void ResetChassisSerialNumber() { curObj["ChassisSerialNumber"] = null; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } - + private bool ShouldSerializeCreationTime() { if ((this.IsCreationTimeNull == false)) { return true; } return false; } - + private bool ShouldSerializeDebugChannelId() { if ((this.IsDebugChannelIdNull == false)) { return true; } return false; } - + private void ResetDebugChannelId() { curObj["DebugChannelId"] = null; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } - + private bool ShouldSerializeDebugPort() { if ((this.IsDebugPortNull == false)) { return true; } return false; } - + private void ResetDebugPort() { curObj["DebugPort"] = null; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } - + private bool ShouldSerializeDebugPortEnabled() { if ((this.IsDebugPortEnabledNull == false)) { return true; } return false; } - + private void ResetDebugPortEnabled() { curObj["DebugPortEnabled"] = null; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } - + private bool ShouldSerializeIncrementalBackupEnabled() { if ((this.IsIncrementalBackupEnabledNull == false)) { return true; } return false; } - + private void ResetIncrementalBackupEnabled() { curObj["IncrementalBackupEnabled"] = null; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } - + private bool ShouldSerializeIsSaved() { if ((this.IsIsSavedNull == false)) { return true; } return false; } - + private bool ShouldSerializeVirtualNumaEnabled() { if ((this.IsVirtualNumaEnabledNull == false)) { return true; } return false; } - + private void ResetVirtualNumaEnabled() { curObj["VirtualNumaEnabled"] = null; - if (((isEmbedded == false) + if (((isEmbedded == false) && (AutoCommitProp == true))) { PrivateLateBoundObject.Put(); } } - + [Browsable(true)] public void CommitObject() { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(); } } - + [Browsable(true)] public void CommitObject(System.Management.PutOptions putOptions) { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(putOptions); } } - + private void Initialize() { AutoCommitProp = true; isEmbedded = false; } - + private static string ConstructPath(string keyInstanceID) { string strPath = "ROOT\\virtualization\\v2:Msvm_VirtualSystemSettingData"; strPath = string.Concat(strPath, string.Concat(".InstanceID=", string.Concat("\"", string.Concat(keyInstanceID, "\"")))); return strPath; } - + private void InitializeObject(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { Initialize(); if ((path != null)) { @@ -1367,24 +1367,24 @@ This is a read-only property, it cannot be changed.")] PrivateSystemProperties = new ManagementSystemProperties(PrivateLateBoundObject); curObj = PrivateLateBoundObject; } - + // Different overloads of GetInstances() help in enumerating instances of the WMI class. public static VirtualSystemSettingDataCollection GetInstances() { return GetInstances(null, null, null); } - + public static VirtualSystemSettingDataCollection GetInstances(string condition) { return GetInstances(null, condition, null); } - + public static VirtualSystemSettingDataCollection GetInstances(string[] selectedProperties) { return GetInstances(null, null, selectedProperties); } - + public static VirtualSystemSettingDataCollection GetInstances(string condition, string[] selectedProperties) { return GetInstances(null, condition, selectedProperties); } - + public static VirtualSystemSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, System.Management.EnumerationOptions enumOptions) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -1405,15 +1405,15 @@ This is a read-only property, it cannot be changed.")] } return new VirtualSystemSettingDataCollection(clsObject.GetInstances(enumOptions)); } - + public static VirtualSystemSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition) { return GetInstances(mgmtScope, condition, null); } - + public static VirtualSystemSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string[] selectedProperties) { return GetInstances(mgmtScope, null, selectedProperties); } - + public static VirtualSystemSettingDataCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition, string[] selectedProperties) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -1430,7 +1430,7 @@ This is a read-only property, it cannot be changed.")] ObjectSearcher.Options = enumOptions; return new VirtualSystemSettingDataCollection(ObjectSearcher.Get()); } - + [Browsable(true)] public static VirtualSystemSettingData CreateInstance() { System.Management.ManagementScope mgmtScope = null; @@ -1445,50 +1445,50 @@ This is a read-only property, it cannot be changed.")] System.Management.ManagementClass tmpMgmtClass = new System.Management.ManagementClass(mgmtScope, mgmtPath, null); return new VirtualSystemSettingData(tmpMgmtClass.CreateInstance()); } - + [Browsable(true)] public void Delete() { PrivateLateBoundObject.Delete(); } - + public enum DebugPortEnabledValues { - + Val__Off = 0, - + On = 1, - + OnAutoAssigned = 2, - + NULL_ENUM_VALUE = 3, } - + // Enumerator implementation for enumerating instances of the class. public class VirtualSystemSettingDataCollection : object, ICollection { - + private ManagementObjectCollection privColObj; - + public VirtualSystemSettingDataCollection(ManagementObjectCollection objCollection) { privColObj = objCollection; } - + public virtual int Count { get { return privColObj.Count; } } - + public virtual bool IsSynchronized { get { return privColObj.IsSynchronized; } } - + public virtual object SyncRoot { get { return this; } } - + public virtual void CopyTo(System.Array array, int index) { privColObj.CopyTo(array, index); int nCtr; @@ -1496,189 +1496,189 @@ This is a read-only property, it cannot be changed.")] array.SetValue(new VirtualSystemSettingData(((System.Management.ManagementObject)(array.GetValue(nCtr)))), nCtr); } } - + public virtual System.Collections.IEnumerator GetEnumerator() { return new VirtualSystemSettingDataEnumerator(privColObj.GetEnumerator()); } - + public class VirtualSystemSettingDataEnumerator : object, System.Collections.IEnumerator { - + private ManagementObjectCollection.ManagementObjectEnumerator privObjEnum; - + public VirtualSystemSettingDataEnumerator(ManagementObjectCollection.ManagementObjectEnumerator objEnum) { privObjEnum = objEnum; } - + public virtual object Current { get { return new VirtualSystemSettingData(((System.Management.ManagementObject)(privObjEnum.Current))); } } - + public virtual bool MoveNext() { return privObjEnum.MoveNext(); } - + public virtual void Reset() { privObjEnum.Reset(); } } } - + // TypeConverter to handle null values for ValueType properties public class WMIValueTypeConverter : TypeConverter { - + private TypeConverter baseConverter; - + private System.Type baseType; - + public WMIValueTypeConverter(System.Type inBaseType) { baseConverter = TypeDescriptor.GetConverter(inBaseType); baseType = inBaseType; } - + 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 ((baseType.BaseType == typeof(System.Enum))) { if ((value.GetType() == destinationType)) { return value; } - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return "NULL_ENUM_VALUE" ; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((baseType == typeof(bool)) + if (((baseType == typeof(bool)) && (baseType.BaseType == typeof(System.ValueType)))) { - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((context != null) + if (((context != null) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } } - + // Embedded class to represent WMI system Properties. [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 { diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/root.CIMV2.Win32_PerfFormattedData_Counters_ProcessorInformation.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/root.CIMV2.Win32_PerfFormattedData_Counters_ProcessorInformation.cs index 0cf3735712e..4d7ffc9cb3f 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/root.CIMV2.Win32_PerfFormattedData_Counters_ProcessorInformation.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/WmiWrappers/root.CIMV2.Win32_PerfFormattedData_Counters_ProcessorInformation.cs @@ -23,70 +23,70 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { using System.Globalization; using System.ComponentModel.Design.Serialization; using System.Reflection; - - + + // Functions ShouldSerialize are functions used by VS property browser to check if a particular property has to be serialized. These functions are added for all ValueType properties ( properties of type Int32, BOOL etc.. which cannot be set to null). These functions use IsNull function. These functions are also used in the TypeConverter implementation for the properties to check for NULL value of property so that an empty value can be shown in Property browser in case of Drag and Drop in Visual studio. // Functions IsNull() are used to check if a property is NULL. // Functions Reset are added for Nullable Read/Write properties. These functions are used by VS designer in property browser to set a property to NULL. // Every property added to the class for WMI property has attributes set to define its behavior in Visual Studio designer and also to define a TypeConverter to be used. // An Early Bound class generated for the WMI class.Win32_PerfFormattedData_Counters_ProcessorInformation public class PerfFormattedData_Counters_ProcessorInformation : System.ComponentModel.Component { - + // Private property to hold the WMI namespace in which the class resides. private static string CreatedWmiNamespace = "root\\CIMV2"; - + // Private property to hold the name of WMI class which created this class. private static string CreatedClassName = "Win32_PerfFormattedData_Counters_ProcessorInformation"; - + // Private member variable to hold the ManagementScope which is used by the various methods. private static System.Management.ManagementScope statMgmtScope = null; - + private ManagementSystemProperties PrivateSystemProperties; - + // Underlying lateBound WMI object. private System.Management.ManagementObject PrivateLateBoundObject; - + // Member variable to store the 'automatic commit' behavior for the class. private bool AutoCommitProp; - + // Private variable to hold the embedded property representing the instance. private System.Management.ManagementBaseObject embeddedObj; - + // The current WMI object used private System.Management.ManagementBaseObject curObj; - + // Flag to indicate if the instance is an embedded object. private bool isEmbedded; - + // Below are different overloads of constructors to initialize an instance of the class with a WMI object. public PerfFormattedData_Counters_ProcessorInformation() { this.InitializeObject(null, null, null); } - + public PerfFormattedData_Counters_ProcessorInformation(string keyName) { this.InitializeObject(null, new System.Management.ManagementPath(PerfFormattedData_Counters_ProcessorInformation.ConstructPath(keyName)), null); } - + public PerfFormattedData_Counters_ProcessorInformation(System.Management.ManagementScope mgmtScope, string keyName) { this.InitializeObject(((System.Management.ManagementScope)(mgmtScope)), new System.Management.ManagementPath(PerfFormattedData_Counters_ProcessorInformation.ConstructPath(keyName)), null); } - + public PerfFormattedData_Counters_ProcessorInformation(System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(null, path, getOptions); } - + public PerfFormattedData_Counters_ProcessorInformation(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path) { this.InitializeObject(mgmtScope, path, null); } - + public PerfFormattedData_Counters_ProcessorInformation(System.Management.ManagementPath path) { this.InitializeObject(null, path, null); } - + public PerfFormattedData_Counters_ProcessorInformation(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { this.InitializeObject(mgmtScope, path, getOptions); } - + public PerfFormattedData_Counters_ProcessorInformation(System.Management.ManagementObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -98,7 +98,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { throw new System.ArgumentException("Class name does not match."); } } - + public PerfFormattedData_Counters_ProcessorInformation(System.Management.ManagementBaseObject theObject) { Initialize(); if ((CheckIfProperClass(theObject) == true)) { @@ -111,7 +111,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { throw new System.ArgumentException("Class name does not match."); } } - + // Property returns the namespace of the WMI class. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -120,7 +120,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { return "root\\CIMV2"; } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ManagementClassName { @@ -129,7 +129,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { if ((curObj != null)) { if ((curObj.ClassPath != null)) { strRet = ((string)(curObj["__CLASS"])); - if (((strRet == null) + if (((strRet == null) || (strRet == string.Empty))) { strRet = CreatedClassName; } @@ -138,7 +138,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { return strRet; } } - + // Property pointing to an embedded object to get System properties of the WMI object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -147,7 +147,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { return PrivateSystemProperties; } } - + // Property returning the underlying lateBound object. [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -156,7 +156,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { return curObj; } } - + // ManagementScope of the object. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -175,7 +175,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { } } } - + // Property to show the commit behavior for the WMI object. If true, WMI object will be automatically saved after each property modification.(ie. Put() is called after modification of a property). [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -187,7 +187,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { AutoCommitProp = value; } } - + // The ManagementPath of the underlying WMI object. [Browsable(true)] public System.Management.ManagementPath Path { @@ -208,7 +208,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { } } } - + // Public static scope property which is used by the various methods. [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] @@ -220,7 +220,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { statMgmtScope = value; } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsAverageIdleTimeNull { @@ -233,7 +233,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("Average Idle Time is the average idle duration in 100ns units observed between th" + @@ -247,7 +247,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { return ((ulong)(curObj["AverageIdleTime"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsC1TransitionsPersecNull { @@ -260,7 +260,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"C1 Transitions/sec is the rate that the CPU enters the C1 low-power idle state. The CPU enters the C1 state when it is sufficiently idle and exits this state on any interrupt. This counter displays the difference between the values observed in the last two samples, divided by the duration of the sample interval.")] @@ -273,7 +273,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { return ((ulong)(curObj["C1TransitionsPersec"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsC2TransitionsPersecNull { @@ -286,7 +286,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"C2 Transitions/sec is the rate that the CPU enters the C2 low-power idle state. The CPU enters the C2 state when it is sufficiently idle and exits this state on any interrupt. This counter displays the difference between the values observed in the last two samples, divided by the duration of the sample interval.")] @@ -299,7 +299,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { return ((ulong)(curObj["C2TransitionsPersec"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsC3TransitionsPersecNull { @@ -312,7 +312,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"C3 Transitions/sec is the rate that the CPU enters the C3 low-power idle state. The CPU enters the C3 state when it is sufficiently idle and exits this state on any interrupt. This counter displays the difference between the values observed in the last two samples, divided by the duration of the sample interval.")] @@ -325,7 +325,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { return ((ulong)(curObj["C3TransitionsPersec"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("A short textual description (one-line string) for the statistic or metric.")] @@ -334,7 +334,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { return ((string)(curObj["Caption"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsClockInterruptsPersecNull { @@ -347,7 +347,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"Clock Interrupts/sec is the average rate, in incidents per second, at which the processor received and serviced clock tick interrupts. This counter displays the difference between the values observed in the last two samples, divided by the duration of the sample interval.")] @@ -360,7 +360,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { return ((uint)(curObj["ClockInterruptsPersec"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("A textual description of the statistic or metric.")] @@ -369,7 +369,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { return ((string)(curObj["Description"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsDPCRateNull { @@ -382,7 +382,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"DPC Rate is the rate at which deferred procedure calls (DPCs) were added to the processors DPC queues between the timer ticks of the processor clock. DPCs are interrupts that run at alower priority than standard interrupts. Each processor has its own DPC queue. This counter measures the rate that DPCs were added to the queue, not the number of DPCs in the queue. This counter displays the last observed value only; it is not an average.")] @@ -395,7 +395,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { return ((uint)(curObj["DPCRate"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsDPCsQueuedPersecNull { @@ -408,7 +408,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"DPCs Queued/sec is the average rate, in incidents per second, at which deferred procedure calls (DPCs) were added to the processor's DPC queue. DPCs are interrupts that run at a lower priority than standard interrupts. Each processor has its own DPC queue. This counter measures the rate that DPCs are added to the queue, not the number of DPCs in the queue. This counter displays the difference between the values observed in the last two samples, divided by the duration of the sample interval.")] @@ -421,7 +421,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { return ((uint)(curObj["DPCsQueuedPersec"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsFrequency_ObjectNull { @@ -434,7 +434,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -446,7 +446,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { return ((ulong)(curObj["Frequency_Object"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsFrequency_PerfTimeNull { @@ -459,7 +459,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -471,7 +471,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { return ((ulong)(curObj["Frequency_PerfTime"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsFrequency_Sys100NSNull { @@ -484,7 +484,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -496,7 +496,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { return ((ulong)(curObj["Frequency_Sys100NS"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsIdleBreakEventsPersecNull { @@ -509,7 +509,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("Idle Break Events/sec is the average rate, in incidents per second, at which the " + @@ -525,7 +525,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { return ((ulong)(curObj["IdleBreakEventsPersec"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsInterruptsPersecNull { @@ -538,7 +538,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"Interrupts/sec is the average rate, in incidents per second, at which the processor received and serviced hardware interrupts. It does not include deferred procedure calls (DPCs), which are counted separately. This value is an indirect indicator of the activity of devices that generate interrupts, such as the system clock, the mouse, disk drivers, data communication lines, network interface cards, and other peripheral devices. These devices normally interrupt the processor when they have completed a task or require attention. Normal thread execution is suspended. The system clock typically interrupts the processor every 10 milliseconds, creating a background of interrupt activity. This counter displays the difference between the values observed in the last two samples, divided by the duration of the sample interval.")] @@ -551,7 +551,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { return ((uint)(curObj["InterruptsPersec"])); } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("The Name property defines the label by which the statistic or metric is known. Wh" + @@ -561,7 +561,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { return ((string)(curObj["Name"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsParkingStatusNull { @@ -574,7 +574,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("Parking Status represents whether a processor is parked or not.")] @@ -587,7 +587,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { return ((uint)(curObj["ParkingStatus"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPercentC1TimeNull { @@ -600,7 +600,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"% C1 Time is the percentage of time the processor spends in the C1 low-power idle state. % C1 Time is a subset of the total processor idle time. C1 low-power idle state enables the processor to maintain its entire context and quickly return to the running state. Not all systems support the % C1 state.")] @@ -613,7 +613,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { return ((ulong)(curObj["PercentC1Time"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPercentC2TimeNull { @@ -626,7 +626,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"% C2 Time is the percentage of time the processor spends in the C2 low-power idle state. % C2 Time is a subset of the total processor idle time. C2 low-power idle state enables the processor to maintain the context of the system caches. The C2 power state is a lower power and higher exit latency state than C1. Not all systems support the C2 state.")] @@ -639,7 +639,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { return ((ulong)(curObj["PercentC2Time"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPercentC3TimeNull { @@ -652,7 +652,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"% C3 Time is the percentage of time the processor spends in the C3 low-power idle state. % C3 Time is a subset of the total processor idle time. When the processor is in the C3 low-power idle state it is unable to maintain the coherency of its caches. The C3 power state is a lower power and higher exit latency state than C2. Not all systems support the C3 state.")] @@ -665,7 +665,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { return ((ulong)(curObj["PercentC3Time"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPercentDPCTimeNull { @@ -678,7 +678,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"% DPC Time is the percentage of time that the processor spent receiving and servicing deferred procedure calls (DPCs) during the sample interval. DPCs are interrupts that run at a lower priority than standard interrupts. % DPC Time is a component of % Privileged Time because DPCs are executed in privileged mode. They are counted separately and are not a component of the interrupt counters. This counter displays the average busy time as a percentage of the sample time.")] @@ -691,7 +691,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { return ((ulong)(curObj["PercentDPCTime"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPercentIdleTimeNull { @@ -704,7 +704,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("% Idle Time is the percentage of time the processor is idle during the sample int" + @@ -718,7 +718,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { return ((ulong)(curObj["PercentIdleTime"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPercentInterruptTimeNull { @@ -731,7 +731,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"% Interrupt Time is the time the processor spends receiving and servicing hardware interrupts during sample intervals. This value is an indirect indicator of the activity of devices that generate interrupts, such as the system clock, the mouse, disk drivers, data communication lines, network interface cards and other peripheral devices. These devices normally interrupt the processor when they have completed a task or require attention. Normal thread execution is suspended during interrupts. Most system clocks interrupt the processor every 10 milliseconds, creating a background of interrupt activity. suspends normal thread execution during interrupts. This counter displays the average busy time as a percentage of the sample time.")] @@ -744,7 +744,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { return ((ulong)(curObj["PercentInterruptTime"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPercentofMaximumFrequencyNull { @@ -757,7 +757,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("% of Maximum Frequency is the percentage of the current processor\'s maximum frequ" + @@ -771,7 +771,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { return ((uint)(curObj["PercentofMaximumFrequency"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPercentPerformanceLimitNull { @@ -784,7 +784,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"% Performance Limit is the performance the processor guarantees it can provide, as a percentage of the nominal performance of the processor. Performance can be limited by Windows power policy, or by the platform as a result of a power budget, overheating, or other hardware issues.")] @@ -797,7 +797,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { return ((uint)(curObj["PercentPerformanceLimit"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPercentPriorityTimeNull { @@ -810,7 +810,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"% Priority Time is the percentage of elapsed time that the processor spends executing threads that are not low priority. It is calculated by measuring the percentage of time that the processor spends executing low priority threads or the idle thread and then subtracting that value from 100%. (Each processor has an idle thread to which time is accumulated when no other threads are ready to run). This counter displays the average percentage of busy time observed during the sample interval excluding low priority background work. It should be noted that the accounting calculation of whether the processor is idle is performed at an internal sampling interval of the system clock tick. % Priority Time can therefore underestimate the processor utilization as the processor may be spending a lot of time servicing threads between the system clock sampling interval. Workload based timer applications are one example of applications which are more likely to be measured inaccurately as timers are signaled just after the sample is taken.")] @@ -823,7 +823,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { return ((ulong)(curObj["PercentPriorityTime"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPercentPrivilegedTimeNull { @@ -836,7 +836,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"% Privileged Time is the percentage of elapsed time that the process threads spent executing code in privileged mode. When a Windows system service in called, the service will often run in privileged mode to gain access to system-private data. Such data is protected from access by threads executing in user mode. Calls to the system can be explicit or implicit, such as page faults or interrupts. Unlike some early operating systems, Windows uses process boundaries for subsystem protection in addition to the traditional protection of user and privileged modes. Some work done by Windows on behalf of the application might appear in other subsystem processes in addition to the privileged time in the process.")] @@ -849,7 +849,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { return ((ulong)(curObj["PercentPrivilegedTime"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPercentPrivilegedUtilityNull { @@ -862,7 +862,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"Privileged Utility is the amount of work a processor is completing while executing in privileged mode, as a percentage of the amount of work the processor could complete if it were running at its nominal performance and never idle. On some processors, Privileged Utility may exceed 100%.")] @@ -875,7 +875,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { return ((ulong)(curObj["PercentPrivilegedUtility"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPercentProcessorPerformanceNull { @@ -888,7 +888,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("Processor Performance is the average performance of the processor while it is exe" + @@ -903,7 +903,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { return ((ulong)(curObj["PercentProcessorPerformance"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPercentProcessorTimeNull { @@ -916,7 +916,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"% Processor Time is the percentage of elapsed time that the processor spends to execute a non-Idle thread. It is calculated by measuring the percentage of time that the processor spends executing the idle thread and then subtracting that value from 100%. (Each processor has an idle thread to which time is accumulated when no other threads are ready to run). This counter is the primary indicator of processor activity, and displays the average percentage of busy time observed during the sample interval. It should be noted that the accounting calculation of whether the processor is idle is performed at an internal sampling interval of the system clock tick. On todays fast processors, % Processor Time can therefore underestimate the processor utilization as the processor may be spending a lot of time servicing threads between the system clock sampling interval. Workload based timer applications are one example of applications which are more likely to be measured inaccurately as timers are signaled just after the sample is taken.")] @@ -929,7 +929,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { return ((ulong)(curObj["PercentProcessorTime"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPercentProcessorUtilityNull { @@ -942,7 +942,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("Processor Utility is the amount of work a processor is completing, as a percentag" + @@ -958,7 +958,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { return ((ulong)(curObj["PercentProcessorUtility"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPercentUserTimeNull { @@ -971,7 +971,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description(@"% User Time is the percentage of elapsed time the processor spends in the user mode. User mode is a restricted processing mode designed for applications, environment subsystems, and integral subsystems. The alternative, privileged mode, is designed for operating system components and allows direct access to hardware and all memory. The operating system switches application threads to privileged mode to access operating system services. This counter displays the average busy time as a percentage of the sample time.")] @@ -984,7 +984,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { return ((ulong)(curObj["PercentUserTime"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsPerformanceLimitFlagsNull { @@ -997,7 +997,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("Performance Limit Flags indicate reasons why the processor performance was limite" + @@ -1011,7 +1011,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { return ((uint)(curObj["PerformanceLimitFlags"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsProcessorFrequencyNull { @@ -1024,7 +1024,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("Processor Frequency is the frequency of the current processor in megahertz.")] @@ -1037,7 +1037,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { return ((uint)(curObj["ProcessorFrequency"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsProcessorStateFlagsNull { @@ -1050,7 +1050,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("Processor State Flags")] @@ -1063,7 +1063,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { return ((uint)(curObj["ProcessorStateFlags"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsTimestamp_ObjectNull { @@ -1076,7 +1076,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -1088,7 +1088,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { return ((ulong)(curObj["Timestamp_Object"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsTimestamp_PerfTimeNull { @@ -1101,7 +1101,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -1113,7 +1113,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { return ((ulong)(curObj["Timestamp_PerfTime"])); } } - + [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool IsTimestamp_Sys100NSNull { @@ -1126,7 +1126,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { } } } - + [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [TypeConverter(typeof(WMIValueTypeConverter))] @@ -1138,9 +1138,9 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { return ((ulong)(curObj["Timestamp_Sys100NS"])); } } - + private bool CheckIfProperClass(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions OptionsParam) { - if (((path != null) + if (((path != null) && (string.Compare(path.ClassName, this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -1148,9 +1148,9 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { return CheckIfProperClass(new System.Management.ManagementObject(mgmtScope, path, OptionsParam)); } } - + private bool CheckIfProperClass(System.Management.ManagementBaseObject theObj) { - if (((theObj != null) + if (((theObj != null) && (string.Compare(((string)(theObj["__CLASS"])), this.ManagementClassName, true, System.Globalization.CultureInfo.InvariantCulture) == 0))) { return true; } @@ -1167,270 +1167,270 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { } return false; } - + private bool ShouldSerializeAverageIdleTime() { if ((this.IsAverageIdleTimeNull == false)) { return true; } return false; } - + private bool ShouldSerializeC1TransitionsPersec() { if ((this.IsC1TransitionsPersecNull == false)) { return true; } return false; } - + private bool ShouldSerializeC2TransitionsPersec() { if ((this.IsC2TransitionsPersecNull == false)) { return true; } return false; } - + private bool ShouldSerializeC3TransitionsPersec() { if ((this.IsC3TransitionsPersecNull == false)) { return true; } return false; } - + private bool ShouldSerializeClockInterruptsPersec() { if ((this.IsClockInterruptsPersecNull == false)) { return true; } return false; } - + private bool ShouldSerializeDPCRate() { if ((this.IsDPCRateNull == false)) { return true; } return false; } - + private bool ShouldSerializeDPCsQueuedPersec() { if ((this.IsDPCsQueuedPersecNull == false)) { return true; } return false; } - + private bool ShouldSerializeFrequency_Object() { if ((this.IsFrequency_ObjectNull == false)) { return true; } return false; } - + private bool ShouldSerializeFrequency_PerfTime() { if ((this.IsFrequency_PerfTimeNull == false)) { return true; } return false; } - + private bool ShouldSerializeFrequency_Sys100NS() { if ((this.IsFrequency_Sys100NSNull == false)) { return true; } return false; } - + private bool ShouldSerializeIdleBreakEventsPersec() { if ((this.IsIdleBreakEventsPersecNull == false)) { return true; } return false; } - + private bool ShouldSerializeInterruptsPersec() { if ((this.IsInterruptsPersecNull == false)) { return true; } return false; } - + private bool ShouldSerializeParkingStatus() { if ((this.IsParkingStatusNull == false)) { return true; } return false; } - + private bool ShouldSerializePercentC1Time() { if ((this.IsPercentC1TimeNull == false)) { return true; } return false; } - + private bool ShouldSerializePercentC2Time() { if ((this.IsPercentC2TimeNull == false)) { return true; } return false; } - + private bool ShouldSerializePercentC3Time() { if ((this.IsPercentC3TimeNull == false)) { return true; } return false; } - + private bool ShouldSerializePercentDPCTime() { if ((this.IsPercentDPCTimeNull == false)) { return true; } return false; } - + private bool ShouldSerializePercentIdleTime() { if ((this.IsPercentIdleTimeNull == false)) { return true; } return false; } - + private bool ShouldSerializePercentInterruptTime() { if ((this.IsPercentInterruptTimeNull == false)) { return true; } return false; } - + private bool ShouldSerializePercentofMaximumFrequency() { if ((this.IsPercentofMaximumFrequencyNull == false)) { return true; } return false; } - + private bool ShouldSerializePercentPerformanceLimit() { if ((this.IsPercentPerformanceLimitNull == false)) { return true; } return false; } - + private bool ShouldSerializePercentPriorityTime() { if ((this.IsPercentPriorityTimeNull == false)) { return true; } return false; } - + private bool ShouldSerializePercentPrivilegedTime() { if ((this.IsPercentPrivilegedTimeNull == false)) { return true; } return false; } - + private bool ShouldSerializePercentPrivilegedUtility() { if ((this.IsPercentPrivilegedUtilityNull == false)) { return true; } return false; } - + private bool ShouldSerializePercentProcessorPerformance() { if ((this.IsPercentProcessorPerformanceNull == false)) { return true; } return false; } - + private bool ShouldSerializePercentProcessorTime() { if ((this.IsPercentProcessorTimeNull == false)) { return true; } return false; } - + private bool ShouldSerializePercentProcessorUtility() { if ((this.IsPercentProcessorUtilityNull == false)) { return true; } return false; } - + private bool ShouldSerializePercentUserTime() { if ((this.IsPercentUserTimeNull == false)) { return true; } return false; } - + private bool ShouldSerializePerformanceLimitFlags() { if ((this.IsPerformanceLimitFlagsNull == false)) { return true; } return false; } - + private bool ShouldSerializeProcessorFrequency() { if ((this.IsProcessorFrequencyNull == false)) { return true; } return false; } - + private bool ShouldSerializeProcessorStateFlags() { if ((this.IsProcessorStateFlagsNull == false)) { return true; } return false; } - + private bool ShouldSerializeTimestamp_Object() { if ((this.IsTimestamp_ObjectNull == false)) { return true; } return false; } - + private bool ShouldSerializeTimestamp_PerfTime() { if ((this.IsTimestamp_PerfTimeNull == false)) { return true; } return false; } - + private bool ShouldSerializeTimestamp_Sys100NS() { if ((this.IsTimestamp_Sys100NSNull == false)) { return true; } return false; } - + [Browsable(true)] public void CommitObject() { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(); } } - + [Browsable(true)] public void CommitObject(System.Management.PutOptions putOptions) { if ((isEmbedded == false)) { PrivateLateBoundObject.Put(putOptions); } } - + private void Initialize() { AutoCommitProp = true; isEmbedded = false; } - + private static string ConstructPath(string keyName) { string strPath = "root\\CIMV2:Win32_PerfFormattedData_Counters_ProcessorInformation"; strPath = string.Concat(strPath, string.Concat(".Name=", string.Concat("\"", string.Concat(keyName, "\"")))); return strPath; } - + private void InitializeObject(System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) { Initialize(); if ((path != null)) { @@ -1442,24 +1442,24 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { PrivateSystemProperties = new ManagementSystemProperties(PrivateLateBoundObject); curObj = PrivateLateBoundObject; } - + // Different overloads of GetInstances() help in enumerating instances of the WMI class. public static PerfFormattedData_Counters_ProcessorInformationCollection GetInstances() { return GetInstances(null, null, null); } - + public static PerfFormattedData_Counters_ProcessorInformationCollection GetInstances(string condition) { return GetInstances(null, condition, null); } - + public static PerfFormattedData_Counters_ProcessorInformationCollection GetInstances(string[] selectedProperties) { return GetInstances(null, null, selectedProperties); } - + public static PerfFormattedData_Counters_ProcessorInformationCollection GetInstances(string condition, string[] selectedProperties) { return GetInstances(null, condition, selectedProperties); } - + public static PerfFormattedData_Counters_ProcessorInformationCollection GetInstances(System.Management.ManagementScope mgmtScope, System.Management.EnumerationOptions enumOptions) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -1480,15 +1480,15 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { } return new PerfFormattedData_Counters_ProcessorInformationCollection(clsObject.GetInstances(enumOptions)); } - + public static PerfFormattedData_Counters_ProcessorInformationCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition) { return GetInstances(mgmtScope, condition, null); } - + public static PerfFormattedData_Counters_ProcessorInformationCollection GetInstances(System.Management.ManagementScope mgmtScope, string[] selectedProperties) { return GetInstances(mgmtScope, null, selectedProperties); } - + public static PerfFormattedData_Counters_ProcessorInformationCollection GetInstances(System.Management.ManagementScope mgmtScope, string condition, string[] selectedProperties) { if ((mgmtScope == null)) { if ((statMgmtScope == null)) { @@ -1505,7 +1505,7 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { ObjectSearcher.Options = enumOptions; return new PerfFormattedData_Counters_ProcessorInformationCollection(ObjectSearcher.Get()); } - + [Browsable(true)] public static PerfFormattedData_Counters_ProcessorInformation CreateInstance() { System.Management.ManagementScope mgmtScope = null; @@ -1520,39 +1520,39 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { System.Management.ManagementClass tmpMgmtClass = new System.Management.ManagementClass(mgmtScope, mgmtPath, null); return new PerfFormattedData_Counters_ProcessorInformation(tmpMgmtClass.CreateInstance()); } - + [Browsable(true)] public void Delete() { PrivateLateBoundObject.Delete(); } - + // Enumerator implementation for enumerating instances of the class. public class PerfFormattedData_Counters_ProcessorInformationCollection : object, ICollection { - + private ManagementObjectCollection privColObj; - + public PerfFormattedData_Counters_ProcessorInformationCollection(ManagementObjectCollection objCollection) { privColObj = objCollection; } - + public virtual int Count { get { return privColObj.Count; } } - + public virtual bool IsSynchronized { get { return privColObj.IsSynchronized; } } - + public virtual object SyncRoot { get { return this; } } - + public virtual void CopyTo(System.Array array, int index) { privColObj.CopyTo(array, index); int nCtr; @@ -1560,189 +1560,189 @@ namespace CloudStack.Plugin.WmiWrappers.ROOT.CIMV2 { array.SetValue(new PerfFormattedData_Counters_ProcessorInformation(((System.Management.ManagementObject)(array.GetValue(nCtr)))), nCtr); } } - + public virtual System.Collections.IEnumerator GetEnumerator() { return new PerfFormattedData_Counters_ProcessorInformationEnumerator(privColObj.GetEnumerator()); } - + public class PerfFormattedData_Counters_ProcessorInformationEnumerator : object, System.Collections.IEnumerator { - + private ManagementObjectCollection.ManagementObjectEnumerator privObjEnum; - + public PerfFormattedData_Counters_ProcessorInformationEnumerator(ManagementObjectCollection.ManagementObjectEnumerator objEnum) { privObjEnum = objEnum; } - + public virtual object Current { get { return new PerfFormattedData_Counters_ProcessorInformation(((System.Management.ManagementObject)(privObjEnum.Current))); } } - + public virtual bool MoveNext() { return privObjEnum.MoveNext(); } - + public virtual void Reset() { privObjEnum.Reset(); } } } - + // TypeConverter to handle null values for ValueType properties public class WMIValueTypeConverter : TypeConverter { - + private TypeConverter baseConverter; - + private System.Type baseType; - + public WMIValueTypeConverter(System.Type inBaseType) { baseConverter = TypeDescriptor.GetConverter(inBaseType); baseType = inBaseType; } - + 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 ((baseType.BaseType == typeof(System.Enum))) { if ((value.GetType() == destinationType)) { return value; } - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return "NULL_ENUM_VALUE" ; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((baseType == typeof(bool)) + if (((baseType == typeof(bool)) && (baseType.BaseType == typeof(System.ValueType)))) { - if ((((value == null) - && (context != null)) + if ((((value == null) + && (context != null)) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } - if (((context != null) + if (((context != null) && (context.PropertyDescriptor.ShouldSerializeValue(context.Instance) == false))) { return ""; } return baseConverter.ConvertTo(context, culture, value, destinationType); } } - + // Embedded class to represent WMI system Properties. [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 {