Projekt

Obecné

Profil

Stáhnout (1.09 KB) Statistiky
| Větev: | Tag: | Revize:
1 aaad9ad4 Pultak
using LDClient.network;
2 4b0f0b36 Pultak
using LDClient.utils;
3 74bd1e40 Pultak
using LDClient.utils.loggers;
4 c318a92c Pultak
5 74bd1e40 Pultak
namespace LDClient; 
6 c318a92c Pultak
7 74bd1e40 Pultak
internal class Program {
8 c318a92c Pultak
9 4b0f0b36 Pultak
    public static ConfigLoader Config { get; set; } = new();
10
    public static ALogger DefaultLogger { get; } = ALogger.Current;
11 71520576 Pultak
12 4b0f0b36 Pultak
    public static IApiClient DefaultApiClient { get; set; } = new ApiClient(Config.ApiBaseAddress,
13 aaad9ad4 Pultak
        Config.ApiPort, Config.ApiUsbEndPoint, Config.RetryPeriod, Config.MaxEntries,
14
        Config.MaxRetries, Config.CacheFileName);
15 c318a92c Pultak
16 4b0f0b36 Pultak
    // Main Method
17
    public static async Task Main() {
18 aaad9ad4 Pultak
19
        var apiClientThread = new Thread(DefaultApiClient.Run) {
20
            IsBackground = true
21
        };
22
        apiClientThread.Start();
23
24
        DefaultLogger.Debug("Main -> starting SendPayloadAsync");
25 4b0f0b36 Pultak
        await DefaultApiClient.SendPayloadAsync(ApiClient.ExampleInfo);
26 aaad9ad4 Pultak
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 c318a92c Pultak
    }
37
}