-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathAutoTuneAutomationSettings.cs
More file actions
27 lines (21 loc) · 1.22 KB
/
AutoTuneAutomationSettings.cs
File metadata and controls
27 lines (21 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
using System;
using TidyWindow.Core.Automation;
namespace TidyWindow.App.Services;
public sealed record AutoTuneAutomationSettings(bool AutomationEnabled, string ProcessNames, string PresetId, DateTimeOffset? LastRunUtc)
{
public static AutoTuneAutomationSettings Default => new(false, string.Empty, "LatencyBoost", null);
public AutoTuneAutomationSettings Normalize()
{
var processes = string.IsNullOrWhiteSpace(ProcessNames) ? string.Empty : ProcessNames.Trim();
var preset = string.IsNullOrWhiteSpace(PresetId) ? "LatencyBoost" : PresetId.Trim();
return this with { ProcessNames = processes, PresetId = preset };
}
public AutoTuneAutomationSettings WithLastRun(DateTimeOffset timestamp) => this with { LastRunUtc = timestamp };
}
public sealed record AutoTuneAutomationRunResult(DateTimeOffset ExecutedAtUtc, PowerShellInvocationResult? InvocationResult, bool WasSkipped, string? SkipReason)
{
public static AutoTuneAutomationRunResult Create(DateTimeOffset timestamp, PowerShellInvocationResult result)
=> new(timestamp, result, false, null);
public static AutoTuneAutomationRunResult Skipped(DateTimeOffset timestamp, string? reason)
=> new(timestamp, null, true, reason);
}