1
|
using LDClient.network;
|
2
|
using LDClient.utils;
|
3
|
using LDClient.utils.loggers;
|
4
|
|
5
|
namespace LDClient;
|
6
|
|
7
|
internal class Program {
|
8
|
|
9
|
public static ConfigLoader Config { get; set; } = new();
|
10
|
public static ALogger DefaultLogger { get; } = ALogger.Current;
|
11
|
|
12
|
public static IApiClient DefaultApiClient { get; set; } = new ApiClient(Config.ApiBaseAddress,
|
13
|
Config.ApiPort, Config.ApiUsbEndPoint, Config.RetryPeriod, Config.MaxEntries,
|
14
|
Config.MaxRetries, Config.CacheFileName);
|
15
|
|
16
|
// Main Method
|
17
|
public static async Task Main() {
|
18
|
|
19
|
var apiClientThread = new Thread(DefaultApiClient.Run) {
|
20
|
IsBackground = true
|
21
|
};
|
22
|
apiClientThread.Start();
|
23
|
|
24
|
DefaultLogger.Debug("Main -> starting SendPayloadAsync");
|
25
|
await DefaultApiClient.SendPayloadAsync(ApiClient.ExampleInfo);
|
26
|
|
27
|
|
28
|
DefaultLogger.Debug("Main -> lets slack for a bit");
|
29
|
Thread.Sleep(30000);
|
30
|
|
31
|
DefaultLogger.Debug("Main -> stopping the ApiClient");
|
32
|
DefaultApiClient.Stop();
|
33
|
apiClientThread.Join();
|
34
|
DefaultLogger.Debug("Main -> finished");
|
35
|
}
|
36
|
}
|
37
|
}
|