Revize 6dab0250
Přidáno uživatelem Jakub Šilhavý před asi 2 roky(ů)
ld_client/LDClient/Program.cs | ||
---|---|---|
10 | 10 |
|
11 | 11 |
internal static class Program { |
12 | 12 |
|
13 |
private const int MainLoopDelayMs = 30000; |
|
14 |
|
|
13 | 15 |
public static ConfigLoader Config { get; } = new(); |
14 | 16 |
public static ALogger DefaultLogger { get; } = ALogger.Current; |
15 | 17 |
private static IApiClient? DefaultApiClient { get; set; } |
16 | 18 |
|
17 | 19 |
private static readonly InfoFetcher InfoFetcher = new( |
18 |
5, |
|
19 |
1000, |
|
20 |
"output.txt" |
|
20 |
Config.FetchInfoMaxAttempts, |
|
21 |
Config.FetchInfoAttemptPeriod, |
|
22 |
Config.T32InfoLocation, |
|
23 |
Config.F32RemExecutable, |
|
24 |
Config.F32RemArguments |
|
21 | 25 |
); |
22 | 26 |
|
23 | 27 |
public static int Main() { |
24 |
var exists = GetProcessesByName(Path.GetFileNameWithoutExtension(GetEntryAssembly()?.Location)).Length > 1; |
|
25 |
if (exists) { |
|
28 |
if (GetProcessesByName(Path.GetFileNameWithoutExtension(GetEntryAssembly()?.Location)).Length > 1) { |
|
26 | 29 |
DefaultLogger.Error("Another instance of the application is already running"); |
27 | 30 |
return 1; |
28 | 31 |
} |
... | ... | |
43 | 46 |
DefaultApiClient |
44 | 47 |
); |
45 | 48 |
|
46 |
DefaultLogger.Debug("Main -> starting the ApiClient"); |
|
47 | 49 |
var apiClientThread = new Thread(DefaultApiClient.Run) { |
48 | 50 |
IsBackground = true |
49 | 51 |
}; |
... | ... | |
55 | 57 |
processThread.Start(); |
56 | 58 |
|
57 | 59 |
while (true) { |
58 |
Thread.Sleep(10 * 1000);
|
|
60 |
Thread.Sleep(MainLoopDelayMs);
|
|
59 | 61 |
} |
62 |
|
|
60 | 63 |
return 0; |
61 | 64 |
} |
62 | 65 |
} |
Také k dispozici: Unified diff
re #9566 Moved magic values into the configuration file.