Files
ThreadPilot/Models/PersistentProcessRule.cs
T
PrimeBuild-pc 5d19a46fc1 feat: per-process efficiency mode (EcoQoS) for live processes and rules
Closes #66.

- Native: SetProcessInformation/GetProcessInformation with
  ProcessPowerThrottling (EXECUTION_SPEED), three states: Windows decides,
  On (EcoQoS), Off (never throttle / HighQoS).
- Process tab: context menu entries, a picker with Apply in the details
  panel, current state in the summary, undo of the last change, included
  when saving current settings as a rule (only if explicitly set).
- Rules: EfficiencyMode + ApplyEfficiencyModeOnStart, applied by the rules
  engine, editable in the saved-rule editor, validated on import and part
  of conflict detection.
- The summary flags when the global Power Throttling tweak voids it. CPU
  priority is left alone, unlike Task Manager's efficiency mode.
- Localized in all seven languages.
2026-10-14 17:16:36 +02:00

99 lines
2.8 KiB
C#

/*
* ThreadPilot - persistent process rule models.
*/
namespace ThreadPilot.Models
{
using System;
using System.Diagnostics;
public sealed record PersistentProcessRule
{
public string Id { get; init; } = Guid.NewGuid().ToString("N");
public string Name { get; init; } = string.Empty;
public bool IsEnabled { get; init; }
public string? ProcessName { get; init; }
public string? ExecutablePath { get; init; }
public CpuSelection? CpuSelection { get; init; }
public long? LegacyAffinityMask { get; init; }
public CpuAssignmentMode CpuAssignmentMode { get; init; } = CpuAssignmentMode.Automatic;
public ProcessPriorityClass? Priority { get; init; }
public ProcessMemoryPriority? MemoryPriority { get; init; }
public ProcessIoPriority? IoPriority { get; init; }
public ProcessEfficiencyMode? EfficiencyMode { get; init; }
public bool ApplyAffinityOnStart { get; init; }
public bool ApplyPriorityOnStart { get; init; }
public bool ApplyMemoryPriorityOnStart { get; init; }
public bool ApplyIoPriorityOnStart { get; init; }
public bool ApplyEfficiencyModeOnStart { get; init; }
public bool PreventSystemSleepWhileRunning { get; init; }
public DateTime CreatedAt { get; init; } = DateTime.UtcNow;
public DateTime UpdatedAt { get; init; } = DateTime.UtcNow;
public string? Description { get; init; }
}
public sealed record PersistentRuleApplyResult
{
public bool Success { get; init; }
public string RuleId { get; init; } = string.Empty;
public int ProcessId { get; init; }
public string ProcessName { get; init; } = string.Empty;
public bool AffinityApplied { get; init; }
public bool PriorityApplied { get; init; }
public ProcessPriorityClass? RequestedPriority { get; init; }
public ProcessPriorityClass? ObservedPriority { get; init; }
public bool PriorityVerified { get; init; }
public bool PriorityVerificationUnavailable { get; init; }
public string? PriorityVerificationPhase { get; init; }
public bool MemoryPriorityApplied { get; init; }
public bool IoPriorityApplied { get; init; }
public bool EfficiencyModeApplied { get; init; }
public bool PreventSleepApplied { get; init; }
public string? ErrorCode { get; init; }
public string UserMessage { get; init; } = string.Empty;
public string TechnicalMessage { get; init; } = string.Empty;
public bool IsAccessDenied { get; init; }
public bool IsAntiCheatLikely { get; init; }
public bool IsProcessExited { get; init; }
}
}