From d70e2ce0e3d362ab6f04d5775c5040d073f6a06c Mon Sep 17 00:00:00 2001 From: Urban Date: Fri, 7 Jul 2023 21:24:51 +0200 Subject: [PATCH 01/42] Version 11.1.0.1 --- Hardware.Info/Hardware.Info.csproj | 4 ++-- README.md | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Hardware.Info/Hardware.Info.csproj b/Hardware.Info/Hardware.Info.csproj index e47aaba..4e53b1d 100644 --- a/Hardware.Info/Hardware.Info.csproj +++ b/Hardware.Info/Hardware.Info.csproj @@ -9,8 +9,8 @@ Hardware.Info Hardware.Info - 11.1.0.0 - 11.1.0.0 + 11.1.0.1 + 11.1.0.1 Jinjinov Battery, BIOS, CPU - processor, storage drive, keyboard, RAM - memory, monitor, motherboard, mouse, NIC - network adapter, printer, sound card - audio card, graphics card - video card. Hardware.Info is a .NET Standard 2.0 library and uses WMI on Windows, /dev, /proc, /sys on Linux and sysctl, system_profiler on macOS. Copyright (c) Jinjinov 2022 diff --git a/README.md b/README.md index 3f54b60..e054bb0 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Battery, BIOS, CPU - processor, storage drive, keyboard, RAM - memory, monitor, 1. Include NuGet package from https://www.nuget.org/packages/Hardware.Info - + 2. Call `RefreshAll()` or one of the other `Refresh*()` methods: @@ -207,6 +207,9 @@ Setting `includeNetworkAdapterConfiguration` to `false` has only a small impact ## Version history: +- 11.1.0.1 + - Fixed `GetNetworkAdapterList` in Linux - thanks to [@Nihlus](https://github.com/Nihlus) + - Fixed `GetCpuList` in Windows - by [@Frooxius](https://github.com/Frooxius) - 11.1.0.0 - Fixed `NetworkAdapter.Speed` in Windows - by [@isenmann](https://github.com/isenmann) - 11.0.1.1 From c528cf0028a9b26fb7d804e1cee30f1640c6a44f Mon Sep 17 00:00:00 2001 From: Urban Date: Sat, 8 Jul 2023 13:29:14 +0200 Subject: [PATCH 02/42] Updated Readme --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index e054bb0..afc6f8e 100644 --- a/README.md +++ b/README.md @@ -136,6 +136,10 @@ You can avoid the 21 second delay by excluding the queries that cause it (see Se Sometimes `NetworkAdapter.Speed` in `Win32_NetworkAdapter` can be `0` or `long.MaxValue`. The correct value can be retrived from `CurrentBandwidth` in `Win32_PerfFormattedData_Tcpip_NetworkAdapter` but unfortunately reading from `Win32_PerfFormattedData_Tcpip_NetworkAdapter` causes a 21 second delay on the first read, like mentioned in the previous paragraph. Calling `RefreshNetworkAdapterList` with `includeBytesPersec = true` will also read the `CurrentBandwidth`. +### `WmiNetUtilsHelper` will throw an exception in Windows if publish settings use `true` + +This is a known error: https://github.com/dotnet/core/issues/7051#issuecomment-1071484354 + ## Settings ### Constructor settings: From d37cfc071c7c17e3298b2e939620fd3154c0dee9 Mon Sep 17 00:00:00 2001 From: Urban Date: Tue, 11 Jul 2023 22:28:10 +0200 Subject: [PATCH 03/42] Update issue templates --- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 7213bcd..bec7e5b 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -9,7 +9,7 @@ assignees: '' ### Library version -### OS & OS version +### OS, version, architecture (32 bit / 64 bit) ### Describe the bug MIT + True + HardwareInfo.snk diff --git a/Hardware.Info/HardwareInfo.snk b/Hardware.Info/HardwareInfo.snk new file mode 100644 index 0000000000000000000000000000000000000000..23136f911d07100321bdc5b1ab736bcaa85d4db4 GIT binary patch literal 596 zcmV-a0;~N80ssI2Bme+XQ$aES1ONa50098`%DOvMOgxq^*jqOuXaY3V^~x%~#CkMZ zBI)rSTD!KyfXA~?Y#m8AG6ifypPTNVdFb@keCELrPNA=P>W`q?iVOpyv=#B)+uVaiMP&UW%g zIBc2Vl4g3;RZZwGYqGacD>qx2{}W^*K%ALN5O=u?6z|it8R+b`*F~DUQ4l--k`-$W z0P4^E)4Km+AXD+SL3Q?sezF4o=$Gbo<2 z=R;2#Q6o)1V%%H^licoj0R*1?z&4U)ia^!*ABssy*yZNm-$qD^X5fGnF}Efj5@a|j zk6AHvycVAAiUVAwsQf>_2Z4{AIeUx&3TbfPum(_s#Uztie($RiCL5cU1f^T@={m@1 zihNwDZFq;-fcBDi82|1|Z-HyQ?Ei;MSD+Ip#e^0B=0e2(8Y`sim$YwE;8OCGLGP`$ z%vZreb%u09a947C14#EFV3ilvC@zj0!EIXWh3EVrEmbZgDVjpeQ)awueL+b^8~etv ivbZ&{gFv%9P*AnyhHnqsok}HKaZyb}`>v0pKradm{}}oJ literal 0 HcmV?d00001 diff --git a/README.md b/README.md index 61aa4a0..810a5b9 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Battery, BIOS, CPU - processor, storage drive, keyboard, RAM - memory, monitor, 1. Include NuGet package from https://www.nuget.org/packages/Hardware.Info - + 2. Call `RefreshAll()` or one of the other `Refresh*()` methods: @@ -211,6 +211,8 @@ Setting `includeNetworkAdapterConfiguration` to `false` has only a small impact ## Version history: +- 100.0.0.1 + - Added `HardwareInfo.snk` to sign the assembly with a strong name key - 100.0.0.0 - Fixed `GetCpuList` in Linux - thanks to [@inelisoni](https://github.com/inelisoni) - 11.1.1.1 From a9372d199f307194ccbefff414d2e6be118e4edb Mon Sep 17 00:00:00 2001 From: Urban Date: Fri, 8 Dec 2023 21:00:17 +0100 Subject: [PATCH 21/42] Version 100.0.1.0 --- Hardware.Info/Linux/HardwareInfoRetrieval.cs | 44 ++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/Hardware.Info/Linux/HardwareInfoRetrieval.cs b/Hardware.Info/Linux/HardwareInfoRetrieval.cs index 39336ff..7951a95 100644 --- a/Hardware.Info/Linux/HardwareInfoRetrieval.cs +++ b/Hardware.Info/Linux/HardwareInfoRetrieval.cs @@ -480,6 +480,27 @@ public override List GetDriveList() { disk.Manufacturer = trimmed.Replace("vendor:", string.Empty).Trim(); } + else if (trimmed.StartsWith("description:")) + { + disk.Description = trimmed.Replace("description:", string.Empty).Trim(); + } + else if (trimmed.StartsWith("version:")) + { + disk.FirmwareRevision = trimmed.Replace("version:", string.Empty).Trim(); + } + else if (trimmed.StartsWith("logical name:")) + { + disk.Name = trimmed.Replace("logical name:", string.Empty).Trim(); + } + else if (trimmed.StartsWith("serial:")) + { + disk.SerialNumber = trimmed.Replace("serial:", string.Empty).Trim(); + } + else if (trimmed.StartsWith("size:")) + { + string size = trimmed.Replace("size:", string.Empty).Trim(); + disk.Size = ExtractSizeInBytes(size); + } } } @@ -489,6 +510,29 @@ public override List GetDriveList() } return driveList; + + static ulong ExtractSizeInBytes(string input) + { + Regex regex = new Regex(@"(\d+)\s*(KB|MB|GB|TB)"); + Match match = regex.Match(input); + + if (match.Success) + { + if (ulong.TryParse(match.Groups[1].Value, out ulong size)) + { + return match.Groups[2].Value switch + { + "KB" => size * 1024UL, + "MB" => size * 1024UL * 1024UL, + "GB" => size * 1024UL * 1024UL * 1024UL, + "TB" => size * 1024UL * 1024UL * 1024UL * 1024UL, + _ => size, + }; + } + } + + return 0; + } } public List GetKeyboardList() From b934f9663db6caf31983a06acef410a559d13ac2 Mon Sep 17 00:00:00 2001 From: Urban Date: Fri, 8 Dec 2023 22:53:03 +0100 Subject: [PATCH 22/42] Version 100.0.1.0 --- Hardware.Info/Hardware.Info.csproj | 4 ++-- README.md | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Hardware.Info/Hardware.Info.csproj b/Hardware.Info/Hardware.Info.csproj index 00c8568..c8e8056 100644 --- a/Hardware.Info/Hardware.Info.csproj +++ b/Hardware.Info/Hardware.Info.csproj @@ -9,8 +9,8 @@ Hardware.Info Hardware.Info - 100.0.0.1 - 100.0.0.1 + 100.0.1.0 + 100.0.1.0 Jinjinov Battery, BIOS, CPU - processor, storage drive, keyboard, RAM - memory, monitor, motherboard, mouse, NIC - network adapter, printer, sound card - audio card, graphics card - video card. Hardware.Info is a .NET Standard 2.0 library and uses WMI on Windows, /dev, /proc, /sys on Linux and sysctl, system_profiler on macOS. Copyright (c) Jinjinov 2022 diff --git a/README.md b/README.md index 810a5b9..569c92b 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Battery, BIOS, CPU - processor, storage drive, keyboard, RAM - memory, monitor, 1. Include NuGet package from https://www.nuget.org/packages/Hardware.Info - + 2. Call `RefreshAll()` or one of the other `Refresh*()` methods: @@ -211,6 +211,12 @@ Setting `includeNetworkAdapterConfiguration` to `false` has only a small impact ## Version history: +- 100.0.1.0 + - Added `Disk.Description` in Linux + - Added `Disk.FirmwareRevision` in Linux + - Added `Disk.Name` in Linux + - Added `Disk.SerialNumber` in Linux + - Added `Disk.Size` in Linux - 100.0.0.1 - Added `HardwareInfo.snk` to sign the assembly with a strong name key - 100.0.0.0 From 732b59b11d8d204a6c7fab2527ca683b57f5072d Mon Sep 17 00:00:00 2001 From: Urban Date: Fri, 8 Dec 2023 22:57:52 +0100 Subject: [PATCH 23/42] Version 100.0.1.0 --- Hardware.Info.Benchmark/Hardware.Info.Benchmark.csproj | 6 +++--- Hardware.Info.Test/Hardware.Info.Test.csproj | 4 ++-- Hardware.Info/Hardware.Info.csproj | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Hardware.Info.Benchmark/Hardware.Info.Benchmark.csproj b/Hardware.Info.Benchmark/Hardware.Info.Benchmark.csproj index ccb00f8..84d2466 100644 --- a/Hardware.Info.Benchmark/Hardware.Info.Benchmark.csproj +++ b/Hardware.Info.Benchmark/Hardware.Info.Benchmark.csproj @@ -2,13 +2,13 @@ Exe - net7.0 - 10.0 + net8.0 + 12.0 enable - + diff --git a/Hardware.Info.Test/Hardware.Info.Test.csproj b/Hardware.Info.Test/Hardware.Info.Test.csproj index 459369f..56e8a63 100644 --- a/Hardware.Info.Test/Hardware.Info.Test.csproj +++ b/Hardware.Info.Test/Hardware.Info.Test.csproj @@ -2,8 +2,8 @@ Exe - net7.0 - 10.0 + net8.0 + 12.0 enable diff --git a/Hardware.Info/Hardware.Info.csproj b/Hardware.Info/Hardware.Info.csproj index c8e8056..73fbac6 100644 --- a/Hardware.Info/Hardware.Info.csproj +++ b/Hardware.Info/Hardware.Info.csproj @@ -35,8 +35,8 @@ - - + + From 5e34147bbcc68c3a12c79692645610e8362c63d7 Mon Sep 17 00:00:00 2001 From: Andreas Eriksson Date: Fri, 5 Jan 2024 12:01:46 +0100 Subject: [PATCH 24/42] Generate documentation when building so that it is included in nuget package. --- Hardware.Info/Hardware.Info.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/Hardware.Info/Hardware.Info.csproj b/Hardware.Info/Hardware.Info.csproj index 73fbac6..724fbf1 100644 --- a/Hardware.Info/Hardware.Info.csproj +++ b/Hardware.Info/Hardware.Info.csproj @@ -24,6 +24,7 @@ MIT True HardwareInfo.snk + true From 346d6e62ab1b9fd60d412cd6bc0621c638489b15 Mon Sep 17 00:00:00 2001 From: Urban Date: Fri, 5 Jan 2024 16:47:58 +0100 Subject: [PATCH 25/42] Version 100.0.1.1 --- Hardware.Info.Test/Edid.cs | 33 ++++++++++--------- Hardware.Info/Linux/HardwareInfoRetrieval.cs | 34 ++++++++++---------- 2 files changed, 35 insertions(+), 32 deletions(-) diff --git a/Hardware.Info.Test/Edid.cs b/Hardware.Info.Test/Edid.cs index ad88701..9856dfe 100644 --- a/Hardware.Info.Test/Edid.cs +++ b/Hardware.Info.Test/Edid.cs @@ -103,26 +103,29 @@ static void EDID() static void Monitor() { - string resolution = null; - string refreshRate = null; - string edidFile = null; + string? resolution = null; + string? refreshRate = null; + string? edidFile = null; // Get the display resolution and refresh rate using xrandr - var xrandrProcess = Process.Start(new ProcessStartInfo + Process? xrandrProcess = Process.Start(new ProcessStartInfo { FileName = "xrandr", RedirectStandardOutput = true, UseShellExecute = false }); + if (xrandrProcess == null) + return; + while (!xrandrProcess.StandardOutput.EndOfStream) { - string line = xrandrProcess.StandardOutput.ReadLine(); + string? line = xrandrProcess.StandardOutput.ReadLine(); - if (line.Contains("*")) + if (line?.Contains('*') == true) { - resolution = line.Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries)[0]; - refreshRate = line.Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries)[1]; + resolution = line.Split(" ", StringSplitOptions.RemoveEmptyEntries)[0]; + refreshRate = line.Split(" ", StringSplitOptions.RemoveEmptyEntries)[1]; break; } } @@ -131,12 +134,12 @@ static void Monitor() Console.WriteLine($"Monitor refreshRate: {refreshRate}"); // Look up the EDID file based on the display configuration - var drmDirectory = new DirectoryInfo("/sys/class/drm"); - foreach (var cardDirectory in drmDirectory.GetDirectories("card*")) + DirectoryInfo drmDirectory = new("/sys/class/drm"); + foreach (DirectoryInfo cardDirectory in drmDirectory.GetDirectories("card*")) { - foreach (var connectorDirectory in cardDirectory.GetDirectories("card*")) + foreach (DirectoryInfo connectorDirectory in cardDirectory.GetDirectories("card*")) { - var edidPath = Path.Combine(connectorDirectory.FullName, "edid"); + string edidPath = Path.Combine(connectorDirectory.FullName, "edid"); if (File.Exists(edidPath)) { @@ -154,11 +157,11 @@ static void Monitor() // Read the EDID file and extract the manufacturer and model information if (edidFile != null) { - var edidBytes = File.ReadAllBytes(edidFile); + byte[] edidBytes = File.ReadAllBytes(edidFile); if (edidBytes.Length > 0) { - var manufacturerCode = BitConverter.ToUInt16(edidBytes, 0x08); - var modelCode = BitConverter.ToUInt16(edidBytes, 0x0a); + ushort manufacturerCode = BitConverter.ToUInt16(edidBytes, 0x08); + ushort modelCode = BitConverter.ToUInt16(edidBytes, 0x0a); } } } diff --git a/Hardware.Info/Linux/HardwareInfoRetrieval.cs b/Hardware.Info/Linux/HardwareInfoRetrieval.cs index 7951a95..67b80ee 100644 --- a/Hardware.Info/Linux/HardwareInfoRetrieval.cs +++ b/Hardware.Info/Linux/HardwareInfoRetrieval.cs @@ -280,25 +280,25 @@ public List GetCpuList(bool includePercentProcessorTime = true) foreach (var group in processorList.GroupBy(processor => processor.PhysicalId)) { - CPU cpu = new CPU(); - - cpu.PercentProcessorTime = percentProcessorTime; - - cpu.ProcessorId = group.Key.ToString(); - Processor first = group.First(); - cpu.Manufacturer = first.VendorId; - cpu.Name = first.ModelName; - cpu.CurrentClockSpeed = first.CpuMhz; - //cpu.L2CacheSize = first.CacheSize; - cpu.NumberOfLogicalProcessors = first.Siblings; - cpu.NumberOfCores = first.CpuCores; - - cpu.L1DataCacheSize = first.L1DataCacheSize; - cpu.L1InstructionCacheSize = first.L1InstructionCacheSize; - cpu.L2CacheSize = first.L2CacheSize; - cpu.L3CacheSize = first.L3CacheSize; + CPU cpu = new CPU + { + PercentProcessorTime = percentProcessorTime, + ProcessorId = group.Key.ToString(), + Manufacturer = first.VendorId, + Name = first.ModelName, + CurrentClockSpeed = first.CpuMhz, + NumberOfLogicalProcessors = first.Siblings, + NumberOfCores = first.CpuCores, + L1DataCacheSize = first.L1DataCacheSize, + L1InstructionCacheSize = first.L1InstructionCacheSize, + L2CacheSize = first.L2CacheSize, + L3CacheSize = first.L3CacheSize + }; + + if (cpu.L2CacheSize == 0) + cpu.L2CacheSize = first.CacheSize; foreach (Processor proc in group) { From 91818ebd995475a907145765c50276adec8000bb Mon Sep 17 00:00:00 2001 From: Urban Date: Fri, 5 Jan 2024 18:59:02 +0100 Subject: [PATCH 26/42] Version 100.0.1.1 --- Hardware.Info/Components/BIOS.cs | 4 + Hardware.Info/Components/Battery.cs | 7 + Hardware.Info/Components/CPU.cs | 7 + Hardware.Info/Components/CpuCore.cs | 4 + Hardware.Info/Components/Drive.cs | 18 +++ Hardware.Info/Components/Keyboard.cs | 4 + Hardware.Info/Components/Memory.cs | 4 + Hardware.Info/Components/MemoryStatus.cs | 7 + Hardware.Info/Components/Monitor.cs | 4 + Hardware.Info/Components/Motherboard.cs | 4 + Hardware.Info/Components/Mouse.cs | 4 + Hardware.Info/Components/NetworkAdapter.cs | 4 + Hardware.Info/Components/OS.cs | 4 + Hardware.Info/Components/Printer.cs | 4 + Hardware.Info/Components/SoundDevice.cs | 4 + Hardware.Info/Components/VideoController.cs | 4 + Hardware.Info/HardwareInfo.cs | 155 ++++++++++++++++++++ Hardware.Info/IHardwareInfo.cs | 125 ++++++++++++++++ 18 files changed, 367 insertions(+) diff --git a/Hardware.Info/Components/BIOS.cs b/Hardware.Info/Components/BIOS.cs index 3b38b08..6d698ae 100644 --- a/Hardware.Info/Components/BIOS.cs +++ b/Hardware.Info/Components/BIOS.cs @@ -49,6 +49,10 @@ public class BIOS /// public string Version { get; set; } = string.Empty; + /// + /// Write all property values to a string + /// + /// Each property on a new line public override string ToString() { return diff --git a/Hardware.Info/Components/Battery.cs b/Hardware.Info/Components/Battery.cs index 84c331d..b545633 100644 --- a/Hardware.Info/Components/Battery.cs +++ b/Hardware.Info/Components/Battery.cs @@ -61,6 +61,9 @@ public class Battery private string _batteryStatusDescription = string.Empty; + /// + /// Battery status description + /// public string BatteryStatusDescription { get => !string.IsNullOrEmpty(_batteryStatusDescription) ? _batteryStatusDescription : BatteryStatus switch @@ -82,6 +85,10 @@ public string BatteryStatusDescription set => _batteryStatusDescription = value; } + /// + /// Write all property values to a string + /// + /// Each property on a new line public override string ToString() { return diff --git a/Hardware.Info/Components/CPU.cs b/Hardware.Info/Components/CPU.cs index f4288a4..dfdc274 100644 --- a/Hardware.Info/Components/CPU.cs +++ b/Hardware.Info/Components/CPU.cs @@ -111,8 +111,15 @@ public class CPU /// public UInt64 PercentProcessorTime { get; set; } + /// + /// List of + /// public List CpuCoreList { get; set; } = new List(); + /// + /// Write all property values to a string + /// + /// Each property on a new line public override string ToString() { return diff --git a/Hardware.Info/Components/CpuCore.cs b/Hardware.Info/Components/CpuCore.cs index cf6de89..0a19d48 100644 --- a/Hardware.Info/Components/CpuCore.cs +++ b/Hardware.Info/Components/CpuCore.cs @@ -23,6 +23,10 @@ public class CpuCore /// public UInt64 PercentProcessorTime { get; set; } + /// + /// Write all property values to a string + /// + /// Each property on a new line public override string ToString() { return diff --git a/Hardware.Info/Components/Drive.cs b/Hardware.Info/Components/Drive.cs index 1ccf972..cccdb96 100644 --- a/Hardware.Info/Components/Drive.cs +++ b/Hardware.Info/Components/Drive.cs @@ -56,6 +56,10 @@ public class Volume /// public string VolumeSerialNumber { get; set; } = string.Empty; + /// + /// Write all property values to a string + /// + /// Each property on a new line public override string ToString() { return @@ -78,6 +82,9 @@ public override string ToString() /// public class Partition { + /// + /// List of + /// public List VolumeList { get; set; } = new List(); /// @@ -131,6 +138,10 @@ public class Partition /// public UInt64 StartingOffset { get; set; } + /// + /// Write all property values to a string + /// + /// Each property on a new line public override string ToString() { return @@ -154,6 +165,9 @@ public override string ToString() /// public class Drive { + /// + /// List of + /// public List PartitionList { get; set; } = new List(); /// @@ -206,6 +220,10 @@ public class Drive /// public UInt64 Size { get; set; } + /// + /// Write all property values to a string + /// + /// Each property on a new line public override string ToString() { return diff --git a/Hardware.Info/Components/Keyboard.cs b/Hardware.Info/Components/Keyboard.cs index 8915f12..70ae67c 100644 --- a/Hardware.Info/Components/Keyboard.cs +++ b/Hardware.Info/Components/Keyboard.cs @@ -29,6 +29,10 @@ public class Keyboard /// public UInt16 NumberOfFunctionKeys { get; set; } + /// + /// Write all property values to a string + /// + /// Each property on a new line public override string ToString() { return diff --git a/Hardware.Info/Components/Memory.cs b/Hardware.Info/Components/Memory.cs index 29d0940..a92a6e9 100644 --- a/Hardware.Info/Components/Memory.cs +++ b/Hardware.Info/Components/Memory.cs @@ -85,6 +85,10 @@ public class Memory /// public UInt32 Speed { get; set; } + /// + /// Write all property values to a string + /// + /// Each property on a new line public override string ToString() { return diff --git a/Hardware.Info/Components/MemoryStatus.cs b/Hardware.Info/Components/MemoryStatus.cs index affed62..86ddd96 100644 --- a/Hardware.Info/Components/MemoryStatus.cs +++ b/Hardware.Info/Components/MemoryStatus.cs @@ -4,6 +4,9 @@ namespace Hardware.Info { + /// + /// Memory status + /// public class MemoryStatus { /// @@ -45,6 +48,10 @@ public class MemoryStatus /// public ulong AvailableExtendedVirtual { get; set; } + /// + /// Write all property values to a string + /// + /// Each property on a new line public override string ToString() { return diff --git a/Hardware.Info/Components/Monitor.cs b/Hardware.Info/Components/Monitor.cs index 7bd074d..6128f40 100644 --- a/Hardware.Info/Components/Monitor.cs +++ b/Hardware.Info/Components/Monitor.cs @@ -80,6 +80,10 @@ public class Monitor /// public UInt16 YearOfManufacture { get; set; } + /// + /// Write all property values to a string + /// + /// Each property on a new line public override string ToString() { return diff --git a/Hardware.Info/Components/Motherboard.cs b/Hardware.Info/Components/Motherboard.cs index 4ab2384..5b7c2e3 100644 --- a/Hardware.Info/Components/Motherboard.cs +++ b/Hardware.Info/Components/Motherboard.cs @@ -24,6 +24,10 @@ public class Motherboard /// public string SerialNumber { get; set; } = string.Empty; + /// + /// Write all property values to a string + /// + /// Each property on a new line public override string ToString() { return diff --git a/Hardware.Info/Components/Mouse.cs b/Hardware.Info/Components/Mouse.cs index a0610d6..21bdfb4 100644 --- a/Hardware.Info/Components/Mouse.cs +++ b/Hardware.Info/Components/Mouse.cs @@ -34,6 +34,10 @@ public class Mouse /// public byte NumberOfButtons { get; set; } + /// + /// Write all property values to a string + /// + /// Each property on a new line public override string ToString() { return diff --git a/Hardware.Info/Components/NetworkAdapter.cs b/Hardware.Info/Components/NetworkAdapter.cs index 44ec95a..bcca6e1 100644 --- a/Hardware.Info/Components/NetworkAdapter.cs +++ b/Hardware.Info/Components/NetworkAdapter.cs @@ -98,6 +98,10 @@ public class NetworkAdapter /// public List IPSubnetList { get; set; } = new List(); + /// + /// Write all property values to a string + /// + /// Each property on a new line public override string ToString() { return diff --git a/Hardware.Info/Components/OS.cs b/Hardware.Info/Components/OS.cs index 89f44f1..bec42e8 100644 --- a/Hardware.Info/Components/OS.cs +++ b/Hardware.Info/Components/OS.cs @@ -22,6 +22,10 @@ public class OS /// public Version Version { get; set; } = new Version(); + /// + /// Write all property values to a string + /// + /// Each property on a new line public override string ToString() { return diff --git a/Hardware.Info/Components/Printer.cs b/Hardware.Info/Components/Printer.cs index dec1c52..ef1baf8 100644 --- a/Hardware.Info/Components/Printer.cs +++ b/Hardware.Info/Components/Printer.cs @@ -56,6 +56,10 @@ public class Printer /// public UInt32 VerticalResolution { get; set; } + /// + /// Write all property values to a string + /// + /// Each property on a new line public override string ToString() { return diff --git a/Hardware.Info/Components/SoundDevice.cs b/Hardware.Info/Components/SoundDevice.cs index 02aa08a..b57ea87 100644 --- a/Hardware.Info/Components/SoundDevice.cs +++ b/Hardware.Info/Components/SoundDevice.cs @@ -34,6 +34,10 @@ public class SoundDevice /// public string ProductName { get; set; } = string.Empty; + /// + /// Write all property values to a string + /// + /// Each property on a new line public override string ToString() { return diff --git a/Hardware.Info/Components/VideoController.cs b/Hardware.Info/Components/VideoController.cs index 8ec3050..909286c 100644 --- a/Hardware.Info/Components/VideoController.cs +++ b/Hardware.Info/Components/VideoController.cs @@ -90,6 +90,10 @@ public class VideoController /// public string VideoProcessor { get; set; } = string.Empty; + /// + /// Write all property values to a string + /// + /// Each property on a new line public override string ToString() { return diff --git a/Hardware.Info/HardwareInfo.cs b/Hardware.Info/HardwareInfo.cs index bf9c9e5..44dc440 100644 --- a/Hardware.Info/HardwareInfo.cs +++ b/Hardware.Info/HardwareInfo.cs @@ -8,27 +8,93 @@ namespace Hardware.Info { + /// + /// Main Hardware.Info class + /// public class HardwareInfo : IHardwareInfo { + /// + /// Operating system + /// public OS OperatingSystem { get; private set; } = new OS(); + + /// + /// Memory status + /// public MemoryStatus MemoryStatus { get; private set; } = new MemoryStatus(); + /// + /// List of + /// public List BatteryList { get; private set; } = new List(); + + /// + /// List of + /// public List BiosList { get; private set; } = new List(); + + /// + /// List of + /// public List CpuList { get; private set; } = new List(); + + /// + /// List of + /// public List DriveList { get; private set; } = new List(); + + /// + /// List of + /// public List KeyboardList { get; private set; } = new List(); + + /// + /// List of + /// public List MemoryList { get; private set; } = new List(); + + /// + /// List of + /// public List MonitorList { get; private set; } = new List(); + + /// + /// List of + /// public List MotherboardList { get; private set; } = new List(); + + /// + /// List of + /// public List MouseList { get; private set; } = new List(); + + /// + /// List of + /// public List NetworkAdapterList { get; private set; } = new List(); + + /// + /// List of + /// public List PrinterList { get; private set; } = new List(); + + /// + /// List of + /// public List SoundDeviceList { get; private set; } = new List(); + + /// + /// List of + /// public List VideoControllerList { get; private set; } = new List(); private readonly IHardwareInfoRetrieval _hardwareInfoRetrieval = null!; + /// + /// Main Hardware.Info class + /// + /// causes WMI queries to use SELECT * FROM instead of SELECT with a list of property names + /// sets the Timeout property of the EnumerationOptions in the ManagementObjectSearcher that executes the query. The default value is EnumerationOptions.InfiniteTimeout public HardwareInfo(bool useAsteriskInWMI = true, TimeSpan? timeoutInWMI = null) { if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) // Environment.OSVersion.Platform == PlatformID.Win32NT) @@ -47,6 +113,9 @@ public HardwareInfo(bool useAsteriskInWMI = true, TimeSpan? timeoutInWMI = null) } } + /// + /// Refresh all hardware info + /// public void RefreshAll() { RefreshOperatingSystem(); @@ -67,21 +136,82 @@ public void RefreshAll() RefreshVideoControllerList(); } + /// + /// Refresh operating system info + /// public void RefreshOperatingSystem() => OperatingSystem = _hardwareInfoRetrieval.GetOperatingSystem(); + + /// + /// Refresh memory status info + /// public void RefreshMemoryStatus() => MemoryStatus = _hardwareInfoRetrieval.GetMemoryStatus(); + /// + /// Refresh battery info + /// public void RefreshBatteryList() => BatteryList = _hardwareInfoRetrieval.GetBatteryList(); + + /// + /// Refresh BIOS info + /// public void RefreshBIOSList() => BiosList = _hardwareInfoRetrieval.GetBiosList(); + + /// + /// Refresh CPU info + /// + /// Include PercentProcessorTime info. This makes the method a bit slower. public void RefreshCPUList(bool includePercentProcessorTime = true) => CpuList = _hardwareInfoRetrieval.GetCpuList(includePercentProcessorTime); + + /// + /// Refresh drive info + /// public void RefreshDriveList() => DriveList = _hardwareInfoRetrieval.GetDriveList(); + + /// + /// Refresh keyboard info + /// public void RefreshKeyboardList() => KeyboardList = _hardwareInfoRetrieval.GetKeyboardList(); + + /// + /// Refresh memory info + /// public void RefreshMemoryList() => MemoryList = _hardwareInfoRetrieval.GetMemoryList(); + + /// + /// Refresh monitor info + /// public void RefreshMonitorList() => MonitorList = _hardwareInfoRetrieval.GetMonitorList(); + + /// + /// Refresh motherboard info + /// public void RefreshMotherboardList() => MotherboardList = _hardwareInfoRetrieval.GetMotherboardList(); + + /// + /// Refresh mouse info + /// public void RefreshMouseList() => MouseList = _hardwareInfoRetrieval.GetMouseList(); + + /// + /// Refresh network adapter info + /// + /// Include BytesPerSec info. This makes the method a bit slower. + /// Include NetworkAdapterConfiguration info. This makes the method a bit slower. public void RefreshNetworkAdapterList(bool includeBytesPerSec = true, bool includeNetworkAdapterConfiguration = true) => NetworkAdapterList = _hardwareInfoRetrieval.GetNetworkAdapterList(includeBytesPerSec, includeNetworkAdapterConfiguration); + + /// + /// Refresh printer info + /// public void RefreshPrinterList() => PrinterList = _hardwareInfoRetrieval.GetPrinterList(); + + /// + /// Refresh sound device info + /// public void RefreshSoundDeviceList() => SoundDeviceList = _hardwareInfoRetrieval.GetSoundDeviceList(); + + /// + /// Refresh video controller info + /// public void RefreshVideoControllerList() => VideoControllerList = _hardwareInfoRetrieval.GetVideoControllerList(); #region Static @@ -89,6 +219,11 @@ public void RefreshAll() private static bool _pingInProgress; private static Action? _onPingComplete; + /// + /// Ping + /// + /// Host name or address to ping + /// On ping complete callback with "bool success" parameter public static void Ping(string hostNameOrAddress, Action onPingComplete) { if (_pingInProgress) @@ -132,6 +267,10 @@ private static void PingCompleted(object sender, PingCompletedEventArgs e) _onPingComplete?.Invoke(success); } + /// + /// Get local IPv4 addresses + /// + /// Local IPv4 addresses public static IEnumerable GetLocalIPv4Addresses() { if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) @@ -147,6 +286,11 @@ public static IEnumerable GetLocalIPv4Addresses() } } + /// + /// Get local IPv4 addresses + /// + /// Filter by NetworkInterfaceType + /// Local IPv4 addresses public static IEnumerable GetLocalIPv4Addresses(NetworkInterfaceType networkInterfaceType) { return NetworkInterface.GetAllNetworkInterfaces() @@ -156,6 +300,11 @@ public static IEnumerable GetLocalIPv4Addresses(NetworkInterfaceType .Select(addressInformation => addressInformation.Address); } + /// + /// Get local IPv4 addresses + /// + /// Filter by OperationalStatus + /// Local IPv4 addresses public static IEnumerable GetLocalIPv4Addresses(OperationalStatus operationalStatus) { return NetworkInterface.GetAllNetworkInterfaces() @@ -165,6 +314,12 @@ public static IEnumerable GetLocalIPv4Addresses(OperationalStatus ope .Select(addressInformation => addressInformation.Address); } + /// + /// Get local IPv4 addresses + /// + /// Filter by NetworkInterfaceType + /// Filter by OperationalStatus + /// Local IPv4 addresses public static IEnumerable GetLocalIPv4Addresses(NetworkInterfaceType networkInterfaceType, OperationalStatus operationalStatus) { return NetworkInterface.GetAllNetworkInterfaces() diff --git a/Hardware.Info/IHardwareInfo.cs b/Hardware.Info/IHardwareInfo.cs index cba9470..da33232 100644 --- a/Hardware.Info/IHardwareInfo.cs +++ b/Hardware.Info/IHardwareInfo.cs @@ -2,42 +2,167 @@ namespace Hardware.Info { + /// + /// Main Hardware.Info interface + /// public interface IHardwareInfo { + /// + /// Operating system + /// OS OperatingSystem { get; } + + /// + /// Memory status + /// MemoryStatus MemoryStatus { get; } + /// + /// List of + /// List BatteryList { get; } + + /// + /// List of + /// List BiosList { get; } + + /// + /// List of + /// List CpuList { get; } + + /// + /// List of + /// List DriveList { get; } + + /// + /// List of + /// List KeyboardList { get; } + + /// + /// List of + /// List MemoryList { get; } + + /// + /// List of + /// List MonitorList { get; } + + /// + /// List of + /// List MotherboardList { get; } + + /// + /// List of + /// List MouseList { get; } + + /// + /// List of + /// List NetworkAdapterList { get; } + + /// + /// List of + /// List PrinterList { get; } + + /// + /// List of + /// List SoundDeviceList { get; } + + /// + /// List of + /// List VideoControllerList { get; } + /// + /// Refresh all hardware info + /// void RefreshAll(); + /// + /// Refresh operating system info + /// void RefreshOperatingSystem(); + + /// + /// Refresh memory status info + /// void RefreshMemoryStatus(); + /// + /// Refresh battery info + /// void RefreshBatteryList(); + + /// + /// Refresh BIOS info + /// void RefreshBIOSList(); + + /// + /// Refresh CPU info + /// + /// Include PercentProcessorTime info. This makes the method a bit slower. void RefreshCPUList(bool includePercentProcessorTime = true); + + /// + /// Refresh drive info + /// void RefreshDriveList(); + + /// + /// Refresh keyboard info + /// void RefreshKeyboardList(); + + /// + /// Refresh memory info + /// void RefreshMemoryList(); + + /// + /// Refresh monitor info + /// void RefreshMonitorList(); + + /// + /// Refresh motherboard info + /// void RefreshMotherboardList(); + + /// + /// Refresh mouse info + /// void RefreshMouseList(); + + /// + /// Refresh network adapter info + /// + /// Include BytesPerSec info. This makes the method a bit slower. + /// Include NetworkAdapterConfiguration info. This makes the method a bit slower. void RefreshNetworkAdapterList(bool includeBytesPerSec = true, bool includeNetworkAdapterConfiguration = true); + + /// + /// Refresh printer info + /// void RefreshPrinterList(); + + /// + /// Refresh sound device info + /// void RefreshSoundDeviceList(); + + /// + /// Refresh video controller info + /// void RefreshVideoControllerList(); } } \ No newline at end of file From 8ed57f9969b9d4ae1352624a24e0ec5f4944ac4b Mon Sep 17 00:00:00 2001 From: Urban Date: Fri, 5 Jan 2024 19:08:43 +0100 Subject: [PATCH 27/42] Version 100.0.1.1 --- Hardware.Info/Components/Memory.cs | 95 ++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) diff --git a/Hardware.Info/Components/Memory.cs b/Hardware.Info/Components/Memory.cs index a92a6e9..7065964 100644 --- a/Hardware.Info/Components/Memory.cs +++ b/Hardware.Info/Components/Memory.cs @@ -9,29 +9,124 @@ namespace Hardware.Info /// public enum FormFactor { + /// + /// Represents an unknown or unspecified form factor. + /// UNKNOWN = 0, + + /// + /// Represents a form factor that is categorized as "OTHER," not falling into specific predefined categories. + /// OTHER = 1, + + /// + /// Represents a Single In-line Package (SIP) form factor. + /// SIP = 2, + + /// + /// Represents a Dual In-line Package (DIP) form factor. + /// DIP = 3, + + /// + /// Represents a Zigzag In-line Package (ZIP) form factor. + /// ZIP = 4, + + /// + /// Represents a Small Outline J-lead (SOJ) form factor. + /// SOJ = 5, + + /// + /// Represents a form factor that is proprietary and not covered by other specific categories. + /// PROPRIETARY = 6, + + /// + /// Represents a Single Inline Memory Module (SIMM) form factor. + /// SIMM = 7, + + /// + /// Represents a Dual Inline Memory Module (DIMM) form factor. + /// DIMM = 8, + + /// + /// Represents a Thin Small Outline Package (TSOP) form factor. + /// TSOP = 9, + + /// + /// Represents a Pin Grid Array (PGA) form factor. + /// PGA = 10, + + /// + /// Represents a Rambus Inline Memory Module (RIMM) form factor. + /// RIMM = 11, + + /// + /// Represents a Small Outline Dual In-line Memory Module (SODIMM) form factor. + /// SODIMM = 12, + + /// + /// Represents a Static Random-Access Memory Inline Memory Module (SRIMM) form factor. + /// SRIMM = 13, + + /// + /// Represents a Surface Mount Device (SMD) form factor. + /// SMD = 14, + + /// + /// Represents a Shrink Small-Outline Package (SSMP) form factor. + /// SSMP = 15, + + /// + /// Represents a Quad Flat Package (QFP) form factor. + /// QFP = 16, + + /// + /// Represents a Thin Quad Flat Package (TQFP) form factor. + /// TQFP = 17, + + /// + /// Represents a Small Outline Integrated Circuit (SOIC) form factor. + /// SOIC = 18, + + /// + /// Represents a Leadless Chip Carrier (LCC) form factor. + /// LCC = 19, + + /// + /// Represents a Plastic Leaded Chip Carrier (PLCC) form factor. + /// PLCC = 20, + + /// + /// Represents a Ball Grid Array (BGA) form factor. + /// BGA = 21, + + /// + /// Represents a Fine-Pitch Ball Grid Array (FPBGA) form factor. + /// FPBGA = 22, + + /// + /// Represents a Land Grid Array (LGA) form factor. + /// LGA = 23 } From 7c5ada64857ad5a5ff44072a7d8838ea691b722b Mon Sep 17 00:00:00 2001 From: Urban Date: Fri, 5 Jan 2024 19:23:06 +0100 Subject: [PATCH 28/42] Version 100.0.1.1 --- Hardware.Info/Hardware.Info.csproj | 4 ++-- README.md | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Hardware.Info/Hardware.Info.csproj b/Hardware.Info/Hardware.Info.csproj index 724fbf1..a973088 100644 --- a/Hardware.Info/Hardware.Info.csproj +++ b/Hardware.Info/Hardware.Info.csproj @@ -9,8 +9,8 @@ Hardware.Info Hardware.Info - 100.0.1.0 - 100.0.1.0 + 100.0.1.1 + 100.0.1.1 Jinjinov Battery, BIOS, CPU - processor, storage drive, keyboard, RAM - memory, monitor, motherboard, mouse, NIC - network adapter, printer, sound card - audio card, graphics card - video card. Hardware.Info is a .NET Standard 2.0 library and uses WMI on Windows, /dev, /proc, /sys on Linux and sysctl, system_profiler on macOS. Copyright (c) Jinjinov 2022 diff --git a/README.md b/README.md index 569c92b..2a2b855 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Battery, BIOS, CPU - processor, storage drive, keyboard, RAM - memory, monitor, 1. Include NuGet package from https://www.nuget.org/packages/Hardware.Info - + 2. Call `RefreshAll()` or one of the other `Refresh*()` methods: @@ -211,6 +211,8 @@ Setting `includeNetworkAdapterConfiguration` to `false` has only a small impact ## Version history: +- 100.0.1.1 + - Added XML documentation - thanks to [@andreas-eriksson](https://github.com/andreas-eriksson) - 100.0.1.0 - Added `Disk.Description` in Linux - Added `Disk.FirmwareRevision` in Linux From 93778b75865f2d0e378ecb4136f1ba3c54e4aeee Mon Sep 17 00:00:00 2001 From: Andreas Eriksson Date: Sat, 13 Jan 2024 20:06:55 +0100 Subject: [PATCH 29/42] Add Source Link. --- Hardware.Info/Hardware.Info.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Hardware.Info/Hardware.Info.csproj b/Hardware.Info/Hardware.Info.csproj index a973088..b4f1576 100644 --- a/Hardware.Info/Hardware.Info.csproj +++ b/Hardware.Info/Hardware.Info.csproj @@ -17,14 +17,13 @@ https://github.com/Jinjinov/Hardware.Info README.md - https://github.com/Jinjinov/Hardware.Info.git - git Computer;Device;Hardware;Info;Information;NET Standard;Windows;Linux;macOS MIT True HardwareInfo.snk true + true @@ -38,6 +37,7 @@ + From e9287564728dca7bfd1bf0933326863e9f9af92c Mon Sep 17 00:00:00 2001 From: Urban Date: Sat, 20 Jan 2024 11:52:27 +0100 Subject: [PATCH 30/42] Version 100.1.0.0 --- README.md | 66 ++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 41 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 2a2b855..e34c257 100644 --- a/README.md +++ b/README.md @@ -14,27 +14,36 @@ Battery, BIOS, CPU - processor, storage drive, keyboard, RAM - memory, monitor, class Program { - static readonly IHardwareInfo hardwareInfo = new HardwareInfo(); + static IHardwareInfo hardwareInfo; static void Main(string[] _) { - //hardwareInfo.RefreshOperatingSystem(); - //hardwareInfo.RefreshMemoryStatus(); - //hardwareInfo.RefreshBatteryList(); - //hardwareInfo.RefreshBIOSList(); - //hardwareInfo.RefreshCPUList(); - //hardwareInfo.RefreshDriveList(); - //hardwareInfo.RefreshKeyboardList(); - //hardwareInfo.RefreshMemoryList(); - //hardwareInfo.RefreshMonitorList(); - //hardwareInfo.RefreshMotherboardList(); - //hardwareInfo.RefreshMouseList(); - //hardwareInfo.RefreshNetworkAdapterList(); - //hardwareInfo.RefreshPrinterList(); - //hardwareInfo.RefreshSoundDeviceList(); - //hardwareInfo.RefreshVideoControllerList(); - - hardwareInfo.RefreshAll(); + try + { + hardwareInfo = new HardwareInfo(); + + //hardwareInfo.RefreshOperatingSystem(); + //hardwareInfo.RefreshMemoryStatus(); + //hardwareInfo.RefreshBatteryList(); + //hardwareInfo.RefreshBIOSList(); + //hardwareInfo.RefreshCPUList(); + //hardwareInfo.RefreshDriveList(); + //hardwareInfo.RefreshKeyboardList(); + //hardwareInfo.RefreshMemoryList(); + //hardwareInfo.RefreshMonitorList(); + //hardwareInfo.RefreshMotherboardList(); + //hardwareInfo.RefreshMouseList(); + //hardwareInfo.RefreshNetworkAdapterList(); + //hardwareInfo.RefreshPrinterList(); + //hardwareInfo.RefreshSoundDeviceList(); + //hardwareInfo.RefreshVideoControllerList(); + + hardwareInfo.RefreshAll(); + } + catch (Exception ex) + { + Console.WriteLine(ex); + } Console.WriteLine(hardwareInfo.OperatingSystem); @@ -54,8 +63,6 @@ Battery, BIOS, CPU - processor, storage drive, keyboard, RAM - memory, monitor, Console.WriteLine(cpuCore); } - Console.ReadLine(); - foreach (var drive in hardwareInfo.DriveList) { Console.WriteLine(drive); @@ -69,8 +76,6 @@ Battery, BIOS, CPU - processor, storage drive, keyboard, RAM - memory, monitor, } } - Console.ReadLine(); - foreach (var hardware in hardwareInfo.KeyboardList) Console.WriteLine(hardware); @@ -98,8 +103,6 @@ Battery, BIOS, CPU - processor, storage drive, keyboard, RAM - memory, monitor, foreach (var hardware in hardwareInfo.VideoControllerList) Console.WriteLine(hardware); - Console.ReadLine(); - foreach (var address in HardwareInfo.GetLocalIPv4Addresses(NetworkInterfaceType.Ethernet, OperationalStatus.Up)) Console.WriteLine(address); @@ -150,7 +153,20 @@ HardwareInfo(bool useAsteriskInWMI = true, TimeSpan? timeoutInWMI = null) The construcotr accepts two settings for WMI: - `useAsteriskInWMI` causes WMI queries to use `SELECT * FROM` instead of `SELECT` with a list of property names. This is slower, but safer, more compatible with older Windows (XP, Vista, 7, 8) where a certain WMI property might be missing and throw an exception when queried by name. The default value is `true`. -- `timeoutInWMI` sets the `Timeout` property of the `EnumerationOptions` in the `ManagementObjectSearcher` that executes the query. The default value is `EnumerationOptions.InfiniteTimeout`. Changing this could cause the query to return empty results in certain cases. +- `timeoutInWMI` sets the `Timeout` property of the `EnumerationOptions` in the `ManagementObjectSearcher` that executes each query. The default value is `EnumerationOptions.InfiniteTimeout`. There are one or more queries for each hardware component, so there are more than 16 queries executed on `RefreshAll()`. If a query reaches the timeout it will throw a `System.Management.ManagementException` exception where `ErrorCode` will be `System.Management.ManagementStatus.Timedout`. If you set the `timeoutInWMI` then use a `try-catch` block like this: + + IHardwareInfo hardwareInfo; + + try + { + hardwareInfo = new HardwareInfo(timeoutInWMI: TimeSpan.FromMilliseconds(100)); + + hardwareInfo.RefreshAll(); + } + catch (ManagementException ex) when (ex.ErrorCode == ManagementStatus.Timedout) + { + Console.WriteLine(ex); + } ### Refresh methods settings: From 130b450d6e15472e70c2a8514efc591e99937b59 Mon Sep 17 00:00:00 2001 From: Jinjinov Date: Sat, 2 Mar 2024 12:07:28 +0100 Subject: [PATCH 31/42] Version 100.1.0.0 --- Hardware.Info/HardwareInfoBase.cs | 27 ++++++++++++-------- Hardware.Info/Linux/HardwareInfoRetrieval.cs | 22 ++++++---------- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/Hardware.Info/HardwareInfoBase.cs b/Hardware.Info/HardwareInfoBase.cs index e0b6c16..08536fe 100644 --- a/Hardware.Info/HardwareInfoBase.cs +++ b/Hardware.Info/HardwareInfoBase.cs @@ -89,18 +89,25 @@ public virtual List GetDriveList() foreach (DriveInfo driveInfo in DriveInfo.GetDrives()) { - Volume volume = new Volume + try + { + Volume volume = new Volume + { + FileSystem = driveInfo.DriveFormat, + Description = driveInfo.DriveType.ToString(), + Name = driveInfo.Name, + Caption = driveInfo.RootDirectory.FullName, + FreeSpace = (ulong)driveInfo.TotalFreeSpace, + Size = (ulong)driveInfo.TotalSize, + VolumeName = driveInfo.VolumeLabel + }; + + partition.VolumeList.Add(volume); + } + catch(UnauthorizedAccessException) { - FileSystem = driveInfo.DriveFormat, - Description = driveInfo.DriveType.ToString(), - Name = driveInfo.Name, - Caption = driveInfo.RootDirectory.FullName, - FreeSpace = (ulong)driveInfo.TotalFreeSpace, - Size = (ulong)driveInfo.TotalSize, - VolumeName = driveInfo.VolumeLabel - }; - partition.VolumeList.Add(volume); + } } drive.PartitionList.Add(partition); diff --git a/Hardware.Info/Linux/HardwareInfoRetrieval.cs b/Hardware.Info/Linux/HardwareInfoRetrieval.cs index 67b80ee..52fe2a6 100644 --- a/Hardware.Info/Linux/HardwareInfoRetrieval.cs +++ b/Hardware.Info/Linux/HardwareInfoRetrieval.cs @@ -442,7 +442,7 @@ private static UInt64 GetCpuPercentage(string cpuStatLast, string cpuStatNow) public override List GetDriveList() { - List driveList = new List(); + List driveList = base.GetDriveList(); string processOutput = ReadProcessOutput("lshw", "-class disk"); @@ -454,19 +454,18 @@ public override List GetDriveList() { string trimmed = line.Trim(); - if (trimmed.StartsWith("*-")) + if (trimmed.StartsWith("*-cdrom") || trimmed.StartsWith("*-disk")) { - if (disk != null) + if(driveList.Count > 0 && disk == null && trimmed.StartsWith("*-disk")) + { + disk = driveList.First(); + } + else { + disk = new Drive(); driveList.Add(disk); } - disk = null; - } - - if (trimmed.StartsWith("*-cdrom") || trimmed.StartsWith("*-disk")) - { - disk = new Drive(); continue; } @@ -504,11 +503,6 @@ public override List GetDriveList() } } - if (disk != null) - { - driveList.Add(disk); - } - return driveList; static ulong ExtractSizeInBytes(string input) From 3e97cc04bce131c24b1e5a3910e9f5a51af7e746 Mon Sep 17 00:00:00 2001 From: Urban Date: Sat, 2 Mar 2024 15:32:59 +0100 Subject: [PATCH 32/42] Version 100.1.0.0 --- Hardware.Info/Hardware.Info.csproj | 4 ++-- Hardware.Info/HardwareInfoBase.cs | 3 +-- README.md | 5 ++++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Hardware.Info/Hardware.Info.csproj b/Hardware.Info/Hardware.Info.csproj index b4f1576..37c5cb0 100644 --- a/Hardware.Info/Hardware.Info.csproj +++ b/Hardware.Info/Hardware.Info.csproj @@ -9,8 +9,8 @@ Hardware.Info Hardware.Info - 100.0.1.1 - 100.0.1.1 + 100.1.0.0 + 100.1.0.0 Jinjinov Battery, BIOS, CPU - processor, storage drive, keyboard, RAM - memory, monitor, motherboard, mouse, NIC - network adapter, printer, sound card - audio card, graphics card - video card. Hardware.Info is a .NET Standard 2.0 library and uses WMI on Windows, /dev, /proc, /sys on Linux and sysctl, system_profiler on macOS. Copyright (c) Jinjinov 2022 diff --git a/Hardware.Info/HardwareInfoBase.cs b/Hardware.Info/HardwareInfoBase.cs index 08536fe..95cd1da 100644 --- a/Hardware.Info/HardwareInfoBase.cs +++ b/Hardware.Info/HardwareInfoBase.cs @@ -104,9 +104,8 @@ public virtual List GetDriveList() partition.VolumeList.Add(volume); } - catch(UnauthorizedAccessException) + catch (UnauthorizedAccessException) { - } } diff --git a/README.md b/README.md index e34c257..f232dd8 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Battery, BIOS, CPU - processor, storage drive, keyboard, RAM - memory, monitor, 1. Include NuGet package from https://www.nuget.org/packages/Hardware.Info - + 2. Call `RefreshAll()` or one of the other `Refresh*()` methods: @@ -227,6 +227,9 @@ Setting `includeNetworkAdapterConfiguration` to `false` has only a small impact ## Version history: +- 100.1.0.0 + - Fixed `GetDriveList` in Linux - thanks to [@GusanoGris](https://github.com/GusanoGris) + - Added `Microsoft.SourceLink.GitHub` - by [@andreas-eriksson](https://github.com/andreas-eriksson) - 100.0.1.1 - Added XML documentation - thanks to [@andreas-eriksson](https://github.com/andreas-eriksson) - 100.0.1.0 From e793fb17b3585ea5f5e7cd6becfe7b2bc4c7b62f Mon Sep 17 00:00:00 2001 From: Urban Date: Fri, 5 Jul 2024 11:46:59 +0200 Subject: [PATCH 33/42] Version 100.1.0.1 --- Hardware.Info/Hardware.Info.csproj | 4 ++-- Hardware.Info/Linux/HardwareInfoRetrieval.cs | 2 +- README.md | 4 +++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Hardware.Info/Hardware.Info.csproj b/Hardware.Info/Hardware.Info.csproj index 37c5cb0..869ae29 100644 --- a/Hardware.Info/Hardware.Info.csproj +++ b/Hardware.Info/Hardware.Info.csproj @@ -9,8 +9,8 @@ Hardware.Info Hardware.Info - 100.1.0.0 - 100.1.0.0 + 100.1.0.1 + 100.1.0.1 Jinjinov Battery, BIOS, CPU - processor, storage drive, keyboard, RAM - memory, monitor, motherboard, mouse, NIC - network adapter, printer, sound card - audio card, graphics card - video card. Hardware.Info is a .NET Standard 2.0 library and uses WMI on Windows, /dev, /proc, /sys on Linux and sysctl, system_profiler on macOS. Copyright (c) Jinjinov 2022 diff --git a/Hardware.Info/Linux/HardwareInfoRetrieval.cs b/Hardware.Info/Linux/HardwareInfoRetrieval.cs index 52fe2a6..8e5acbc 100644 --- a/Hardware.Info/Linux/HardwareInfoRetrieval.cs +++ b/Hardware.Info/Linux/HardwareInfoRetrieval.cs @@ -1161,7 +1161,7 @@ 1680x1050 59.88 lines = processOutput.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries); - foreach (string line in lines.Where(l => l.Contains("VGA compatible controller"))) + foreach (string line in lines.Where(l => l.Contains("VGA compatible controller") || l.Contains("3D controller") || l.Contains("Display controller"))) { string[] split = line.Split(':'); diff --git a/README.md b/README.md index f232dd8..0c92614 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Battery, BIOS, CPU - processor, storage drive, keyboard, RAM - memory, monitor, 1. Include NuGet package from https://www.nuget.org/packages/Hardware.Info - + 2. Call `RefreshAll()` or one of the other `Refresh*()` methods: @@ -227,6 +227,8 @@ Setting `includeNetworkAdapterConfiguration` to `false` has only a small impact ## Version history: +- 100.1.0.1 + - Fixed `GetVideoControllerList` in Linux - thanks to [@NogginBops](https://github.com/NogginBops) - 100.1.0.0 - Fixed `GetDriveList` in Linux - thanks to [@GusanoGris](https://github.com/GusanoGris) - Added `Microsoft.SourceLink.GitHub` - by [@andreas-eriksson](https://github.com/andreas-eriksson) From b96fd170d61d3a9cb9948654d03dd65c8b404064 Mon Sep 17 00:00:00 2001 From: Urban Date: Wed, 28 Aug 2024 20:44:53 +0200 Subject: [PATCH 34/42] Version 100.1.1.0 --- Hardware.Info.Benchmark/Program.cs | 2 + Hardware.Info.Test/Program.cs | 4 ++ Hardware.Info/Components/ComputerSystem.cs | 69 +++++++++++++++++++ Hardware.Info/HardwareInfo.cs | 11 +++ Hardware.Info/IHardwareInfo.cs | 10 +++ Hardware.Info/IHardwareInfoRetrieval.cs | 1 + Hardware.Info/Linux/HardwareInfoRetrieval.cs | 11 +++ Hardware.Info/Mac/HardwareInfoRetrieval.cs | 11 +++ .../Windows/HardwareInfoRetrieval.cs | 28 ++++++++ README.md | 4 ++ 10 files changed, 151 insertions(+) create mode 100644 Hardware.Info/Components/ComputerSystem.cs diff --git a/Hardware.Info.Benchmark/Program.cs b/Hardware.Info.Benchmark/Program.cs index 35dc671..0d5f136 100644 --- a/Hardware.Info.Benchmark/Program.cs +++ b/Hardware.Info.Benchmark/Program.cs @@ -16,6 +16,8 @@ public class Benchmarks [Benchmark] public void RefreshBIOSList() => _hardwareInfo.RefreshBIOSList(); [Benchmark] + public void RefreshComputerSystemList() => _hardwareInfo.RefreshComputerSystemList(); + [Benchmark] public void RefreshCPUList() => _hardwareInfo.RefreshCPUList(); [Benchmark] public void RefreshDriveList() => _hardwareInfo.RefreshDriveList(); diff --git a/Hardware.Info.Test/Program.cs b/Hardware.Info.Test/Program.cs index 8242a51..d574b89 100644 --- a/Hardware.Info.Test/Program.cs +++ b/Hardware.Info.Test/Program.cs @@ -20,6 +20,7 @@ static void Test(bool test) hardwareInfo.RefreshMemoryStatus(); hardwareInfo.RefreshBatteryList(); hardwareInfo.RefreshBIOSList(); + hardwareInfo.RefreshComputerSystemList(); hardwareInfo.RefreshCPUList(includePercentProcessorTime: test); hardwareInfo.RefreshDriveList(); hardwareInfo.RefreshKeyboardList(); @@ -44,6 +45,9 @@ static void Test(bool test) foreach (var hardware in hardwareInfo.BiosList) Console.WriteLine(hardware); + foreach (var hardware in hardwareInfo.ComputerSystemList) + Console.WriteLine(hardware); + foreach (var cpu in hardwareInfo.CpuList) { Console.WriteLine(cpu); diff --git a/Hardware.Info/Components/ComputerSystem.cs b/Hardware.Info/Components/ComputerSystem.cs new file mode 100644 index 0000000..7026162 --- /dev/null +++ b/Hardware.Info/Components/ComputerSystem.cs @@ -0,0 +1,69 @@ +using System; + +// https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-computersystemproduct + +namespace Hardware.Info +{ + /// + /// WMI class: Win32_ComputerSystemProduct + /// + public class ComputerSystem + { + /// + /// Short textual description for the product. + /// + public string Caption { get; set; } = string.Empty; + + /// + /// Textual description of the product. + /// + public string Description { get; set; } = string.Empty; + + /// + /// Product identification, such as a serial number on software, a die number on a hardware chip, or (for noncommercial products) a project number. + /// + public string IdentifyingNumber { get; set; } = string.Empty; + + /// + /// Commonly used product name. + /// + public string Name { get; set; } = string.Empty; + + /// + /// Product's stock-keeping unit (SKU) information. + /// + public string SKUNumber { get; set; } = string.Empty; + + /// + /// Universally unique identifier (UUID) for this product. A UUID is a 128-bit identifier that is guaranteed to be different from other generated UUIDs. If a UUID is not available, a UUID of all zeros is used. + /// + public string UUID { get; set; } = string.Empty; + + /// + /// Name of the product's supplier, or the entity selling the product (the manufacturer, reseller, OEM, and so on). + /// + public string Vendor { get; set; } = string.Empty; + + /// + /// Product version information. + /// + public string Version { get; set; } = string.Empty; + + /// + /// Write all property values to a string + /// + /// Each property on a new line + public override string ToString() + { + return + "Caption: " + Caption + Environment.NewLine + + "Description: " + Description + Environment.NewLine + + "IdentifyingNumber: " + IdentifyingNumber + Environment.NewLine + + "Name: " + Name + Environment.NewLine + + "SKUNumber: " + SKUNumber + Environment.NewLine + + "UUID: " + UUID + Environment.NewLine + + "Vendor: " + Vendor + Environment.NewLine + + "Version: " + Version + Environment.NewLine; + } + } +} \ No newline at end of file diff --git a/Hardware.Info/HardwareInfo.cs b/Hardware.Info/HardwareInfo.cs index 44dc440..f0f2c52 100644 --- a/Hardware.Info/HardwareInfo.cs +++ b/Hardware.Info/HardwareInfo.cs @@ -33,6 +33,11 @@ public class HardwareInfo : IHardwareInfo /// public List BiosList { get; private set; } = new List(); + /// + /// List of + /// + public List ComputerSystemList { get; private set; } = new List(); + /// /// List of /// @@ -123,6 +128,7 @@ public void RefreshAll() RefreshBatteryList(); RefreshBIOSList(); + RefreshComputerSystemList(); RefreshCPUList(); RefreshDriveList(); RefreshKeyboardList(); @@ -156,6 +162,11 @@ public void RefreshAll() /// public void RefreshBIOSList() => BiosList = _hardwareInfoRetrieval.GetBiosList(); + /// + /// Refresh computer system info + /// + public void RefreshComputerSystemList() => ComputerSystemList = _hardwareInfoRetrieval.GetComputerSystemList(); + /// /// Refresh CPU info /// diff --git a/Hardware.Info/IHardwareInfo.cs b/Hardware.Info/IHardwareInfo.cs index da33232..229b054 100644 --- a/Hardware.Info/IHardwareInfo.cs +++ b/Hardware.Info/IHardwareInfo.cs @@ -27,6 +27,11 @@ public interface IHardwareInfo /// List BiosList { get; } + /// + /// List of + /// + List ComputerSystemList { get; } + /// /// List of /// @@ -107,6 +112,11 @@ public interface IHardwareInfo /// void RefreshBIOSList(); + /// + /// Refresh computer system info + /// + void RefreshComputerSystemList(); + /// /// Refresh CPU info /// diff --git a/Hardware.Info/IHardwareInfoRetrieval.cs b/Hardware.Info/IHardwareInfoRetrieval.cs index b71e604..bae4121 100644 --- a/Hardware.Info/IHardwareInfoRetrieval.cs +++ b/Hardware.Info/IHardwareInfoRetrieval.cs @@ -9,6 +9,7 @@ internal interface IHardwareInfoRetrieval List GetBatteryList(); List GetBiosList(); + List GetComputerSystemList(); List GetCpuList(bool includePercentProcessorTime = true); List GetDriveList(); List GetKeyboardList(); diff --git a/Hardware.Info/Linux/HardwareInfoRetrieval.cs b/Hardware.Info/Linux/HardwareInfoRetrieval.cs index 8e5acbc..ae5caa2 100644 --- a/Hardware.Info/Linux/HardwareInfoRetrieval.cs +++ b/Hardware.Info/Linux/HardwareInfoRetrieval.cs @@ -145,6 +145,17 @@ public List GetBiosList() return biosList; } + public List GetComputerSystemList() + { + List computerSystemList = new List(); + + ComputerSystem computerSystem = new ComputerSystem(); + + computerSystemList.Add(computerSystem); + + return computerSystemList; + } + private class Processor { public string ProcessorId = string.Empty; diff --git a/Hardware.Info/Mac/HardwareInfoRetrieval.cs b/Hardware.Info/Mac/HardwareInfoRetrieval.cs index 0e38500..6b7f7d7 100644 --- a/Hardware.Info/Mac/HardwareInfoRetrieval.cs +++ b/Hardware.Info/Mac/HardwareInfoRetrieval.cs @@ -326,6 +326,17 @@ public List GetBiosList() return biosList; } + public List GetComputerSystemList() + { + List computerSystemList = new List(); + + ComputerSystem computerSystem = new ComputerSystem(); + + computerSystemList.Add(computerSystem); + + return computerSystemList; + } + /* SPHardwareDataType Hardware: diff --git a/Hardware.Info/Windows/HardwareInfoRetrieval.cs b/Hardware.Info/Windows/HardwareInfoRetrieval.cs index a3f48d9..f3c98da 100644 --- a/Hardware.Info/Windows/HardwareInfoRetrieval.cs +++ b/Hardware.Info/Windows/HardwareInfoRetrieval.cs @@ -244,6 +244,34 @@ public List GetBiosList() return biosList; } + public List GetComputerSystemList() + { + List computerSystemList = new List(); + + string queryString = UseAsteriskInWMI ? "SELECT * FROM Win32_ComputerSystemProduct" + : "SELECT Caption, Description, IdentifyingNumber, Name, SKUNumber, UUID, Vendor, Version FROM Win32_ComputerSystemProduct"; + using ManagementObjectSearcher mos = new ManagementObjectSearcher(_managementScope, queryString, _enumerationOptions); + + foreach (ManagementBaseObject mo in mos.Get()) + { + ComputerSystem computerSystem = new ComputerSystem + { + Caption = GetPropertyString(mo["Caption"]), + Description = GetPropertyString(mo["Description"]), + IdentifyingNumber = GetPropertyString(mo["IdentifyingNumber"]), + Name = GetPropertyString(mo["Name"]), + SKUNumber = GetPropertyString(mo["SKUNumber"]), + UUID = GetPropertyString(mo["UUID"]), + Vendor = GetPropertyString(mo["Vendor"]), + Version = GetPropertyString(mo["Version"]) + }; + + computerSystemList.Add(computerSystem); + } + + return computerSystemList; + } + public List GetCpuList(bool includePercentProcessorTime = true) { List cpuList = new List(); diff --git a/README.md b/README.md index 0c92614..1aad48b 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ Battery, BIOS, CPU - processor, storage drive, keyboard, RAM - memory, monitor, //hardwareInfo.RefreshMemoryStatus(); //hardwareInfo.RefreshBatteryList(); //hardwareInfo.RefreshBIOSList(); + //hardwareInfo.RefreshComputerSystemList(); //hardwareInfo.RefreshCPUList(); //hardwareInfo.RefreshDriveList(); //hardwareInfo.RefreshKeyboardList(); @@ -55,6 +56,9 @@ Battery, BIOS, CPU - processor, storage drive, keyboard, RAM - memory, monitor, foreach (var hardware in hardwareInfo.BiosList) Console.WriteLine(hardware); + foreach (var hardware in hardwareInfo.ComputerSystemList) + Console.WriteLine(hardware); + foreach (var cpu in hardwareInfo.CpuList) { Console.WriteLine(cpu); From c62f9e68d6e37016f14cb1427689e9455c86d3ff Mon Sep 17 00:00:00 2001 From: Urban Date: Thu, 29 Aug 2024 09:57:16 +0200 Subject: [PATCH 35/42] Version 100.1.1.0 --- Hardware.Info/Linux/HardwareInfoRetrieval.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Hardware.Info/Linux/HardwareInfoRetrieval.cs b/Hardware.Info/Linux/HardwareInfoRetrieval.cs index ae5caa2..652b789 100644 --- a/Hardware.Info/Linux/HardwareInfoRetrieval.cs +++ b/Hardware.Info/Linux/HardwareInfoRetrieval.cs @@ -149,7 +149,17 @@ public List GetComputerSystemList() { List computerSystemList = new List(); - ComputerSystem computerSystem = new ComputerSystem(); + ComputerSystem computerSystem = new ComputerSystem + { + Caption = TryReadTextFromFile("/sys/class/dmi/id/product_name"), + Description = TryReadTextFromFile("/sys/class/dmi/id/product_family"), + IdentifyingNumber = TryReadTextFromFile("/sys/class/dmi/id/product_serial"), + Name = TryReadTextFromFile("/sys/class/dmi/id/product_name"), + SKUNumber = TryReadTextFromFile("/sys/class/dmi/id/product_sku"), + UUID = TryReadTextFromFile("/sys/class/dmi/id/product_uuid"), + Vendor = TryReadTextFromFile("/sys/class/dmi/id/sys_vendor"), + Version = TryReadTextFromFile("/sys/class/dmi/id/product_version") + }; computerSystemList.Add(computerSystem); From 14dc04b7ee31ab9e451879b6ad092e800f3cf6be Mon Sep 17 00:00:00 2001 From: Urban Date: Thu, 29 Aug 2024 10:22:55 +0200 Subject: [PATCH 36/42] Version 100.1.1.0 --- Hardware.Info/Mac/HardwareInfoRetrieval.cs | 61 +++++++++++++++++++++- 1 file changed, 59 insertions(+), 2 deletions(-) diff --git a/Hardware.Info/Mac/HardwareInfoRetrieval.cs b/Hardware.Info/Mac/HardwareInfoRetrieval.cs index 6b7f7d7..8ee515c 100644 --- a/Hardware.Info/Mac/HardwareInfoRetrieval.cs +++ b/Hardware.Info/Mac/HardwareInfoRetrieval.cs @@ -326,13 +326,70 @@ public List GetBiosList() return biosList; } + /* + Urban@mac ~ % system_profiler SPHardwareDataType +Hardware: + + Hardware Overview: + + Model Name: Mac mini + Model Identifier: Macmini9,1 + Model Number: MGNR3ZE/A + Chip: Apple M1 + Total Number of Cores: 8 (4 performance and 4 efficiency) + Memory: 8 GB + System Firmware Version: 10151.140.19 + OS Loader Version: 10151.140.19 + Serial Number (system): C07JG1XTQ6NV + Hardware UUID: A7C8F6C7-C339-5904-B220-CF4C3D22FB1B + Provisioning UDID: 00008103-001965521E60801E + Activation Lock Status: Enabled + +Urban@mac ~ % + */ + public List GetComputerSystemList() { List computerSystemList = new List(); - ComputerSystem computerSystem = new ComputerSystem(); + ComputerSystem computerSystem = null!; + + StartProcess("system_profiler", "SPDisplaysDataType", + standardOutput => + { + int spaceCount = standardOutput.TakeWhile(c => c == ' ').Count(); + + string line = standardOutput.Trim(); + + string[] split = line.Split(':'); + + if (spaceCount == 8) + { + if (monitor != null) + monitorList.Add(monitor); + + string name = line.TrimEnd(':'); + + monitor = new Monitor + { + Caption = name, + Description = name, + Name = name + }; + } + + if (monitor != null) + { + if (line.StartsWith("Display Type: ")) + { + monitor.MonitorType = line.Replace("Display Type: ", string.Empty); + } + } + }, + standardError => { }); - computerSystemList.Add(computerSystem); + if (computerSystem != null) + computerSystemList.Add(computerSystem); return computerSystemList; } From 067590d5894ec7839f7e981d693766b5b8868d05 Mon Sep 17 00:00:00 2001 From: Urban Date: Thu, 29 Aug 2024 10:52:20 +0200 Subject: [PATCH 37/42] Version 100.1.1.0 --- Hardware.Info/Mac/HardwareInfoRetrieval.cs | 57 +++++++++++----------- 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/Hardware.Info/Mac/HardwareInfoRetrieval.cs b/Hardware.Info/Mac/HardwareInfoRetrieval.cs index 8ee515c..85c543c 100644 --- a/Hardware.Info/Mac/HardwareInfoRetrieval.cs +++ b/Hardware.Info/Mac/HardwareInfoRetrieval.cs @@ -327,7 +327,7 @@ public List GetBiosList() } /* - Urban@mac ~ % system_profiler SPHardwareDataType + system_profiler SPHardwareDataType Hardware: Hardware Overview: @@ -344,52 +344,51 @@ Serial Number (system): C07JG1XTQ6NV Hardware UUID: A7C8F6C7-C339-5904-B220-CF4C3D22FB1B Provisioning UDID: 00008103-001965521E60801E Activation Lock Status: Enabled - -Urban@mac ~ % */ public List GetComputerSystemList() { List computerSystemList = new List(); - ComputerSystem computerSystem = null!; + ComputerSystem computerSystem = new ComputerSystem + { + Vendor = "Apple" + }; - StartProcess("system_profiler", "SPDisplaysDataType", + StartProcess("system_profiler", "SPHardwareDataType", standardOutput => { - int spaceCount = standardOutput.TakeWhile(c => c == ' ').Count(); - string line = standardOutput.Trim(); - string[] split = line.Split(':'); - - if (spaceCount == 8) + if (line.StartsWith("Model Name: ")) { - if (monitor != null) - monitorList.Add(monitor); - - string name = line.TrimEnd(':'); - - monitor = new Monitor - { - Caption = name, - Description = name, - Name = name - }; + computerSystem.Caption = line.Replace("Model Name: ", string.Empty); + computerSystem.Name = line.Replace("Model Name: ", string.Empty); } - - if (monitor != null) + else if (line.StartsWith("Model Identifier: ")) { - if (line.StartsWith("Display Type: ")) - { - monitor.MonitorType = line.Replace("Display Type: ", string.Empty); - } + computerSystem.Description = line.Replace("Model Identifier: ", string.Empty); + } + else if (line.StartsWith("Serial Number (system): ")) + { + computerSystem.IdentifyingNumber = line.Replace("Serial Number (system): ", string.Empty); + } + else if (line.StartsWith("Model Number: ")) + { + computerSystem.SKUNumber = line.Replace("Model Number: ", string.Empty); + } + else if (line.StartsWith("Hardware UUID: ")) + { + computerSystem.UUID = line.Replace("Hardware UUID: ", string.Empty); + } + else if (line.StartsWith("System Firmware Version: ")) + { + computerSystem.Version = line.Replace("System Firmware Version: ", string.Empty); } }, standardError => { }); - if (computerSystem != null) - computerSystemList.Add(computerSystem); + computerSystemList.Add(computerSystem); return computerSystemList; } From e49f71417ace63e314f94545d78259426734e0c0 Mon Sep 17 00:00:00 2001 From: Urban Date: Thu, 29 Aug 2024 10:56:33 +0200 Subject: [PATCH 38/42] Version 100.1.1.0 --- Hardware.Info/Mac/HardwareInfoRetrieval.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Hardware.Info/Mac/HardwareInfoRetrieval.cs b/Hardware.Info/Mac/HardwareInfoRetrieval.cs index 85c543c..156403c 100644 --- a/Hardware.Info/Mac/HardwareInfoRetrieval.cs +++ b/Hardware.Info/Mac/HardwareInfoRetrieval.cs @@ -487,7 +487,7 @@ public override List GetDriveList() VBOX HARDDISK: Capacity: 536,87 GB (536.870.912.000 bytes) - Model: VBOX HARDDISK + Model: VBOX HARDDISK Revision: 1,000000 Serial Number: VBa308df62-62a2d2a0 Native Command Queuing: Yes @@ -531,9 +531,9 @@ public override List GetDriveList() VBOX CD-ROM: - Model: VBOX CD-ROM + Model: VBOX CD-ROM Revision: 1,000000 - Serial Number: VB1-1a2b3c4d + Serial Number: VB1-1a2b3c4d Native Command Queuing: No Detachable Drive: No Power Off: No From a0e1f39a5f57d439a98e93b0b45a7115b624f443 Mon Sep 17 00:00:00 2001 From: Urban Date: Thu, 29 Aug 2024 11:02:21 +0200 Subject: [PATCH 39/42] Version 100.1.1.0 --- Hardware.Info/Hardware.Info.csproj | 4 ++-- README.md | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Hardware.Info/Hardware.Info.csproj b/Hardware.Info/Hardware.Info.csproj index 869ae29..41940d7 100644 --- a/Hardware.Info/Hardware.Info.csproj +++ b/Hardware.Info/Hardware.Info.csproj @@ -9,8 +9,8 @@ Hardware.Info Hardware.Info - 100.1.0.1 - 100.1.0.1 + 100.1.1.0 + 100.1.1.0 Jinjinov Battery, BIOS, CPU - processor, storage drive, keyboard, RAM - memory, monitor, motherboard, mouse, NIC - network adapter, printer, sound card - audio card, graphics card - video card. Hardware.Info is a .NET Standard 2.0 library and uses WMI on Windows, /dev, /proc, /sys on Linux and sysctl, system_profiler on macOS. Copyright (c) Jinjinov 2022 diff --git a/README.md b/README.md index 1aad48b..d77ad05 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Battery, BIOS, CPU - processor, storage drive, keyboard, RAM - memory, monitor, 1. Include NuGet package from https://www.nuget.org/packages/Hardware.Info - + 2. Call `RefreshAll()` or one of the other `Refresh*()` methods: @@ -231,6 +231,8 @@ Setting `includeNetworkAdapterConfiguration` to `false` has only a small impact ## Version history: +- 100.1.1.0 + - Added `ComputerSystem` info in Windows, macOS, Linux - thanks to [@Zagrthos](https://github.com/Zagrthos) - 100.1.0.1 - Fixed `GetVideoControllerList` in Linux - thanks to [@NogginBops](https://github.com/NogginBops) - 100.1.0.0 From 06a47f57e02074c294bba93ca05b212d9ccd3590 Mon Sep 17 00:00:00 2001 From: Urban Date: Wed, 18 Sep 2024 16:23:24 +0200 Subject: [PATCH 40/42] Version 100.1.1.1 --- Hardware.Info/Linux/HardwareInfoRetrieval.cs | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/Hardware.Info/Linux/HardwareInfoRetrieval.cs b/Hardware.Info/Linux/HardwareInfoRetrieval.cs index 652b789..a397be7 100644 --- a/Hardware.Info/Linux/HardwareInfoRetrieval.cs +++ b/Hardware.Info/Linux/HardwareInfoRetrieval.cs @@ -817,7 +817,7 @@ private List GetNetworkAdapters() Caption = interfaceName, Description = interfaceName, Name = interfaceName, - MACAddress = macAddress, + MACAddress = macAddress.Replace(":", "").ToUpper(), NetConnectionID = interfaceName, ProductName = interfaceName, }; @@ -912,16 +912,7 @@ private bool TryGetInterfaceIp(string[] fibTrieLines, string network, out string public override List GetNetworkAdapterList(bool includeBytesPersec = true, bool includeNetworkAdapterConfiguration = true) { - List networkAdapterList; - - try - { - networkAdapterList = base.GetNetworkAdapterList(includeBytesPersec, includeNetworkAdapterConfiguration); - } - catch (NetworkInformationException) - { - networkAdapterList = GetNetworkAdapters(); - } + List networkAdapterList = GetNetworkAdapters(); if (includeBytesPersec) { From cb4a549bb47870a90c8d3d6c92b6f80d91992764 Mon Sep 17 00:00:00 2001 From: Urban Date: Wed, 18 Sep 2024 16:31:23 +0200 Subject: [PATCH 41/42] Version 100.1.1.1 --- Hardware.Info/Hardware.Info.csproj | 4 ++-- README.md | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Hardware.Info/Hardware.Info.csproj b/Hardware.Info/Hardware.Info.csproj index 41940d7..f0333d7 100644 --- a/Hardware.Info/Hardware.Info.csproj +++ b/Hardware.Info/Hardware.Info.csproj @@ -9,8 +9,8 @@ Hardware.Info Hardware.Info - 100.1.1.0 - 100.1.1.0 + 100.1.1.1 + 100.1.1.1 Jinjinov Battery, BIOS, CPU - processor, storage drive, keyboard, RAM - memory, monitor, motherboard, mouse, NIC - network adapter, printer, sound card - audio card, graphics card - video card. Hardware.Info is a .NET Standard 2.0 library and uses WMI on Windows, /dev, /proc, /sys on Linux and sysctl, system_profiler on macOS. Copyright (c) Jinjinov 2022 diff --git a/README.md b/README.md index d77ad05..bbb105e 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Battery, BIOS, CPU - processor, storage drive, keyboard, RAM - memory, monitor, 1. Include NuGet package from https://www.nuget.org/packages/Hardware.Info - + 2. Call `RefreshAll()` or one of the other `Refresh*()` methods: @@ -231,6 +231,8 @@ Setting `includeNetworkAdapterConfiguration` to `false` has only a small impact ## Version history: +- 100.1.1.1 + - Fixed `GetNetworkAdapterList` in Linux - thanks to [@Pregath0r](https://github.com/Pregath0r) - 100.1.1.0 - Added `ComputerSystem` info in Windows, macOS, Linux - thanks to [@Zagrthos](https://github.com/Zagrthos) - 100.1.0.1 From a381328a7df99bc18b0c40395248ff2d6749fdf8 Mon Sep 17 00:00:00 2001 From: Urban Date: Thu, 19 Sep 2024 22:01:38 +0200 Subject: [PATCH 42/42] Version 101.0.0.0 --- Hardware.Info/Hardware.Info.csproj | 4 +- Hardware.Info/HardwareInfo.cs | 6 ++- Hardware.Info/HardwareInfoBase.cs | 2 +- Hardware.Info/IHardwareInfo.cs | 6 ++- Hardware.Info/IHardwareInfoRetrieval.cs | 4 +- Hardware.Info/Linux/HardwareInfoRetrieval.cs | 17 ++++++--- Hardware.Info/Mac/HardwareInfoRetrieval.cs | 4 +- .../Windows/HardwareInfoRetrieval.cs | 4 +- README.md | 37 ++++++++++++++++--- 9 files changed, 59 insertions(+), 25 deletions(-) diff --git a/Hardware.Info/Hardware.Info.csproj b/Hardware.Info/Hardware.Info.csproj index f0333d7..6b1e5e2 100644 --- a/Hardware.Info/Hardware.Info.csproj +++ b/Hardware.Info/Hardware.Info.csproj @@ -9,8 +9,8 @@ Hardware.Info Hardware.Info - 100.1.1.1 - 100.1.1.1 + 101.0.0.0 + 101.0.0.0 Jinjinov Battery, BIOS, CPU - processor, storage drive, keyboard, RAM - memory, monitor, motherboard, mouse, NIC - network adapter, printer, sound card - audio card, graphics card - video card. Hardware.Info is a .NET Standard 2.0 library and uses WMI on Windows, /dev, /proc, /sys on Linux and sysctl, system_profiler on macOS. Copyright (c) Jinjinov 2022 diff --git a/Hardware.Info/HardwareInfo.cs b/Hardware.Info/HardwareInfo.cs index f0f2c52..8cecca4 100644 --- a/Hardware.Info/HardwareInfo.cs +++ b/Hardware.Info/HardwareInfo.cs @@ -171,7 +171,8 @@ public void RefreshAll() /// Refresh CPU info /// /// Include PercentProcessorTime info. This makes the method a bit slower. - public void RefreshCPUList(bool includePercentProcessorTime = true) => CpuList = _hardwareInfoRetrieval.GetCpuList(includePercentProcessorTime); + /// Delay in milliseconds between two measurements in Linux + public void RefreshCPUList(bool includePercentProcessorTime = true, int millisecondsDelayBetweenTwoMeasurements = 500) => CpuList = _hardwareInfoRetrieval.GetCpuList(includePercentProcessorTime, millisecondsDelayBetweenTwoMeasurements); /// /// Refresh drive info @@ -208,7 +209,8 @@ public void RefreshAll() /// /// Include BytesPerSec info. This makes the method a bit slower. /// Include NetworkAdapterConfiguration info. This makes the method a bit slower. - public void RefreshNetworkAdapterList(bool includeBytesPerSec = true, bool includeNetworkAdapterConfiguration = true) => NetworkAdapterList = _hardwareInfoRetrieval.GetNetworkAdapterList(includeBytesPerSec, includeNetworkAdapterConfiguration); + /// Delay in milliseconds between two measurements in Linux + public void RefreshNetworkAdapterList(bool includeBytesPerSec = true, bool includeNetworkAdapterConfiguration = true, int millisecondsDelayBetweenTwoMeasurements = 1000) => NetworkAdapterList = _hardwareInfoRetrieval.GetNetworkAdapterList(includeBytesPerSec, includeNetworkAdapterConfiguration, millisecondsDelayBetweenTwoMeasurements); /// /// Refresh printer info diff --git a/Hardware.Info/HardwareInfoBase.cs b/Hardware.Info/HardwareInfoBase.cs index 95cd1da..cef9ed7 100644 --- a/Hardware.Info/HardwareInfoBase.cs +++ b/Hardware.Info/HardwareInfoBase.cs @@ -116,7 +116,7 @@ public virtual List GetDriveList() return driveList; } - public virtual List GetNetworkAdapterList(bool includeBytesPersec = true, bool includeNetworkAdapterConfiguration = true) + public virtual List GetNetworkAdapterList(bool includeBytesPersec = true, bool includeNetworkAdapterConfiguration = true, int millisecondsDelayBetweenTwoMeasurements = 1000) { List networkAdapterList = new List(); diff --git a/Hardware.Info/IHardwareInfo.cs b/Hardware.Info/IHardwareInfo.cs index 229b054..7084551 100644 --- a/Hardware.Info/IHardwareInfo.cs +++ b/Hardware.Info/IHardwareInfo.cs @@ -121,7 +121,8 @@ public interface IHardwareInfo /// Refresh CPU info /// /// Include PercentProcessorTime info. This makes the method a bit slower. - void RefreshCPUList(bool includePercentProcessorTime = true); + /// Delay in milliseconds between two measurements in Linux + void RefreshCPUList(bool includePercentProcessorTime = true, int millisecondsDelayBetweenTwoMeasurements = 500); /// /// Refresh drive info @@ -158,7 +159,8 @@ public interface IHardwareInfo /// /// Include BytesPerSec info. This makes the method a bit slower. /// Include NetworkAdapterConfiguration info. This makes the method a bit slower. - void RefreshNetworkAdapterList(bool includeBytesPerSec = true, bool includeNetworkAdapterConfiguration = true); + /// Delay in milliseconds between two measurements in Linux + void RefreshNetworkAdapterList(bool includeBytesPerSec = true, bool includeNetworkAdapterConfiguration = true, int millisecondsDelayBetweenTwoMeasurements = 1000); /// /// Refresh printer info diff --git a/Hardware.Info/IHardwareInfoRetrieval.cs b/Hardware.Info/IHardwareInfoRetrieval.cs index bae4121..2d2c8cd 100644 --- a/Hardware.Info/IHardwareInfoRetrieval.cs +++ b/Hardware.Info/IHardwareInfoRetrieval.cs @@ -10,14 +10,14 @@ internal interface IHardwareInfoRetrieval List GetBatteryList(); List GetBiosList(); List GetComputerSystemList(); - List GetCpuList(bool includePercentProcessorTime = true); + List GetCpuList(bool includePercentProcessorTime = true, int millisecondsDelayBetweenTwoMeasurements = 500); List GetDriveList(); List GetKeyboardList(); List GetMemoryList(); List GetMonitorList(); List GetMotherboardList(); List GetMouseList(); - List GetNetworkAdapterList(bool includeBytesPersec = true, bool includeNetworkAdapterConfiguration = true); + List GetNetworkAdapterList(bool includeBytesPersec = true, bool includeNetworkAdapterConfiguration = true, int millisecondsDelayBetweenTwoMeasurements = 1000); List GetPrinterList(); List GetSoundDeviceList(); List GetVideoControllerList(); diff --git a/Hardware.Info/Linux/HardwareInfoRetrieval.cs b/Hardware.Info/Linux/HardwareInfoRetrieval.cs index a397be7..6d81935 100644 --- a/Hardware.Info/Linux/HardwareInfoRetrieval.cs +++ b/Hardware.Info/Linux/HardwareInfoRetrieval.cs @@ -186,7 +186,7 @@ private class Processor public ulong PercentProcessorTime; } - public List GetCpuList(bool includePercentProcessorTime = true) + public List GetCpuList(bool includePercentProcessorTime = true, int millisecondsDelayBetweenTwoMeasurements = 500) { string[] lines = TryReadLinesFromFile("/proc/cpuinfo"); @@ -294,7 +294,7 @@ public List GetCpuList(bool includePercentProcessorTime = true) if (includePercentProcessorTime) { - percentProcessorTime = GetCpuUsage(processorList); + percentProcessorTime = GetCpuUsage(processorList, millisecondsDelayBetweenTwoMeasurements); } List cpuList = new List(); @@ -368,7 +368,7 @@ private static void GetCpuCacheSize(Processor processor) } } - private static ulong GetCpuUsage(List processorList) + private static ulong GetCpuUsage(List processorList, int millisecondsDelayBetweenTwoMeasurements) { // Column Name Description // 1 user Time spent with normal processing in user mode. @@ -389,7 +389,7 @@ private static ulong GetCpuUsage(List processorList) // ... string[] cpuUsageLineLast = TryReadLinesFromFile("/proc/stat"); - Task.Delay(500).Wait(); + Task.Delay(millisecondsDelayBetweenTwoMeasurements).Wait(); string[] cpuUsageLineNow = TryReadLinesFromFile("/proc/stat"); ulong percentProcessorTime = 0; @@ -444,6 +444,11 @@ private static UInt64 GetCpuPercentage(string cpuStatLast, string cpuStatNow) // Get the delta between two reads ulong cpuDelta = cpuSumNow - cpuSumLast; + if (cpuDelta == 0) + { + return 0; // avoid System.DivideByZeroException: Attempted to divide by zero. + } + // Get the idle time Delta ulong cpuIdle = 0; @@ -910,7 +915,7 @@ private bool TryGetInterfaceIp(string[] fibTrieLines, string network, out string return foundIp; } - public override List GetNetworkAdapterList(bool includeBytesPersec = true, bool includeNetworkAdapterConfiguration = true) + public override List GetNetworkAdapterList(bool includeBytesPersec = true, bool includeNetworkAdapterConfiguration = true, int millisecondsDelayBetweenTwoMeasurements = 1000) { List networkAdapterList = GetNetworkAdapters(); @@ -919,7 +924,7 @@ public override List GetNetworkAdapterList(bool includeBytesPers char[] charSeparators = new char[] { ' ' }; string[] procNetDevLast = TryReadLinesFromFile("/proc/net/dev"); - Task.Delay(1000).Wait(); + Task.Delay(millisecondsDelayBetweenTwoMeasurements).Wait(); string[] procNetDevNow = TryReadLinesFromFile("/proc/net/dev"); foreach (NetworkAdapter networkAdapter in networkAdapterList) diff --git a/Hardware.Info/Mac/HardwareInfoRetrieval.cs b/Hardware.Info/Mac/HardwareInfoRetrieval.cs index 156403c..ff24c63 100644 --- a/Hardware.Info/Mac/HardwareInfoRetrieval.cs +++ b/Hardware.Info/Mac/HardwareInfoRetrieval.cs @@ -413,7 +413,7 @@ Serial Number (system): 0 Hardware UUID: F6D9C340-725A-224A-8855-99AB8348F745 /**/ - public List GetCpuList(bool includePercentProcessorTime = true) + public List GetCpuList(bool includePercentProcessorTime = true, int millisecondsDelayBetweenTwoMeasurements = 500) { List cpuList = new List(); @@ -938,7 +938,7 @@ Extra Operating Current (mA): 0 return mouseList; } - public override List GetNetworkAdapterList(bool includeBytesPersec = true, bool includeNetworkAdapterConfiguration = true) + public override List GetNetworkAdapterList(bool includeBytesPersec = true, bool includeNetworkAdapterConfiguration = true, int millisecondsDelayBetweenTwoMeasurements = 1000) { /* SPNetworkDataType diff --git a/Hardware.Info/Windows/HardwareInfoRetrieval.cs b/Hardware.Info/Windows/HardwareInfoRetrieval.cs index f3c98da..0668a3f 100644 --- a/Hardware.Info/Windows/HardwareInfoRetrieval.cs +++ b/Hardware.Info/Windows/HardwareInfoRetrieval.cs @@ -272,7 +272,7 @@ public List GetComputerSystemList() return computerSystemList; } - public List GetCpuList(bool includePercentProcessorTime = true) + public List GetCpuList(bool includePercentProcessorTime = true, int millisecondsDelayBetweenTwoMeasurements = 500) { List cpuList = new List(); @@ -658,7 +658,7 @@ public List GetMouseList() return mouseList; } - public override List GetNetworkAdapterList(bool includeBytesPersec = true, bool includeNetworkAdapterConfiguration = true) + public override List GetNetworkAdapterList(bool includeBytesPersec = true, bool includeNetworkAdapterConfiguration = true, int millisecondsDelayBetweenTwoMeasurements = 1000) { List networkAdapterList = new List(); diff --git a/README.md b/README.md index bbb105e..6c60f64 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Battery, BIOS, CPU - processor, storage drive, keyboard, RAM - memory, monitor, 1. Include NuGet package from https://www.nuget.org/packages/Hardware.Info - + 2. Call `RefreshAll()` or one of the other `Refresh*()` methods: @@ -174,12 +174,15 @@ The construcotr accepts two settings for WMI: ### Refresh methods settings: -In these two methods you can exclude some slow queries by setting the parameters to `false`: - ``` -RefreshCPUList(bool includePercentProcessorTime = true) - -RefreshNetworkAdapterList(bool includeBytesPersec = true, bool includeNetworkAdapterConfiguration = true) +RefreshCPUList( + bool includePercentProcessorTime = true, + int millisecondsDelayBetweenTwoMeasurements = 500) + +RefreshNetworkAdapterList( + bool includeBytesPersec = true, + bool includeNetworkAdapterConfiguration = true, + int millisecondsDelayBetweenTwoMeasurements = 1000) ``` Setting `includePercentProcessorTime` and `includeBytesPersec` to `false` will exclude the queries that: @@ -188,6 +191,24 @@ Setting `includePercentProcessorTime` and `includeBytesPersec` to `false` will e Setting `includeNetworkAdapterConfiguration` to `false` has only a small impact on performance. +Delay in milliseconds between two measurements in Linux: + +For `PercentProcessorTime` in Linux: +``` +string[] cpuUsageLineLast = TryReadLinesFromFile("/proc/stat"); +Task.Delay(millisecondsDelayBetweenTwoMeasurements).Wait(); +string[] cpuUsageLineNow = TryReadLinesFromFile("/proc/stat"); +``` +If `includePercentProcessorTime` is false, `millisecondsDelayBetweenTwoMeasurements` has no effect. + +For `BytesSentPersec` and `BytesReceivedPersec` in Linux: +``` +string[] procNetDevLast = TryReadLinesFromFile("/proc/net/dev"); +Task.Delay(millisecondsDelayBetweenTwoMeasurements).Wait(); +string[] procNetDevNow = TryReadLinesFromFile("/proc/net/dev"); +``` +If `includeBytesPersec` is false, `millisecondsDelayBetweenTwoMeasurements` has no effect. + ## Benchmarks ### Windows 8.1 (Intel i5-2500, 8 GB RAM): @@ -231,6 +252,10 @@ Setting `includeNetworkAdapterConfiguration` to `false` has only a small impact ## Version history: +- 101.0.0.0 + - Fixed `GetCpuList` in Linux - thanks to [@inelisoni](https://github.com/inelisoni) + - Added `int millisecondsDelayBetweenTwoMeasurements` to `GetCpuList` + - Added `int millisecondsDelayBetweenTwoMeasurements` to `GetNetworkAdapterList` - 100.1.1.1 - Fixed `GetNetworkAdapterList` in Linux - thanks to [@Pregath0r](https://github.com/Pregath0r) - 100.1.1.0