Пример #1
0
        private void FindAllDrives()
        {
            driveIndex = 0;
            DriveData driveData;

            queryCollection = connectionService.GetQueryCollectionFromWin32Class("Win32_DiskDrive");
            foreach (ManagementObject foundDrive in queryCollection)
            {
                driveData       = new DriveData();
                driveData.Model = foundDrive["Model"].ToString().Trim();
                driveData.Type  = foundDrive["InterfaceType"].ToString().Trim();
                if (null != foundDrive["SerialNumber"])
                {
                    driveData.Serial = foundDrive["SerialNumber"].ToString().Trim();
                }
                else
                {
                    driveData.Serial = "None";
                }
                allDrivesDictionary.Add(driveIndex, driveData);
                driveIndex++;
            }
        }