예제 #1
0
        public void GetInformationTest()
        {
            var searcher      = new ManagementObjectSearcher("root\\WMI", "SELECT * FROM MSStorageDriver_ATAPISmartData");
            var thresSearcher = new ManagementObjectSearcher("root\\WMI", "SELECT * FROM MSStorageDriver_FailurePredictThresholds");

            var searcherEnumerator      = searcher.Get().GetEnumerator();
            var thresSearcherEnumerator = thresSearcher.Get().GetEnumerator();

            while (searcherEnumerator.MoveNext() && thresSearcherEnumerator.MoveNext())
            {
                byte[] arrVendorSpecific = (byte[])searcherEnumerator.Current.GetPropertyValue("VendorSpecific");
                byte[] arrThreshold      = (byte[])thresSearcherEnumerator.Current.GetPropertyValue("VendorSpecific");

                Console.WriteLine("-----------------------------------");
                Console.WriteLine("MSStorageDriver_ATAPISmartData instance");
                Console.WriteLine("-----------------------------------");

                // Create SMART data from 'vendor specific' array
                var d = new SmartData(arrVendorSpecific, arrThreshold);
                foreach (var b in d.Attributes)
                {
                    Console.Write("{0} : {1} : {2} : ", b.AttributeType, b.Value, b.Threshold);
                    string rawData = BitConverter.ToString(b.VendorData.Reverse().ToArray()).Replace("-", string.Empty);
                    Console.Write("{0}, {1}", rawData, int.Parse(rawData, NumberStyles.HexNumber));
                    Console.WriteLine();
                }
            }

            searcher = new ManagementObjectSearcher("root\\WMI", "SELECT * FROM MSStorageDriver_FailurePredictStatus");
            foreach (ManagementObject queryObj in searcher.Get())
            {
                var arrVendorSpecific = (bool)queryObj.GetPropertyValue("PredictFailure");
                Console.Write("IsOK: {0}", !arrVendorSpecific);
            }
        }
예제 #2
0
        public void GetInformationTest()
        {
            var searcher = new ManagementObjectSearcher("root\\WMI", "SELECT * FROM MSStorageDriver_ATAPISmartData");
            var thresSearcher = new ManagementObjectSearcher("root\\WMI", "SELECT * FROM MSStorageDriver_FailurePredictThresholds");

            var searcherEnumerator = searcher.Get().GetEnumerator();
            var thresSearcherEnumerator = thresSearcher.Get().GetEnumerator();

            while (searcherEnumerator.MoveNext() && thresSearcherEnumerator.MoveNext())
            {
                byte[] arrVendorSpecific = (byte[])searcherEnumerator.Current.GetPropertyValue("VendorSpecific");
                byte[] arrThreshold = (byte[])thresSearcherEnumerator.Current.GetPropertyValue("VendorSpecific");

                Console.WriteLine("-----------------------------------");
                Console.WriteLine("MSStorageDriver_ATAPISmartData instance");
                Console.WriteLine("-----------------------------------");

                // Create SMART data from 'vendor specific' array
                var d = new SmartData(arrVendorSpecific, arrThreshold);
                foreach (var b in d.Attributes)
                {
                    Console.Write("{0} : {1} : {2} : ", b.AttributeType, b.Value, b.Threshold);
                    string rawData = BitConverter.ToString(b.VendorData.Reverse().ToArray()).Replace("-", string.Empty);
                    Console.Write("{0}, {1}", rawData, int.Parse(rawData, NumberStyles.HexNumber));
                    Console.WriteLine();
                }
            }

            searcher = new ManagementObjectSearcher("root\\WMI", "SELECT * FROM MSStorageDriver_FailurePredictStatus");
            foreach (ManagementObject queryObj in searcher.Get())
            {
                var arrVendorSpecific = (bool) queryObj.GetPropertyValue("PredictFailure");
                Console.Write("IsOK: {0}", !arrVendorSpecific);
            }
        }
 public SmartChart(SmartData pData)
 {
     Data        = pData;
     Data.Parent = this;
     SetupTouch();
     IsVisible = true;
 }
        private void Reload()
        {
            Stopwatch stp = new Stopwatch();
            stp.Start();

            //var client = new SmartServiceClient();
            var smartData = new SmartData()
            {
                RobotName = "HI",
                DisplayDictionary = new Dictionary<string, string>()
            };
            if (SmartData == null)
                SmartData = smartData;
            else if (smartData != SmartData)
            {
                foreach (var pair in smartData.DisplayDictionary)
                {
                    var x = SmartData.DisplayDictionary[pair.Key];
                    if (x == null)
                    {
                        SmartData.DisplayDictionary.Add(pair.Key, pair.Value);
                    }
                    else
                        x = pair.Value;
                }
            }

            Console.WriteLine($"Time Per Reload Call: {stp.Elapsed:g}");
        }
예제 #5
0
        public SmartModel()
        {
            SMARTData = new ObservableCollection<SmartRow>();

            using (var searcher = new ManagementObjectSearcher("root\\WMI", "SELECT * FROM MSStorageDriver_ATAPISmartData"))
            {
                using (var thresSearcher = new ManagementObjectSearcher("root\\WMI", "SELECT * FROM MSStorageDriver_FailurePredictThresholds"))
                {
                    var searcherEnumerator = searcher.Get().GetEnumerator();
                    var thresSearcherEnumerator = thresSearcher.Get().GetEnumerator();

                    while (searcherEnumerator.MoveNext() && thresSearcherEnumerator.MoveNext())
                    {
                        byte[] arrVendorSpecific = (byte[])searcherEnumerator.Current.GetPropertyValue("VendorSpecific");
                        byte[] arrThreshold = (byte[])thresSearcherEnumerator.Current.GetPropertyValue("VendorSpecific");

                        /* Create SMART data from 'vendor specific' array */
                        var d = new SmartData(arrVendorSpecific, arrThreshold);
                        foreach (var b in d.Attributes)
                        {
                            string rawData = BitConverter.ToString(b.VendorData.Reverse().ToArray()).Replace("-", string.Empty);
                            SMARTData.Add(new SmartRow(b.AttributeType.ToString(),
                                                       b.Value.ToString(CultureInfo.InvariantCulture),
                                                       b.Threshold.ToString(CultureInfo.InvariantCulture),
                                                       rawData,
                                                       int.Parse(rawData, NumberStyles.HexNumber).ToString(CultureInfo.InvariantCulture)));
                        }
                    }
                }
            }

            using (ManagementObjectSearcher searcher = new ManagementObjectSearcher("root\\WMI", "SELECT * FROM MSStorageDriver_FailurePredictStatus"))
            {
                foreach (ManagementObject queryObj in searcher.Get())
                {
                    SMARTStatus += (bool)queryObj.GetPropertyValue("PredictFailure") ? "WARNING " : "OK ";
                }
            }
        }
예제 #6
0
        public SmartModel()
        {
            SMARTData = new ObservableCollection <SmartRow>();

            using (var searcher = new ManagementObjectSearcher("root\\WMI", "SELECT * FROM MSStorageDriver_ATAPISmartData"))
            {
                using (var thresSearcher = new ManagementObjectSearcher("root\\WMI", "SELECT * FROM MSStorageDriver_FailurePredictThresholds"))
                {
                    var searcherEnumerator      = searcher.Get().GetEnumerator();
                    var thresSearcherEnumerator = thresSearcher.Get().GetEnumerator();

                    while (searcherEnumerator.MoveNext() && thresSearcherEnumerator.MoveNext())
                    {
                        byte[] arrVendorSpecific = (byte[])searcherEnumerator.Current.GetPropertyValue("VendorSpecific");
                        byte[] arrThreshold      = (byte[])thresSearcherEnumerator.Current.GetPropertyValue("VendorSpecific");

                        /* Create SMART data from 'vendor specific' array */
                        var d = new SmartData(arrVendorSpecific, arrThreshold);
                        foreach (var b in d.Attributes)
                        {
                            string rawData = BitConverter.ToString(b.VendorData.Reverse().ToArray()).Replace("-", string.Empty);
                            SMARTData.Add(new SmartRow(b.AttributeType.ToString(),
                                                       b.Value.ToString(CultureInfo.InvariantCulture),
                                                       b.Threshold.ToString(CultureInfo.InvariantCulture),
                                                       rawData,
                                                       int.Parse(rawData, NumberStyles.HexNumber).ToString(CultureInfo.InvariantCulture)));
                        }
                    }
                }
            }

            using (ManagementObjectSearcher searcher = new ManagementObjectSearcher("root\\WMI", "SELECT * FROM MSStorageDriver_FailurePredictStatus"))
            {
                foreach (ManagementObject queryObj in searcher.Get())
                {
                    SMARTStatus += (bool)queryObj.GetPropertyValue("PredictFailure") ? "WARNING " : "OK ";
                }
            }
        }
예제 #7
0
        public List <DriveInformation> GetDriveInformation()
        {
            var q          = new WqlObjectQuery("SELECT * FROM Win32_DiskDrive");
            var res        = new ManagementObjectSearcher(q);
            var driveNames = (from ManagementBaseObject o in res.Get() select o["Model"]?.ToString()).ToList();
            var driveList  = new List <DriveInformation>();
            var drives     = DriveInfo.GetDrives();

            for (var index = 0; index < drives.Length; index++)
            {
                try
                {
                    var drive     = drives[index];
                    var driveInfo = new DriveInformation();
                    if (!drive.IsReady)
                    {
                        continue;
                    }
                    driveInfo.Model         = driveNames.ElementAtOrDefault(index) != null ? driveNames[index] : "Unknown Model";
                    driveInfo.Name          = drive.Name;
                    driveInfo.FreeSpace     = drive.TotalFreeSpace;
                    driveInfo.TotalSize     = drive.TotalSize;
                    driveInfo.DriveType     = drive.DriveType.ToString();
                    driveInfo.DriveFormat   = drive.DriveFormat;
                    driveInfo.VolumeLabel   = drive.VolumeLabel;
                    driveInfo.RootDirectory = drive.RootDirectory.ToString();
                    driveInfo.IsReady       = drive.IsReady;
                    //just set it for now
                    driveInfo.SmartData  = new List <SmartModel>();
                    driveInfo.Partitions = new List <PartitionModel>();
                    driveList.Add(driveInfo);
                    try
                    {
                        var mosDisks =
                            new ManagementObjectSearcher("SELECT * FROM Win32_DiskDrive WHERE Model = '" +
                                                         driveInfo.Model + "'").Get().GetEnumerator();
                        if (!mosDisks.MoveNext())
                        {
                            continue;
                        }
                        driveInfo.MediaType = mosDisks.Current.GetPropertyValue("MediaType")?.ToString() ?? "Unknown";
                        driveInfo.Serial    = mosDisks.Current.GetPropertyValue("SerialNumber")?.ToString()?.Trim() ??
                                              "Unknown";
                        driveInfo.Interface = mosDisks.Current.GetPropertyValue("InterfaceType")?.ToString() ??
                                              "Unknown";
                        driveInfo.TotalPartitions = mosDisks.Current.GetPropertyValue("Partitions")?.ToString() ??
                                                    "Unknown";
                        driveInfo.Signature = mosDisks.Current.GetPropertyValue("Signature")?.ToString() ?? "Unknown";
                        driveInfo.Firmware  = mosDisks.Current.GetPropertyValue("FirmwareRevision")?.ToString() ??
                                              "Unknown";
                        driveInfo.Cylinders = mosDisks.Current.GetPropertyValue("TotalCylinders")?.ToString() ??
                                              "Unknown";
                        driveInfo.Sectors        = mosDisks.Current.GetPropertyValue("TotalSectors")?.ToString() ?? "Unknown";
                        driveInfo.Heads          = mosDisks.Current.GetPropertyValue("TotalHeads")?.ToString() ?? "Unknown";
                        driveInfo.Tracks         = mosDisks.Current.GetPropertyValue("TotalTracks")?.ToString() ?? "Unknown";
                        driveInfo.BytesPerSecond = mosDisks.Current.GetPropertyValue("BytesPerSector")?.ToString() ??
                                                   "Unknown";
                        driveInfo.SectorsPerTrack = mosDisks.Current.GetPropertyValue("SectorsPerTrack")?.ToString() ??
                                                    "Unknown";
                        driveInfo.TracksPerCylinder =
                            mosDisks.Current.GetPropertyValue("TracksPerCylinder")?.ToString() ?? "Unknown";
                    }
                    catch (Exception ex)
                    {
                        // Console.WriteLine(ex.Message);
                        //Console.WriteLine(ex.StackTrace);
                    }

                    try
                    {
                        var mosPartition =
                            new ManagementObjectSearcher("SELECT * FROM Win32_DiskPartition WHERE DiskIndex = '" +
                                                         index + "'").Get().GetEnumerator();
                        while (mosPartition.MoveNext())
                        {
                            var partion = new PartitionModel
                            {
                                Name           = mosPartition.Current.GetPropertyValue("Name")?.ToString() ?? "Unknown",
                                Size           = mosPartition.Current.GetPropertyValue("Size")?.ToString() ?? "Unknown",
                                BlockSize      = mosPartition.Current.GetPropertyValue("BlockSize")?.ToString() ?? "Unknown",
                                StartingOffset =
                                    mosPartition.Current.GetPropertyValue("StartingOffset")?.ToString() ?? "Unknown",
                                Index         = mosPartition.Current.GetPropertyValue("Index")?.ToString() ?? "Unknown",
                                DiskIndex     = mosPartition.Current.GetPropertyValue("DiskIndex")?.ToString() ?? "Unknown",
                                BootPartition =
                                    mosPartition.Current.GetPropertyValue("BootPartition")?.ToString() ?? "Unknown",
                                PrimaryPartition =
                                    mosPartition.Current.GetPropertyValue("PrimaryPartition")?.ToString() ?? "Unknown",
                                Bootable = mosPartition.Current.GetPropertyValue("Bootable")?.ToString() ?? "Unknown"
                            };
                            driveInfo.Partitions.Add(partion);
                        }
                    }
                    catch (Exception ex)
                    {
                        // Console.WriteLine(ex.Message);
                        //Console.WriteLine(ex.StackTrace);
                    }
                }
                catch (Exception ex)
                {
                    // Console.WriteLine(ex.Message);
                    // Console.WriteLine(ex.StackTrace);
                }
            }

            using (
                var searcher = new ManagementObjectSearcher("root\\WMI", "SELECT * FROM MSStorageDriver_ATAPISmartData")
                )
                using (
                    var thresSearcher = new ManagementObjectSearcher("root\\WMI",
                                                                     "SELECT * FROM MSStorageDriver_FailurePredictThresholds"))
                    using (
                        var failureSearch = new ManagementObjectSearcher("root\\WMI",
                                                                         "SELECT * FROM MSStorageDriver_FailurePredictStatus"))
                    {
                        try
                        {
                            var searcherEnumerator      = searcher.Get().GetEnumerator();
                            var thresSearcherEnumerator = thresSearcher.Get().GetEnumerator();
                            var failureSearchEnumerator = failureSearch.Get().GetEnumerator();

                            var index = 0;
                            while (searcherEnumerator.MoveNext() && thresSearcherEnumerator.MoveNext())
                            {
                                var arrVendorSpecific = (byte[])searcherEnumerator.Current.GetPropertyValue("VendorSpecific");
                                var arrThreshold      = (byte[])thresSearcherEnumerator.Current.GetPropertyValue("VendorSpecific");

                                /* Create SMART data from 'vendor specific' array */
                                var d         = new SmartData(arrVendorSpecific, arrThreshold);
                                var smartRows = (from b in d.Attributes
                                                 where !Regex.IsMatch(b.AttributeType.ToString(), @"^\d+$")
                                                 let rawData =
                                                     BitConverter.ToString(b.VendorData.Reverse().ToArray()).Replace("-", string.Empty)
                                                     select
                                                     new SmartModel(b.AttributeType.ToString(),
                                                                    b.Value.ToString(CultureInfo.InvariantCulture),
                                                                    b.Threshold.ToString(CultureInfo.InvariantCulture), rawData,
                                                                    long.Parse(rawData, NumberStyles.HexNumber).ToString(CultureInfo.InvariantCulture)))
                                                .ToList();
                                driveList.ElementAt(index).SmartData = smartRows;
                                if (failureSearchEnumerator.MoveNext())
                                {
                                    driveList.ElementAt(index).DriveHealth =
                                        (bool)failureSearchEnumerator.Current.GetPropertyValue("PredictFailure")
                                    ? "WARNING"
                                    : "OK";
                                }
                                index++;
                            }
                        }
                        catch (Exception ex)
                        {
                            //  Console.WriteLine(ex.Message);
                            //  Console.WriteLine(ex.StackTrace);
                        }
                    }
            return(driveList);
        }
예제 #8
0
        public List<DriveInformation> GetDriveInformation()
        {
            var q = new WqlObjectQuery("SELECT * FROM Win32_DiskDrive");
            var res = new ManagementObjectSearcher(q);
            var driveNames = (from ManagementBaseObject o in res.Get() select o["Model"]?.ToString()).ToList();
            var driveList = new List<DriveInformation>();
            var drives = DriveInfo.GetDrives();
            for (var index = 0; index < drives.Length; index++)
            {
                try
                {
                    var drive = drives[index];
                    var driveInfo = new DriveInformation();
                    if (!drive.IsReady) continue;
                    driveInfo.Model = driveNames.ElementAtOrDefault(index) != null ? driveNames[index] : "Unknown Model";
                    driveInfo.Name = drive.Name;
                    driveInfo.FreeSpace = drive.TotalFreeSpace;
                    driveInfo.TotalSize = drive.TotalSize;
                    driveInfo.DriveType = drive.DriveType.ToString();
                    driveInfo.DriveFormat = drive.DriveFormat;
                    driveInfo.VolumeLabel = drive.VolumeLabel;
                    driveInfo.RootDirectory = drive.RootDirectory.ToString();
                    driveInfo.IsReady = drive.IsReady;
                    //just set it for now
                    driveInfo.SmartData = new List<SmartModel>();
                    driveInfo.Partitions = new List<PartitionModel>();
                    driveList.Add(driveInfo);
                    try
                    {
                        var mosDisks =
                                       new ManagementObjectSearcher("SELECT * FROM Win32_DiskDrive WHERE Model = '" +
                                                                    driveInfo.Model + "'").Get().GetEnumerator();
                        if (!mosDisks.MoveNext()) continue;
                        driveInfo.MediaType = mosDisks.Current.GetPropertyValue("MediaType")?.ToString() ?? "Unknown";
                        driveInfo.Serial = mosDisks.Current.GetPropertyValue("SerialNumber")?.ToString()?.Trim() ?? "Unknown";
                        driveInfo.Interface = mosDisks.Current.GetPropertyValue("InterfaceType")?.ToString() ?? "Unknown";
                        driveInfo.TotalPartitions = mosDisks.Current.GetPropertyValue("Partitions")?.ToString() ?? "Unknown";
                        driveInfo.Signature = mosDisks.Current.GetPropertyValue("Signature")?.ToString() ?? "Unknown";
                        driveInfo.Firmware = mosDisks.Current.GetPropertyValue("FirmwareRevision")?.ToString() ?? "Unknown";
                        driveInfo.Cylinders = mosDisks.Current.GetPropertyValue("TotalCylinders")?.ToString() ?? "Unknown";
                        driveInfo.Sectors = mosDisks.Current.GetPropertyValue("TotalSectors")?.ToString() ?? "Unknown";
                        driveInfo.Heads = mosDisks.Current.GetPropertyValue("TotalHeads")?.ToString() ?? "Unknown";
                        driveInfo.Tracks = mosDisks.Current.GetPropertyValue("TotalTracks")?.ToString() ?? "Unknown";
                        driveInfo.BytesPerSecond = mosDisks.Current.GetPropertyValue("BytesPerSector")?.ToString() ?? "Unknown";
                        driveInfo.SectorsPerTrack = mosDisks.Current.GetPropertyValue("SectorsPerTrack")?.ToString() ?? "Unknown";
                        driveInfo.TracksPerCylinder = mosDisks.Current.GetPropertyValue("TracksPerCylinder")?.ToString() ?? "Unknown";
                    }
                    catch (Exception)
                    {

                       //fail
                    }
                    
                    try
                    {
                        var mosPartition =
                                     new ManagementObjectSearcher("SELECT * FROM Win32_DiskPartition WHERE DiskIndex = '" +
                                                                  index + "'").Get().GetEnumerator();
                        while (mosPartition.MoveNext())
                        {
                            var partion = new PartitionModel
                            {
                                Name = mosPartition.Current.GetPropertyValue("Name")?.ToString() ?? "Unknown",
                                Size = mosPartition.Current.GetPropertyValue("Size")?.ToString() ?? "Unknown",
                                BlockSize = mosPartition.Current.GetPropertyValue("BlockSize")?.ToString() ?? "Unknown",
                                StartingOffset =
                                    mosPartition.Current.GetPropertyValue("StartingOffset")?.ToString() ?? "Unknown",
                                Index = mosPartition.Current.GetPropertyValue("Index")?.ToString() ?? "Unknown",
                                DiskIndex = mosPartition.Current.GetPropertyValue("DiskIndex")?.ToString() ?? "Unknown",
                                BootPartition = mosPartition.Current.GetPropertyValue("BootPartition")?.ToString() ?? "Unknown",
                                PrimaryPartition =
                                    mosPartition.Current.GetPropertyValue("PrimaryPartition")?.ToString() ?? "Unknown",
                                Bootable = mosPartition.Current.GetPropertyValue("Bootable")?.ToString() ?? "Unknown"
                            };
                            driveInfo.Partitions.Add(partion);
                        }
                    }
                    catch (Exception)
                    {

                        //fail
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    Console.WriteLine(ex.StackTrace);
                }
            }

            using (var searcher = new ManagementObjectSearcher("root\\WMI", "SELECT * FROM MSStorageDriver_ATAPISmartData"))
            using (var thresSearcher = new ManagementObjectSearcher("root\\WMI", "SELECT * FROM MSStorageDriver_FailurePredictThresholds"))
            using (var failureSearch = new ManagementObjectSearcher("root\\WMI", "SELECT * FROM MSStorageDriver_FailurePredictStatus"))
            {


                try
                {
                    var searcherEnumerator = searcher.Get().GetEnumerator();
                    var thresSearcherEnumerator = thresSearcher.Get().GetEnumerator();
                    var failureSearchEnumerator = failureSearch.Get().GetEnumerator();

                    var index = 0;
                    while (searcherEnumerator.MoveNext() && thresSearcherEnumerator.MoveNext())
                    {
                        var arrVendorSpecific = (byte[])searcherEnumerator.Current.GetPropertyValue("VendorSpecific");
                        var arrThreshold = (byte[])thresSearcherEnumerator.Current.GetPropertyValue("VendorSpecific");

                        /* Create SMART data from 'vendor specific' array */
                        var d = new SmartData(arrVendorSpecific, arrThreshold);
                        var smartRows = (from b in d.Attributes where !Regex.IsMatch(b.AttributeType.ToString(), @"^\d+$") let rawData = BitConverter.ToString(b.VendorData.Reverse().ToArray()).Replace("-", string.Empty) select new SmartModel(b.AttributeType.ToString(), b.Value.ToString(CultureInfo.InvariantCulture), b.Threshold.ToString(CultureInfo.InvariantCulture), rawData, long.Parse(rawData, NumberStyles.HexNumber).ToString(CultureInfo.InvariantCulture))).ToList();
                        driveList.ElementAt(index).SmartData = smartRows;
                        if (failureSearchEnumerator.MoveNext())
                        {
                            driveList.ElementAt(index).DriveHealth = (bool)failureSearchEnumerator.Current.GetPropertyValue("PredictFailure") ? "WARNING" : "OK";
                        }
                        index++;
                    }
                }
                catch (Exception)
                {

                    //if we fail, do nothing more.
                }
            }
            return driveList;
        }
예제 #9
0
        public static Smart[] ReadSmart()
        {
            Smart[] smart = null;
            try
            {
                var searcher = new ManagementObjectSearcher("root\\WMI", "SELECT * FROM MSStorageDriver_ATAPISmartData");
                smart = new Smart[searcher.Get().Count];
                int count = 0;
                foreach (ManagementObject queryObj in searcher.Get())
                {
                    String pnpid = queryObj.GetPropertyValue("InstanceName").ToString().ToUpper();
                    int PowerCycleCount = 0;
                    int ReadErrorRate = 0;
                    int RealocatedSectors = 0;
                    int PowerOnHours = 0;

                    pnpid = pnpid.Substring(0, pnpid.Length - 2);

                    var arrVendorSpecific = (byte[])queryObj.GetPropertyValue("VendorSpecific");
                    bool diskOK = true;
                    // Create SMART data from 'vendor specific' array
                    var d = new SmartData(arrVendorSpecific);
                    foreach (var b in d.Attributes)
                    {
                        switch (b.AttributeType)
                        {
                            case SmartAttributeType.PowerOnHoursPOH: PowerOnHours = BitConverter.ToInt32(b.VendorData, 0); break;
                            case SmartAttributeType.ReadErrorRate: ReadErrorRate = BitConverter.ToInt32(b.VendorData, 0); break;
                            case SmartAttributeType.PowerCycleCount: PowerCycleCount = BitConverter.ToInt32(b.VendorData, 0); break;
                            case SmartAttributeType.ReallocatedSectorsCount: RealocatedSectors = BitConverter.ToInt32(b.VendorData, 0); break;
                        }
                        diskOK &= !b.FailureImminent;
                    }
                    smart[count] = new Smart(GetDevice(pnpid), GetDeviceName(pnpid), GetDeviceCapacity(pnpid), PowerCycleCount, ReadErrorRate, RealocatedSectors, PowerOnHours, diskOK ? "PASSED" : "FAILED" );
                    count++;
                }
            }
            catch (Exception)
            {

            }

            return smart;
        }