e3530e5342
Introduces new models, services, and view models for process monitoring, power plan association, application settings, and enhanced logging. Updates main application files and views to support new features. Adds developer and architecture documentation.
25 lines
774 B
C#
25 lines
774 B
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Windows.Controls;
|
|
|
|
namespace ThreadPilot.Helpers
|
|
{
|
|
public static class AffinityHelper
|
|
{
|
|
public static long CalculateAffinityMask(IEnumerable<System.Windows.Controls.CheckBox> cpuCheckboxes)
|
|
{
|
|
return cpuCheckboxes
|
|
.Where(cb => cb.IsChecked == true)
|
|
.Sum(cb => (long)cb.Tag);
|
|
}
|
|
|
|
public static void UpdateCheckboxesFromMask(IEnumerable<System.Windows.Controls.CheckBox> cpuCheckboxes, long affinityMask)
|
|
{
|
|
foreach (var checkbox in cpuCheckboxes)
|
|
{
|
|
var cpuBit = (long)checkbox.Tag;
|
|
checkbox.IsChecked = (affinityMask & cpuBit) != 0;
|
|
}
|
|
}
|
|
}
|
|
} |