Skip to content

Commit

Permalink
Version 11.0.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Urban committed Mar 25, 2023
1 parent e9a8e6a commit 6239d51
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Hardware.Info/Hardware.Info.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<PropertyGroup>
<Product>Hardware.Info</Product>
<PackageId>Hardware.Info</PackageId>
<PackageVersion>10.1.1.1</PackageVersion>
<Version>10.1.1.1</Version>
<PackageVersion>11.0.0.0</PackageVersion>
<Version>11.0.0.0</Version>
<Authors>Jinjinov</Authors>
<Description>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.</Description>
<Copyright>Copyright (c) Jinjinov 2022</Copyright>
Expand Down
8 changes: 6 additions & 2 deletions Hardware.Info/Windows/HardwareInfoRetrieval.cs
Original file line number Diff line number Diff line change
Expand Up @@ -561,8 +561,12 @@ public override List<NetworkAdapter> GetNetworkAdapterList(bool includeBytesPers

if (includeBytesPersec)
{
string query = UseAsteriskInWMI ? $"SELECT * FROM Win32_PerfFormattedData_Tcpip_NetworkAdapter WHERE Name = '{networkAdapter.Name.Replace("(", "[").Replace(")", "]")}'"
: $"SELECT BytesSentPersec, BytesReceivedPersec FROM Win32_PerfFormattedData_Tcpip_NetworkAdapter WHERE Name = '{networkAdapter.Name.Replace("(", "[").Replace(")", "]")}'";
// https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.performancecounter.instancename

string name = networkAdapter.Name.Replace('(', '[').Replace(')', ']').Replace('#', '_').Replace('\\', '_').Replace('/', '_');

string query = UseAsteriskInWMI ? $"SELECT * FROM Win32_PerfFormattedData_Tcpip_NetworkAdapter WHERE Name = '{name}'"
: $"SELECT BytesSentPersec, BytesReceivedPersec FROM Win32_PerfFormattedData_Tcpip_NetworkAdapter WHERE Name = '{name}'";
using ManagementObjectSearcher managementObjectSearcher = new ManagementObjectSearcher(_managementScope, query, _enumerationOptions);

foreach (ManagementBaseObject managementObject in managementObjectSearcher.Get())
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

<ItemGroup>
<PackageReference Include="Hardware.Info" Version="10.1.1.1" />
<PackageReference Include="Hardware.Info" Version="11.0.0.0" />
</ItemGroup>

2. Call `RefreshAll()` or one of the other `Refresh*()` methods:
Expand Down Expand Up @@ -203,6 +203,8 @@ Setting `includeNetworkAdapterConfiguration` to `false` has only a small impact

## Version history:

- 11.0.0.0
- Fixed `GetNetworkAdapterList` in Windows - thanks to [@isenmann](https://github.com/isenmann)
- 10.1.1.1:
- Fixed `CurrentClockSpeed` in Windows - thanks to [@jason-c-daniels](https://github.com/jason-c-daniels)
- 10.1.1.0:
Expand Down

0 comments on commit 6239d51

Please sign in to comment.