bffbdeeccc
Add persistent rules engine foundation Introduce the foundation for Apply at process start without adding a background loop, Windows Service, installer changes, registry affinity or anti-cheat bypass behavior. - Add PersistentProcessRule and PersistentRuleApplyResult models - Add process-name and executable-path rule matching - Add PersistentRulesEngine using existing safe affinity and priority services - Add JSON-backed persistent rule store - Add safe Apply at process start user-facing copy - Validate incomplete rules so missing affinity/priority payloads fail safely - Add tests for matching, CpuSelection, legacy affinity, priority, Realtime guardrails, access denied, protected processes, process exit, disabled rules and storage roundtrip No process monitor hook, UI management, Windows Service, registry/IFEO expansion, version bump or tag changes.
65 lines
1.6 KiB
C#
65 lines
1.6 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 bool ApplyAffinityOnStart { get; init; }
|
|
|
|
public bool ApplyPriorityOnStart { 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 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; }
|
|
}
|
|
}
|