Revize c2cc7813
Přidáno uživatelem Pultak před asi 3 roky(ů)
ld_client/LDClient/LDClient.csproj | ||
---|---|---|
24 | 24 |
</ItemGroup> |
25 | 25 |
|
26 | 26 |
<ItemGroup> |
27 |
<PackageReference Include="DiskQueue" Version="1.5.0" /> |
|
27 | 28 |
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" /> |
28 | 29 |
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" /> |
29 | 30 |
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" /> |
30 | 31 |
<PackageReference Include="RestSharp" Version="107.3.0" /> |
31 | 32 |
<PackageReference Include="System.Configuration.ConfigurationManager" Version="6.0.0" /> |
33 |
<PackageReference Include="System.Management" Version="6.0.0" /> |
|
32 | 34 |
</ItemGroup> |
33 | 35 |
|
34 | 36 |
</Project> |
ld_client/LDClient/appsettings.json | ||
---|---|---|
16 | 16 |
}, |
17 | 17 |
|
18 | 18 |
"Network": { |
19 |
"ApiBaseAddress": "http://192.168.0.22",
|
|
19 |
"ApiBaseAddress": "http://127.0.0.1",
|
|
20 | 20 |
"ApiLDEndPoint": "/lauterbach-debugger-logs/", |
21 |
"ApiPort": 8000, |
|
22 |
"ApiRetryPeriod": 1, |
|
23 |
|
|
21 |
"ApiPort": 8000 |
|
22 |
}, |
|
23 |
"Cache": { |
|
24 |
"RetryPeriod": 1, |
|
25 |
"MaxEntries": 20, |
|
26 |
"MaxRetries": 5, |
|
27 |
"CacheFileName": "cache" |
|
28 |
}, |
|
29 |
"DebuggerDetection": { |
|
24 | 30 |
"DebuggerAddress": "localhost", |
25 |
"DebuggerPort": 20000 |
|
31 |
"DebuggerPort": 20000, |
|
32 |
"DebuggerProcessName": "t32mtc" |
|
26 | 33 |
} |
27 | 34 |
} |
ld_client/LDClient/utils/ConfigLoader.cs | ||
---|---|---|
5 | 5 |
internal class ConfigLoader { |
6 | 6 |
private const string LoggingSection = "Logging"; |
7 | 7 |
private const string NetworkSection = "Network"; |
8 |
private const string CacheSection = "Cache"; |
|
9 |
private const string DDSection = "DebuggerDetection"; |
|
8 | 10 |
|
9 |
|
|
11 |
#region Logger |
|
10 | 12 |
public int LogChunkSize { get; set; } |
11 | 13 |
public int LogChunkMaxCount { get; set; } |
12 | 14 |
public int LogArchiveMaxCount { get; set; } |
... | ... | |
16 | 18 |
public LogVerbosity LogVerbosityType { get; set; } = LogVerbosity.Full; |
17 | 19 |
|
18 | 20 |
public LogFlow LogFlowType { get; set; } = LogFlow.Console; |
21 |
#endregion |
|
19 | 22 |
|
23 |
#region Api |
|
20 | 24 |
public string ApiBaseAddress { get; set; } |
21 | 25 |
public string ApiUsbEndPoint { get; set; } |
22 | 26 |
public uint ApiPort { get; set; } |
23 |
public uint ApiRetryPeriod { get; set; } |
|
24 | 27 |
|
28 |
#endregion |
|
29 |
|
|
30 |
#region Cache |
|
31 |
public string CacheFileName { get; set; } |
|
32 |
public uint MaxRetries { get; set; } |
|
33 |
public uint MaxEntries { get; set; } |
|
34 |
public uint RetryPeriod { get; set; } |
|
35 |
#endregion |
|
36 |
|
|
37 |
#region Detection |
|
25 | 38 |
public string DebuggerAddress { get; set; } |
26 | 39 |
public int DebuggerPort { get; set; } |
40 |
public string DebuggerProcessName { get; set; } |
|
41 |
#endregion |
|
27 | 42 |
|
28 | 43 |
public ConfigLoader() { |
29 | 44 |
var configuration = new ConfigurationBuilder() |
... | ... | |
48 | 63 |
ApiBaseAddress = network["ApiBaseAddress"]; |
49 | 64 |
ApiUsbEndPoint = network["ApiLDEndPoint"]; |
50 | 65 |
ApiPort = uint.Parse(network["ApiPort"]); |
51 |
ApiRetryPeriod = uint.Parse(network["ApiRetryPeriod"]); |
|
52 | 66 |
|
53 | 67 |
|
54 |
DebuggerAddress = network["DebuggerAddress"]; |
|
55 |
DebuggerPort = int.Parse(network["DebuggerPort"]); |
|
68 |
var cache = configuration.GetSection(CacheSection); |
|
69 |
RetryPeriod = uint.Parse(cache["RetryPeriod"]); |
|
70 |
MaxEntries = uint.Parse(cache["MaxEntries"]); |
|
71 |
MaxRetries = uint.Parse(cache["MaxRetries"]); |
|
72 |
CacheFileName = cache["CacheFileName"]; |
|
73 |
|
|
74 |
|
|
75 |
var debugger = configuration.GetSection(DDSection); |
|
76 |
DebuggerAddress = debugger["DebuggerAddress"]; |
|
77 |
DebuggerPort = int.Parse(debugger["DebuggerPort"]); |
|
78 |
DebuggerProcessName = debugger["DebuggerProcessName"]; |
|
56 | 79 |
|
57 | 80 |
Console.WriteLine("Configuration successfully loaded!"); |
58 | 81 |
} catch (FormatException e) { |
... | ... | |
62 | 85 |
throw new IOException("Reading of configuration file failed! " + e); |
63 | 86 |
} |
64 | 87 |
} |
65 |
|
|
66 | 88 |
} |
67 | 89 |
} |
Také k dispozici: Unified diff
re #9441 Added configuration properties + library added to project structure