Repository navigation
Expand file tree
/
Copy pathProgram.cs
More file actions
56 lines (48 loc) · 1.67 KB
/
Copy pathProgram.cs
File metadata and controls
56 lines (48 loc) · 1.67 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using System;
using System.Threading;
namespace CPUBoostManager
{
internal class Program
{
private static ProcessMonitor? _monitor;
private static PowerManager? _powerManager;
private static GameDetector? _gameDetector;
private static bool _isRunning = true;
static void Main(string[] args)
{
Console.WriteLine("CPU Boost Manager Starting...");
try
{
// Initialize components
_powerManager = new PowerManager();
_gameDetector = new GameDetector();
_monitor = new ProcessMonitor(_gameDetector, _powerManager);
// Start monitoring
_monitor.StartMonitoring();
Console.WriteLine("CPU Boost Manager is now running. Press Ctrl+C to exit.");
// Handle graceful shutdown
Console.CancelKeyPress += (sender, e) =>
{
e.Cancel = true;
_isRunning = false;
Shutdown();
};
// Keep the application running
while (_isRunning)
{
Thread.Sleep(1000);
}
}
catch (Exception ex)
{
Console.WriteLine($"Error: {ex.Message}");
}
}
private static void Shutdown()
{
Console.WriteLine("Shutting down CPU Boost Manager...");
_monitor?.StopMonitoring();
Console.WriteLine("CPU Boost Manager stopped.");
}
}
}