dropped support for WinForms and .NET 4.7.2. Refactored to modern .NET and C#

This commit is contained in:
2026-06-10 22:41:05 -05:00
parent 193de6059e
commit e23feff44d
235 changed files with 28 additions and 24958 deletions
+2 -2
View File
@@ -629,10 +629,10 @@ public class Computer : IComputer
cancellationToken.ThrowIfCancellationRequested();
_smbios = Measure(startupTrace, "SMBios", () => new SMBios());
if (Software.OperatingSystem.IsWindows8OrGreater)
if (!Software.OperatingSystem.IsUnix)
Measure(startupTrace, "Mutexes.Open", Mutexes.Open);
else
startupTrace?.Skip("Mutexes.Open", "Operating system is older than Windows 8.");
startupTrace?.Skip("Mutexes.Open", "Operating system is not Windows.");
cancellationToken.ThrowIfCancellationRequested();
Measure(startupTrace, "OpCode.Open", OpCode.Open);
+1 -5
View File
@@ -1,4 +1,4 @@
using System;
using System;
using System.Security.AccessControl;
using System.Security.Principal;
using System.Threading;
@@ -32,11 +32,7 @@ internal static class Mutexes
var mutexSecurity = new MutexSecurity();
mutexSecurity.AddAccessRule(worldRule);
#if NETFRAMEWORK
return new Mutex(false, name, out _, mutexSecurity);
#else
return MutexAcl.Create(false, name, out _, mutexSecurity);
#endif
}
catch (UnauthorizedAccessException)
{
+1 -34
View File
@@ -1,4 +1,4 @@
// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.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.
@@ -7,11 +7,7 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
#if !NETFRAMEWORK
using Mono.Unix.Native;
#else
using System.Reflection;
#endif
using Windows.Win32;
using Windows.Win32.System.Memory;
@@ -234,30 +230,9 @@ internal static class OpCode
if (Software.OperatingSystem.IsUnix)
{
#if NETFRAMEWORK
Assembly assembly = Assembly.Load("Mono.Posix, Version=2.0.0.0, Culture=neutral, " + "PublicKeyToken=0738eb9f132ed756");
Type sysCall = assembly.GetType("Mono.Unix.Native.Syscall");
MethodInfo mmap = sysCall.GetMethod("mmap");
Type mmapProts = assembly.GetType("Mono.Unix.Native.MmapProts");
object mmapProtsParam = Enum.ToObject(mmapProts,
(int)mmapProts.GetField("PROT_READ").GetValue(null) |
(int)mmapProts.GetField("PROT_WRITE").GetValue(null) |
(int)mmapProts.GetField("PROT_EXEC").GetValue(null));
Type mmapFlags = assembly.GetType("Mono.Unix.Native.MmapFlags");
object mmapFlagsParam = Enum.ToObject(mmapFlags,
(int)mmapFlags.GetField("MAP_ANONYMOUS").GetValue(null) |
(int)mmapFlags.GetField("MAP_PRIVATE").GetValue(null));
if (mmap != null)
_codeBuffer = (IntPtr)mmap.Invoke(null, [IntPtr.Zero, _size, mmapProtsParam, mmapFlagsParam, -1, 0]);
#else
_codeBuffer = Syscall.mmap(IntPtr.Zero, _size,
MmapProts.PROT_READ | MmapProts.PROT_WRITE | MmapProts.PROT_EXEC,
MmapFlags.MAP_ANONYMOUS | MmapFlags.MAP_PRIVATE, -1, 0);
#endif
}
else
{
@@ -281,15 +256,7 @@ internal static class OpCode
if (Software.OperatingSystem.IsUnix)
{
#if NETFRAMEWORK
Assembly assembly = Assembly.Load("Mono.Posix, Version=2.0.0.0, Culture=neutral, " + "PublicKeyToken=0738eb9f132ed756");
Type sysCall = assembly.GetType("Mono.Unix.Native.Syscall");
MethodInfo method = sysCall.GetMethod("munmap");
method?.Invoke(null, [_codeBuffer, _size]);
#else
Syscall.munmap(_codeBuffer, _size);
#endif
}
else
{
@@ -1,4 +1,4 @@
// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.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) Florian K. (Blacktempel)
// All Rights Reserved.
@@ -74,7 +74,7 @@ public sealed class WireViewPro2 : Hardware, IPowerMonitor
{
var devices = new List<WireViewPro2>();
if (!Software.OperatingSystem.IsWindows8OrGreater)
if (Software.OperatingSystem.IsUnix)
{
return devices; //No Linux implementation yet
}