コード例 #1
0
 public DiskInfo(ManagementObject disk)
 {
     PhysicalName = (string)disk.GetPropertyValue("Name");
     Name         = (string)disk.GetPropertyValue("Caption");
     Model        = (string)disk.GetPropertyValue("Model");
     //todo Why is Windows returning small sizes? https://stackoverflow.com/questions/15051660
     Length      = (long)disk.GetUlong("Size");
     SectorSize  = disk.GetInt("BytesPerSector");
     DisplaySize = Util.GetBytesReadable(Length);
     Partitions  = (uint)disk.GetPropertyValue("Partitions");
     Index       = (uint)disk.GetPropertyValue("Index");
 }