Fix crash of LibreHardwareMonitorLib using Linux and Net5 / Add RAM support for linux (#573)

Thanks to @Tederean.
This commit is contained in:
Florian Porsch
2022-02-07 17:18:16 +01:00
committed by GitHub
parent 5152b435fc
commit ca615c952f
6 changed files with 119 additions and 7 deletions
@@ -225,7 +225,12 @@ namespace LibreHardwareMonitor.Hardware
if (Software.OperatingSystem.IsUnix)
{
#if NETFRAMEWORK
Assembly assembly = Assembly.Load("Mono.Posix, Version=2.0.0.0, Culture=neutral, " + "PublicKeyToken=0738eb9f132ed756");
#else
Assembly assembly = Assembly.Load("Mono.Posix.NETStandard, Version=1.0.0.0, Culture=neutral");
#endif
Type sysCall = assembly.GetType("Mono.Unix.Native.Syscall");
MethodInfo mmap = sysCall.GetMethod("mmap");
@@ -265,7 +270,12 @@ namespace LibreHardwareMonitor.Hardware
if (Software.OperatingSystem.IsUnix)
{
#if NETFRAMEWORK
Assembly assembly = Assembly.Load("Mono.Posix, Version=2.0.0.0, Culture=neutral, " + "PublicKeyToken=0738eb9f132ed756");
#else
Assembly assembly = Assembly.Load("Mono.Posix.NETStandard, Version=1.0.0.0, Culture=neutral");
#endif
Type sysCall = assembly.GetType("Mono.Unix.Native.Syscall");
MethodInfo method = sysCall.GetMethod("munmap");
method?.Invoke(null, new object[] { _codeBuffer, _size });