Files
ThreadPilot/Models/PersistentProcessRule.cs
T
Prime Build 5f9f7b5409 Add process memory priority foundation (#15)
Add process memory priority foundation

Introduce backend support for process memory priority using Windows GetProcessInformation and SetProcessInformation while keeping the feature testable and safe.

- Add ProcessMemoryPriority model with documented Windows memory priority levels
- Add fakeable native API wrapper for process memory priority
- Add ProcessMemoryPriorityService with safe error handling
- Add ProcessOperationResult for process operation outcomes
- Extend persistent process rules with memory priority support
- Apply memory priority through PersistentRulesEngine when configured
- Preserve anti-cheat/protected-process safety messaging
- Add tests for native get/set, invalid process, access denied, unsupported API, enum mapping, persistent rules and JSON roundtrip

No UI redesign, registry/IFEO persistence, Windows Service, preset generator, migration, version or tag changes.
2026-05-20 21:45:21 +02:00

71 lines
1.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 ProcessPriorityClass? Priority { get; init; }
public ProcessMemoryPriority? MemoryPriority { get; init; }
public bool ApplyAffinityOnStart { get; init; }
public bool ApplyPriorityOnStart { get; init; }
public bool ApplyMemoryPriorityOnStart { 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 bool MemoryPriorityApplied { 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; }
}
}