Update editorconfig + changes (#771)

This commit is contained in:
PhyxionNL
2022-06-29 19:38:57 +02:00
committed by GitHub
parent 47f33f91d9
commit 38b97e10d0
68 changed files with 1530 additions and 2287 deletions
@@ -34,10 +34,9 @@ namespace LibreHardwareMonitor.Hardware
/// <returns><c>true</c> if the specified affinity is valid; otherwise, <c>false</c>.</returns>
public static bool IsValid(GroupAffinity affinity)
{
if (Software.OperatingSystem.IsUnix)
if (Software.OperatingSystem.IsUnix && affinity.Group > 0)
{
if (affinity.Group > 0)
return false;
return false;
}
try
@@ -46,7 +45,6 @@ namespace LibreHardwareMonitor.Hardware
if (previousAffinity == GroupAffinity.Undefined)
return false;
Set(previousAffinity);
return true;
}
@@ -66,23 +64,19 @@ namespace LibreHardwareMonitor.Hardware
if (affinity == GroupAffinity.Undefined)
return GroupAffinity.Undefined;
if (Software.OperatingSystem.IsUnix)
{
if (affinity.Group > 0)
throw new ArgumentOutOfRangeException(nameof(affinity));
ulong result = 0;
if (LibC.sched_getaffinity(0, (IntPtr)8, ref result) != 0)
return GroupAffinity.Undefined;
ulong mask = affinity.Mask;
if (LibC.sched_setaffinity(0, (IntPtr)8, ref mask) != 0)
return GroupAffinity.Undefined;
return new GroupAffinity(0, result);
}
@@ -116,7 +110,6 @@ namespace LibreHardwareMonitor.Hardware
if (affinity.Group > 0)
throw new ArgumentOutOfRangeException(nameof(affinity));
ulong previous = (ulong)Kernel32.SetThreadAffinityMask(currentThread, uIntPtrMask);
return new GroupAffinity(0, previous);