Add .NET 10 build
Also drops WMI provider as this is no longer working with .NET 10.
This commit is contained in:
@@ -39,13 +39,20 @@ jobs:
|
||||
- name: Build application
|
||||
run: dotnet build LibreHardwareMonitor\LibreHardwareMonitor.csproj -c Release --no-restore -p:Platform=x64
|
||||
|
||||
- name: Publish application
|
||||
- name: Publish net472 application
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: LibreHardwareMonitor
|
||||
path: |
|
||||
bin/Release/net472
|
||||
|
||||
- name: Publish net10.0 application
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: LibreHardwareMonitor (.NET 10)
|
||||
path: |
|
||||
bin/Release/net10.0-windows
|
||||
|
||||
- name: Restore library packages
|
||||
run: dotnet restore LibreHardwareMonitorLib\LibreHardwareMonitorLib.csproj
|
||||
|
||||
|
||||
@@ -39,13 +39,20 @@ jobs:
|
||||
- name: Build application
|
||||
run: dotnet build LibreHardwareMonitor\LibreHardwareMonitor.csproj -c Release --no-restore -p:Platform=x64
|
||||
|
||||
- name: Publish application
|
||||
- name: Publish net472 application
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: LibreHardwareMonitor
|
||||
path: |
|
||||
bin/Release/net472
|
||||
|
||||
- name: Publish net10.0 application
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: LibreHardwareMonitor (.NET 10)
|
||||
path: |
|
||||
bin/Release/net10.0-windows
|
||||
|
||||
- name: Restore library packages
|
||||
run: dotnet restore LibreHardwareMonitorLib\LibreHardwareMonitorLib.csproj
|
||||
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
|
||||
<PropertyGroup>
|
||||
<GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources>
|
||||
<Platforms>x64;x86;ARM64</Platforms>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
<TargetFrameworks>net472;net10.0-windows</TargetFrameworks>
|
||||
<Platforms>x64;x86;ARM64</Platforms>
|
||||
<RuntimeIdentifiers>win-x64;win-x86;win-arm64</RuntimeIdentifiers>
|
||||
<AssemblyName>LibreHardwareMonitor</AssemblyName>
|
||||
<AssemblyTitle>Libre Hardware Monitor</AssemblyTitle>
|
||||
<Copyright>LibreHardwareMonitor</Copyright>
|
||||
@@ -17,26 +15,31 @@
|
||||
<OutputPath>..\bin\$(Configuration)\</OutputPath>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources>
|
||||
<RuntimeIdentifiers>win-x64</RuntimeIdentifiers>
|
||||
<NoWarn>$(NoWarn);WFO1000</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<DebugType>full</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="System.Text.Json" Version="10.0.1" />
|
||||
<PackageReference Include="System.Resources.Extensions" Version="10.0.1" />
|
||||
<PackageReference Include="TaskScheduler" Version="2.12.2" />
|
||||
<PackageReference Include="OxyPlot.Core" Version="2.2.0" />
|
||||
<PackageReference Include="OxyPlot.WindowsForms" Version="2.2.0" />
|
||||
<PackageReference Include="System.Management" Version="10.0.1" />
|
||||
<PackageReference Include="System.Resources.Extensions" Version="10.0.1" />
|
||||
<PackageReference Include="System.Text.Json" Version="10.0.1" />
|
||||
<PackageReference Include="TaskScheduler" Version="2.12.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Configuration.Install" />
|
||||
<Reference Include="System.Web" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="UI\AboutBox.Designer.cs">
|
||||
<DependentUpon>AboutBox.cs</DependentUpon>
|
||||
@@ -54,6 +57,7 @@
|
||||
<DependentUpon>InterfacePortForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Update="UI\AboutBox.resx">
|
||||
<DependentUpon>AboutBox.cs</DependentUpon>
|
||||
@@ -71,10 +75,12 @@
|
||||
<DependentUpon>InterfacePortForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Aga.Controls\Aga.Controls.csproj" />
|
||||
<ProjectReference Include="..\LibreHardwareMonitorLib\LibreHardwareMonitorLib.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Resources\**" />
|
||||
<None Include="Resources\app.manifest" />
|
||||
|
||||
@@ -17,10 +17,8 @@ using Aga.Controls.Tree;
|
||||
using Aga.Controls.Tree.NodeControls;
|
||||
using LibreHardwareMonitor.Hardware;
|
||||
using LibreHardwareMonitor.Hardware.Storage;
|
||||
using LibreHardwareMonitor.PawnIo;
|
||||
using LibreHardwareMonitor.UI.Themes;
|
||||
using LibreHardwareMonitor.Utilities;
|
||||
using LibreHardwareMonitor.Wmi;
|
||||
|
||||
namespace LibreHardwareMonitor.UI;
|
||||
|
||||
@@ -56,7 +54,6 @@ public sealed partial class MainForm : Form
|
||||
private readonly SystemTray _systemTray;
|
||||
private readonly UnitManager _unitManager;
|
||||
private readonly UpdateVisitor _updateVisitor = new();
|
||||
private readonly WmiProvider _wmiProvider;
|
||||
|
||||
private int _delayCount;
|
||||
private Form _plotForm;
|
||||
@@ -153,7 +150,6 @@ public sealed partial class MainForm : Form
|
||||
treeView.RowHeight = Math.Max(treeView.Font.Height + 1, 18);
|
||||
_gadget = new SensorGadget(_computer, _settings, _unitManager);
|
||||
_gadget.HideShowCommand += HideShowClick;
|
||||
_wmiProvider = new WmiProvider(_computer);
|
||||
}
|
||||
|
||||
treeView.ShowNodeToolTips = true;
|
||||
@@ -933,7 +929,6 @@ public sealed partial class MainForm : Form
|
||||
treeView.Invalidate();
|
||||
_systemTray.Redraw();
|
||||
_gadget?.Redraw();
|
||||
_wmiProvider?.Update();
|
||||
|
||||
if (!backgroundUpdater.IsBusy)
|
||||
backgroundUpdater.RunWorkerAsync();
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
||||
// If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
// Copyright (C) LibreHardwareMonitor and Contributors.
|
||||
// Partial Copyright (C) Michael Möller <mmoeller@openhardwaremonitor.org> and Contributors.
|
||||
// All Rights Reserved.
|
||||
|
||||
using System.Management.Instrumentation;
|
||||
using LibreHardwareMonitor.Hardware;
|
||||
|
||||
namespace LibreHardwareMonitor.Wmi;
|
||||
|
||||
[InstrumentationClass(InstrumentationType.Instance)]
|
||||
public class Hardware : IWmiObject
|
||||
{
|
||||
#region WMI Exposed
|
||||
|
||||
public string HardwareType { get; }
|
||||
public string Identifier { get; }
|
||||
public string Name { get; }
|
||||
public string Parent { get; }
|
||||
|
||||
#endregion
|
||||
|
||||
public Hardware(IHardware hardware)
|
||||
{
|
||||
Name = hardware.Name;
|
||||
Identifier = hardware.Identifier.ToString();
|
||||
HardwareType = hardware.HardwareType.ToString();
|
||||
Parent = (hardware.Parent != null)
|
||||
? hardware.Parent.Identifier.ToString()
|
||||
: "";
|
||||
}
|
||||
|
||||
public void Update() { }
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
||||
// If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
// Copyright (C) LibreHardwareMonitor and Contributors.
|
||||
// Partial Copyright (C) Michael Möller <mmoeller@openhardwaremonitor.org> and Contributors.
|
||||
// All Rights Reserved.
|
||||
|
||||
namespace LibreHardwareMonitor.Wmi;
|
||||
|
||||
interface IWmiObject
|
||||
{
|
||||
// Both of these get exposed to WMI
|
||||
string Name { get; }
|
||||
string Identifier { get; }
|
||||
|
||||
// Not exposed.
|
||||
void Update();
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
||||
// If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
// Copyright (C) LibreHardwareMonitor and Contributors.
|
||||
// Partial Copyright (C) Michael Möller <mmoeller@openhardwaremonitor.org> and Contributors.
|
||||
// All Rights Reserved.
|
||||
|
||||
using System.Management.Instrumentation;
|
||||
using LibreHardwareMonitor.Hardware;
|
||||
|
||||
namespace LibreHardwareMonitor.Wmi;
|
||||
|
||||
[InstrumentationClass(InstrumentationType.Instance)]
|
||||
public class Sensor : IWmiObject
|
||||
{
|
||||
private readonly ISensor _sensor;
|
||||
|
||||
#region WMI Exposed
|
||||
|
||||
public string SensorType { get; }
|
||||
public string Identifier { get; }
|
||||
public string Parent { get; }
|
||||
public string Name { get; }
|
||||
public float Value { get; private set; }
|
||||
public float Min { get; private set; }
|
||||
public float Max { get; private set; }
|
||||
public int Index { get; }
|
||||
|
||||
#endregion
|
||||
|
||||
public Sensor(ISensor sensor)
|
||||
{
|
||||
Name = sensor.Name;
|
||||
Index = sensor.Index;
|
||||
|
||||
SensorType = sensor.SensorType.ToString();
|
||||
Identifier = sensor.Identifier.ToString();
|
||||
Parent = sensor.Hardware.Identifier.ToString();
|
||||
|
||||
_sensor = sensor;
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
Value = _sensor.Value ?? 0;
|
||||
|
||||
if (_sensor.Min != null)
|
||||
Min = (float)_sensor.Min;
|
||||
|
||||
if (_sensor.Max != null)
|
||||
Max = (float)_sensor.Max;
|
||||
}
|
||||
}
|
||||
@@ -1,145 +0,0 @@
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
||||
// If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
// Copyright (C) LibreHardwareMonitor and Contributors.
|
||||
// Partial Copyright (C) Michael Möller <mmoeller@openhardwaremonitor.org> and Contributors.
|
||||
// All Rights Reserved.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Management.Instrumentation;
|
||||
using LibreHardwareMonitor.Hardware;
|
||||
|
||||
[assembly: Instrumented("root/LibreHardwareMonitor")]
|
||||
|
||||
[System.ComponentModel.RunInstaller(true)]
|
||||
public class InstanceInstaller : DefaultManagementProjectInstaller
|
||||
{ }
|
||||
|
||||
namespace LibreHardwareMonitor.Wmi
|
||||
{
|
||||
/// <summary>
|
||||
/// The WMI Provider.
|
||||
/// This class is not exposed to WMI itself.
|
||||
/// </summary>
|
||||
public class WmiProvider : IDisposable
|
||||
{
|
||||
private readonly object _activeInstancesLock = new();
|
||||
private readonly List<IWmiObject> _activeInstances;
|
||||
|
||||
public WmiProvider(IComputer computer)
|
||||
{
|
||||
_activeInstances = new List<IWmiObject>();
|
||||
foreach (IHardware hardware in computer.Hardware)
|
||||
OnHardwareAdded(hardware);
|
||||
|
||||
computer.HardwareAdded += OnHardwareAdded;
|
||||
computer.HardwareRemoved += OnHardwareRemoved;
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
lock (_activeInstancesLock)
|
||||
{
|
||||
foreach (IWmiObject instance in _activeInstances)
|
||||
instance.Update();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnHardwareAdded(IHardware hardware)
|
||||
{
|
||||
lock (_activeInstancesLock)
|
||||
{
|
||||
if (!_activeInstances.Exists(h => h.Identifier == hardware.Identifier.ToString()))
|
||||
{
|
||||
foreach (ISensor sensor in hardware.Sensors)
|
||||
OnSensorAdded(sensor);
|
||||
|
||||
hardware.SensorAdded += OnSensorAdded;
|
||||
hardware.SensorRemoved += HardwareSensorRemoved;
|
||||
|
||||
Hardware hw = new(hardware);
|
||||
_activeInstances.Add(hw);
|
||||
|
||||
try
|
||||
{
|
||||
Instrumentation.Publish(hw);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
}
|
||||
|
||||
foreach (IHardware subHardware in hardware.SubHardware)
|
||||
OnHardwareAdded(subHardware);
|
||||
}
|
||||
|
||||
private void OnSensorAdded(ISensor data)
|
||||
{
|
||||
Sensor sensor = new(data);
|
||||
|
||||
lock (_activeInstancesLock)
|
||||
_activeInstances.Add(sensor);
|
||||
|
||||
try
|
||||
{
|
||||
Instrumentation.Publish(sensor);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
|
||||
private void OnHardwareRemoved(IHardware hardware)
|
||||
{
|
||||
hardware.SensorAdded -= OnSensorAdded;
|
||||
hardware.SensorRemoved -= HardwareSensorRemoved;
|
||||
|
||||
foreach (ISensor sensor in hardware.Sensors)
|
||||
HardwareSensorRemoved(sensor);
|
||||
|
||||
foreach (IHardware subHardware in hardware.SubHardware)
|
||||
OnHardwareRemoved(subHardware);
|
||||
|
||||
RevokeInstance(hardware.Identifier.ToString());
|
||||
}
|
||||
|
||||
private void HardwareSensorRemoved(ISensor sensor)
|
||||
{
|
||||
RevokeInstance(sensor.Identifier.ToString());
|
||||
}
|
||||
|
||||
private void RevokeInstance(string identifier)
|
||||
{
|
||||
lock (_activeInstancesLock)
|
||||
{
|
||||
int instanceIndex = _activeInstances.FindIndex(item => item.Identifier == identifier);
|
||||
if (instanceIndex == -1)
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
Instrumentation.Revoke(_activeInstances[instanceIndex]);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
|
||||
_activeInstances.RemoveAt(instanceIndex);
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
lock (_activeInstancesLock)
|
||||
{
|
||||
foreach (IWmiObject instance in _activeInstances)
|
||||
{
|
||||
try
|
||||
{
|
||||
Instrumentation.Revoke(instance);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net472;netstandard2.0;net8.0;net9.0;net10.0</TargetFrameworks>
|
||||
<Platforms>x64;x86;ARM64</Platforms>
|
||||
<RuntimeIdentifiers>win-x64;win-x86;win-arm64</RuntimeIdentifiers>
|
||||
<AssemblyName>LibreHardwareMonitorLib</AssemblyName>
|
||||
<RootNamespace>LibreHardwareMonitor</RootNamespace>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
@@ -18,44 +20,46 @@
|
||||
<LangVersion>latest</LangVersion>
|
||||
<PackageIcon>packageicon.png</PackageIcon>
|
||||
<GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources>
|
||||
<Platforms>x64;x86;ARM64</Platforms>
|
||||
<RuntimeIdentifiers>win-x64;win-x86;win-arm64</RuntimeIdentifiers>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);CA1416</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(BuildOnlyRefs)'=='true'">
|
||||
<Platform>AnyCPU</Platform>
|
||||
<ProduceOnlyReferenceAssembly>true</ProduceOnlyReferenceAssembly>
|
||||
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
|
||||
<OutputPath>..\bin\Debug\$(Platform)\</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Release'">
|
||||
<OutputPath>..\bin\Release\$(Platform)\</OutputPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Resources\PawnIo\IsaBridgeEC.bin" />
|
||||
<EmbeddedResource Include="Resources\PawnIo\LpcIO.bin" />
|
||||
<EmbeddedResource Include="Resources\PawnIo\LpcACPIEC.bin" />
|
||||
<EmbeddedResource Include="Resources\PawnIo\LpcCrOSEC.bin" />
|
||||
<EmbeddedResource Include="Resources\PawnIo\IntelMSR.bin" />
|
||||
<EmbeddedResource Include="Resources\PawnIo\RyzenSMU.bin" />
|
||||
<EmbeddedResource Include="Resources\PawnIo\AMDFamily0F.bin" />
|
||||
<EmbeddedResource Include="Resources\PawnIo\AMDFamily10.bin" />
|
||||
<EmbeddedResource Include="Resources\PawnIo\AMDFamily17.bin" />
|
||||
<EmbeddedResource Include="Resources\PawnIo\IntelMSR.bin" />
|
||||
<EmbeddedResource Include="Resources\PawnIo\IsaBridgeEC.bin" />
|
||||
<EmbeddedResource Include="Resources\PawnIo\LpcACPIEC.bin" />
|
||||
<EmbeddedResource Include="Resources\PawnIo\LpcCrOSEC.bin" />
|
||||
<EmbeddedResource Include="Resources\PawnIo\LpcIO.bin" />
|
||||
<EmbeddedResource Include="Resources\PawnIo\RyzenSMU.bin" />
|
||||
<EmbeddedResource Include="Resources\PawnIo\SmbusI801.bin" />
|
||||
<EmbeddedResource Include="Resources\PawnIo\SmbusNCT6793.bin" />
|
||||
<EmbeddedResource Include="Resources\PawnIo\SmbusPIIX4.bin" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' != 'net472'">
|
||||
<PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" />
|
||||
<PackageReference Include="System.IO.Ports" Version="10.0.1" />
|
||||
<PackageReference Include="System.IO.FileSystem.AccessControl" Version="5.0.0" />
|
||||
<PackageReference Include="Mono.Posix.NETStandard" Version="1.0.0" />
|
||||
<PackageReference Include="System.IO.FileSystem.AccessControl" Version="5.0.0" />
|
||||
<PackageReference Include="System.IO.Ports" Version="10.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="DiskInfoToolkit" Version="1.1.0" />
|
||||
<PackageReference Include="HidSharp" Version="2.6.4" />
|
||||
@@ -68,10 +72,12 @@
|
||||
<PackageReference Include="System.Memory" Version="4.6.3" Condition="'$(TargetFramework)' == 'net472'" />
|
||||
<PackageReference Include="System.Threading.AccessControl" Version="10.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="Resources\packageicon.png" PackagePath="">
|
||||
<Pack>True</Pack>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<Import Project="main.nuget.target" Condition="'$(PackMainNuget)' == 'true'" />
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user