Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Build Library

on:
push:
paths-ignore:
- '**/*.md'
branches:
- master
pull_request:
branches:
- master
paths-ignore:
- '**/*.md'

jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET 7
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Test with the dotnet CLI
run: dotnet test
29 changes: 29 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Publish Library

# When a release is published
on:
release:
types: [published]
jobs:
publish:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Get version
run: |
echo "VERSION=${{ github.event.release.tag_name }}" >> $env:GITHUB_ENV
echo "Building with ${{ env.VERSION }}"
- name: Setup .NET 7
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore -p:Version=${{ env.VERSION }}
- name: Test with the dotnet CLI
run: dotnet test
- name: Pack
run: dotnet pack Hardware.Info --output nupkgs --configuration Release -p:Version=${{ env.VERSION }}
- name: Nuget Publish
run: dotnet nuget push nupkgs\*.nupkg -k ${{ secrets.NUGET_TOKEN }} -s https://api.nuget.org/v3/index.json
17 changes: 10 additions & 7 deletions Hardware.Info/Hardware.Info.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,19 @@
</PropertyGroup>

<PropertyGroup>
<Product>Hardware.Info</Product>
<PackageId>Hardware.Info</PackageId>
<PackageVersion>101.0.1.1</PackageVersion>
<Version>101.0.1.1</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>
<Product>YellowDogMan.Hardware.Info</Product>
<PackageId>YellowDogMan.Hardware.Info</PackageId>
<!-- we'll handle these via our workflows-->
<!--<PackageVersion>101.0.1.1-ydm</PackageVersion>
<Version>101.0.1.1</Version>-->
<Authors>Jinjinov, Yellow Dog Man Studios s.r.o</Authors>
<Description>Yellow Dog Man Studios fork of Hardware.Info. 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 2020-2025</Copyright>
<PackageProjectUrl>https://github.com/Jinjinov/Hardware.Info</PackageProjectUrl>
<PackageProjectUrl>https://github.com/Yellow-Dog-Man/Hardware.Info</PackageProjectUrl>
<!--<PackageIcon></PackageIcon>-->
<PackageReadmeFile>README.md</PackageReadmeFile>
<RepositoryUrl>https://github.com/Yellow-Dog-Man/Hardware.Info.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>Computer;Device;Hardware;Info;Information;NET Standard;Windows;Linux;macOS</PackageTags>
<!--<PackageReleaseNotes></PackageReleaseNotes>-->
<PackageLicenseExpression>MIT</PackageLicenseExpression>
Expand Down
15 changes: 15 additions & 0 deletions Hardware.Info/HardwareInfoBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,21 @@ internal static uint TryReadIntegerFromFile(params string[] possiblePaths)
return 0;
}

internal static ulong TryReadLongFromFile(params string[] possiblePaths)
{
foreach (string path in possiblePaths)
{
string text = TryReadTextFromFile(path);

if (ulong.TryParse(text, out ulong integer))
{
return integer;
}
}

return 0;
}

internal static string[] TryReadLinesFromFile(string path)
{
try
Expand Down
Loading
Loading