Beispiel #1
0
 internal void Add(Nolte.Hardware.Helper.DiskDriveInformation Info)
 {
     this.diskDriveInfo.Add(Info);
 }
Beispiel #2
0
        private static void ReadDiskDriveInformation()
        {
            ManagementClass            mc = new ManagementClass("Win32_DiskDrive");
            ManagementObjectCollection moc = mc.GetInstances();
            string a = "", b = "", c = "", d = "", e = "", f = "", g = "", h = "", i = "", j = "", k = "", /*l = "",*/ m = "", n = "", o = "", p = "";

            foreach (ManagementObject mo in moc)
            {
                try
                {
                    a = mo.Properties["Model"].Value.ToString();
                }
                catch
                {
                }
                try
                {
                    b = mo.Properties["Manufacturer"].Value.ToString();
                }
                catch
                {
                }
                try
                {
                    c = mo.Properties["Signature"].Value.ToString();
                }
                catch
                {
                }
                try
                {
                    d = mo.Properties["SerialNumber"].Value.ToString();
                }
                catch
                {
                }
                try
                {
                    e = mo.Properties["TotalCylinders"].Value.ToString();
                }
                catch
                {
                }
                try
                {
                    f = mo.Properties["TotalHeads"].Value.ToString();
                }
                catch
                {
                }
                try
                {
                    g = mo.Properties["TotalSectors"].Value.ToString();
                }
                catch
                {
                }
                try
                {
                    h = mo.Properties["TotalTracks"].Value.ToString();
                }
                catch
                {
                }
                try
                {
                    i = mo.Properties["TracksPerCylinder"].Value.ToString();
                }
                catch
                {
                }
                try
                {
                    j = mo.Properties["SectorsPerTrack"].Value.ToString();
                }
                catch
                {
                }
                try
                {
                    k = mo.Properties["BytesPerSector"].Value.ToString();
                }
                catch
                {
                }
                try
                {
                    m = mo.Properties["Size"].Value.ToString();
                }
                catch
                {
                }
                try
                {
                    n = mo.Properties["FirmwareRevision"].Value.ToString();
                }
                catch
                {
                }
                try
                {
                    o = mo.Properties["InterfaceType"].Value.ToString();
                }
                catch
                {
                }
                try
                {
                    p = mo.Properties["Caption"].Value.ToString();
                }
                catch
                {
                }
                Nolte.Hardware.Helper.DiskDriveInformation ddi = new Nolte.Hardware.Helper.DiskDriveInformation(a, b, c, d, e, f, g, h, i, j, k, m, n, o, p);
                Nolte.Hardware.diskDriveInformationIndexer.Add(ddi);
            }
        }