using System.Runtime.Serialization; namespace Vanara.IO; /// Contains information about a virtual hard disk file. [DataContract(Name = "Msvm_VirtualHardDiskSettingData", Namespace = @"root\virtualization\v2")] public class VirtualDiskSettingData { /// Initializes a new class. public VirtualDiskSettingData() { } /// Initializes a new class. /// The type of the disk. /// The format of the disk. /// The disk's path. public VirtualDiskSettingData(VirtualDisk.Subtype diskType, VirtualDisk.DeviceType diskFormat, string path) { DiskType = diskType; DiskFormat = diskFormat; Path = path; } /// Gets the block size of the virtual hard disk public uint BlockSize { get; set; } /// Gets the format of this disk. [DataMember(Name = "Format", IsRequired = true)] public VirtualDisk.DeviceType DiskFormat { get; set; } /// Gets the type of this disk. [DataMember(Name = "Type", IsRequired = true)] public VirtualDisk.Subtype DiskType { get; set; } /// Gets the logical sector size of the virtual hard disk public uint LogicalSectorSize { get; set; } /// Gets the disk's maximum size as viewable by the virtual machine. public ulong MaxInternalSize { get; set; } /// Gets the parent of the disk. If the disk does not have a parent this property is null. public string? ParentPath { get; set; } /// Gets the path of the disk. [DataMember(Name = "Path", IsRequired = true)] public string? Path { get; set; } /// Gets the physical sector size of the virtual hard disk public uint PhysicalSectorSize { get; set; } /// /// Parses the hard disk SettingData embedded instance returned from the server and creates a new VirtualHardDiskSettingData with /// that information. /// /// The disk SettingData embedded instance. /// A object with the data contained in the embedded instance. /// If either param is null. /// If there was a problem parsing the embedded instance. internal static VirtualDiskSettingData Parse(string embeddedInstance) => Management.ManagementExtensions.Parse(embeddedInstance); /// Gets the embedded instance string usable by WMI /// Embedded instance string usable by WMI. internal string GetInstanceText(string serverName = ".") => Management.ManagementExtensions.GetInstanceText(this, serverName); }