示例#1
0
        public DiskDriveViewModel(DiskDrive diskDrive)
        {
            Name     = diskDrive.Name;
            DeviceId = diskDrive.DeviceId;

            StringBuilder capabs = new StringBuilder();

            foreach (KeyValuePair <string, string> capability in diskDrive.CapabilityDescriptionDictionary)
            {
                capabs.Append(capability.Key);
                capabs.Append("(");
                capabs.Append(capability.Value);
                capabs.Append(");");
            }

            Capabilities = capabs.ToString();

            Availability           = diskDrive.Availability;
            BytesPerSector         = diskDrive.BytesPerSector;
            DefaultBlockSize       = diskDrive.DefaultBlockSize;
            MaxBlockSize           = diskDrive.MaxBlockSize;
            MinBlockSize           = diskDrive.MinBlockSize;
            Caption                = diskDrive.Caption;
            ConfigManagerErrorCode = diskDrive.ConfigManagerErrorCode;
            ErrorDescription       = diskDrive.ErrorDescription;
            ErrorMethodology       = diskDrive.ErrorMethodology;
            InterfaceType          = diskDrive.InterfaceType;
            Manufacturer           = diskDrive.Manufacturer;
            Model            = diskDrive.Model;
            IsMediaLoaded    = diskDrive.IsMediaLoaded;
            DoesNeedCleaning = diskDrive.DoesNeedCleaning;
            MediaType        = diskDrive.MediaType;
            PartitionCount   = diskDrive.PartitionCount;
            PnpDeviceID      = diskDrive.PnpDeviceID;

            capabs.Clear();

            foreach (string capability in diskDrive.PowerManagementCapabilities)
            {
                capabs.Append(capability);
                capabs.Append(";");
            }

            PowerManagementCapabilities = capabs.ToString();

            IsPowerManagementSupported = diskDrive.IsPowerManagementSupported;
            SerialNumber   = diskDrive.SerialNumber;
            Signature      = diskDrive.Signature;
            Size           = MemoryDisplayFormatter.Format(diskDrive.Size);
            Status         = diskDrive.Status;
            TotalCylinders = diskDrive.TotalCylinders;
            TotalHeads     = diskDrive.TotalHeads;
            TotalSectors   = diskDrive.TotalSectors;
            TotalTracks    = diskDrive.TotalTracks;
        }
示例#2
0
 public LogicalDiskViewModel(LogicalDisk logicalDisk)
 {
     Caption            = logicalDisk.VolumeName + "(" + logicalDisk.Caption + ")";
     DeviceId           = logicalDisk.DeviceId;
     FileSystem         = logicalDisk.FileSystem;
     Type               = logicalDisk.Type;
     FreeSpace          = MemoryDisplayFormatter.Format(logicalDisk.FreeSpace);
     Size               = MemoryDisplayFormatter.Format(logicalDisk.Size);
     VolumeName         = logicalDisk.VolumeName;
     VolumeSerialNumber = logicalDisk.VolumeSerialNumber;
     FreeSpaceInt       = logicalDisk.FreeSpace;
     TakenSpaceInt      = logicalDisk.Size - logicalDisk.FreeSpace;
     SizeInt            = logicalDisk.Size;
     MemoryAllocation   = MemoryDisplayFormatter.Format((logicalDisk.Size - logicalDisk.FreeSpace)) +
                          " / " + MemoryDisplayFormatter.Format(logicalDisk.Size);
 }
 public DiskPartitionViewModel(DiskPartition diskPartition)
 {
     BlockCount         = diskPartition.BlockCount;
     BlockSize          = diskPartition.BlockSize;
     Caption            = diskPartition.Caption;
     DeviceId           = diskPartition.DeviceId;
     HiddenSectorCount  = diskPartition.HiddenSectorCount;
     Index              = diskPartition.Index;
     IsBootable         = diskPartition.IsBootable;
     IsBootPartition    = diskPartition.IsBootPartition;
     IsPrimaryPartition = diskPartition.IsPrimaryPartition;
     Name           = diskPartition.Name;
     Purpose        = diskPartition.Purpose;
     Size           = MemoryDisplayFormatter.Format(diskPartition.Size);
     StartingOffset = diskPartition.StartingOffset;
     Type           = diskPartition.Type;
 }