From 4f1b588227068aaad7c67b6f7107559a7e99f06a Mon Sep 17 00:00:00 2001 From: Llewellyn Kruger Date: Sun, 18 Aug 2024 16:33:10 +0200 Subject: [PATCH] #6 Update int to uint to increase range of values --- Smart.Net/Controllers/WmiController.cs | 9 ++++----- Smart.Net/Objects/SmartAttribute.cs | 8 ++++---- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Smart.Net/Controllers/WmiController.cs b/Smart.Net/Controllers/WmiController.cs index f8b766a..8462af6 100644 --- a/Smart.Net/Controllers/WmiController.cs +++ b/Smart.Net/Controllers/WmiController.cs @@ -49,7 +49,6 @@ public static DriveCollection GetSmartInformation() Model = device["Model"]?.ToString().Trim(), Type = device["InterfaceType"]?.ToString().Trim(), Serial = device["SerialNumber"]?.ToString().Trim() - }; #endregion @@ -108,9 +107,9 @@ public static DriveCollection GetSmartInformation() bool failureImminent = (flags & 0x1) == 0x1; //bool onlineDataCollection = (flags & 0x2) == 0x2; - int value = bytes[i * 12 + 5]; - int worst = bytes[i * 12 + 6]; - int vendordata = BitConverter.ToInt32(bytes, i * 12 + 7); + uint value = bytes[i * 12 + 5]; + uint worst = bytes[i * 12 + 6]; + uint vendordata = BitConverter.ToUInt32(bytes, i * 12 + 7); if (id == 0) continue; var attr = drive.SmartAttributes.GetAttribute(id); @@ -140,7 +139,7 @@ public static DriveCollection GetSmartInformation() try { int id = bytes[i * 12 + 2]; - int thresh = bytes[i * 12 + 3]; + uint thresh = bytes[i * 12 + 3]; if (id == 0) continue; var attr = drive.SmartAttributes.GetAttribute(id); diff --git a/Smart.Net/Objects/SmartAttribute.cs b/Smart.Net/Objects/SmartAttribute.cs index 1db15bd..96a6676 100644 --- a/Smart.Net/Objects/SmartAttribute.cs +++ b/Smart.Net/Objects/SmartAttribute.cs @@ -41,10 +41,10 @@ public SmartAttribute(int register, string attributeName) public int Register { get; set; } public string Name { get; set; } - public int Current { get; set; } - public int Worst { get; set; } - public int Threshold { get; set; } - public int Data { get; set; } + public uint Current { get; set; } + public uint Worst { get; set; } + public uint Threshold { get; set; } + public uint Data { get; set; } public bool IsOK { get; set; } public bool HasData