예제 #1
0
    public List <SMART_report> get_smart_report()
    {
        int id         = 0;
        int flags      = 0;
        int value      = 0;
        int worst      = 0;
        var data       = new byte[6];
        var smart_list = new List <SMART_report>();

        for (int hdd_index = 0; hdd_index < pSDK.GetNumberOfHDD(); hdd_index += 1)
        {
            var smart = new SMART_report();
            smart.name       = pSDK.GetHDDName(hdd_index).Trim();
            smart.attributes = new List <Attribute>();
            for (int attrib_index = 0; attrib_index < pSDK.GetHDDNumberOfAttributes(hdd_index); attrib_index += 1)
            {
                bool res = pSDK.GetHDDAttribute(hdd_index, attrib_index, ref id, ref flags, ref value, ref worst, data);
                if (res && smart_names.ContainsKey(attrib_index))
                {
                    var attribute = new Attribute();
                    attribute.name  = smart_names[attrib_index];
                    attribute.id    = id;
                    attribute.flags = flags;
                    attribute.value = value;
                    attribute.worst = worst;
                    smart.attributes.Add(attribute);
                }
            }
            smart_list.Add(smart);
        }
        return(smart_list);
    }