Revize f281acac
Přidáno uživatelem Jakub Šilhavý před asi 2 roky(ů)
ld_client/LDClient/utils/ConfigLoader.cs | ||
---|---|---|
2 | 2 |
using Microsoft.Extensions.Configuration; |
3 | 3 |
|
4 | 4 |
namespace LDClient.utils { |
5 |
|
|
5 | 6 |
internal class ConfigLoader { |
7 |
|
|
6 | 8 |
private const string LoggingSection = "Logging"; |
7 | 9 |
private const string NetworkSection = "Network"; |
8 | 10 |
private const string CacheSection = "Cache"; |
9 |
private const string DDSection = "DebuggerDetection";
|
|
11 |
private const string DdSection = "DebuggerDetection";
|
|
10 | 12 |
|
11 | 13 |
#region Logger |
12 |
public int LogChunkSize { get; set; } |
|
13 |
public int LogChunkMaxCount { get; set; }
|
|
14 |
public int LogArchiveMaxCount { get; set; }
|
|
15 |
|
|
16 |
public int LogCleanupPeriod { get; set; } |
|
17 |
|
|
18 |
public LogVerbosity LogVerbosityType { get; set; } = LogVerbosity.Full; |
|
19 |
|
|
20 |
public LogFlow LogFlowType { get; set; } = LogFlow.Console; |
|
14 |
|
|
15 |
public int LogChunkSize { get; private set; }
|
|
16 |
public int LogChunkMaxCount { get; private set; }
|
|
17 |
public int LogArchiveMaxCount { get; private set; } |
|
18 |
|
|
19 |
public int LogCleanupPeriod { get; private set; } |
|
20 |
public LogVerbosity LogVerbosityType { get; private set; } = LogVerbosity.Full;
|
|
21 |
public LogFlow LogFlowType { get; private set; } = LogFlow.Console; |
|
22 |
|
|
21 | 23 |
#endregion |
22 | 24 |
|
23 | 25 |
#region Api |
24 |
public string ApiBaseAddress { get; set; } |
|
25 |
public string ApiUsbEndPoint { get; set; } |
|
26 |
public uint ApiPort { get; set; } |
|
26 |
|
|
27 |
public string ApiBaseAddress { get; private set; } |
|
28 |
public string ApiUsbEndPoint { get; private set; } |
|
29 |
public uint ApiPort { get; private set; } |
|
27 | 30 |
|
28 | 31 |
#endregion |
29 | 32 |
|
30 | 33 |
#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; } |
|
34 |
|
|
35 |
public string CacheFileName { get; private set; } |
|
36 |
public uint MaxRetries { get; private set; } |
|
37 |
public uint MaxEntries { get; private set; } |
|
38 |
public uint RetryPeriod { get; private set; } |
|
39 |
|
|
35 | 40 |
#endregion |
36 | 41 |
|
37 | 42 |
#region Detection |
38 |
public string T32Address { get; set; } |
|
39 |
public int T32Port { get; set; } |
|
40 |
public string T32ProcessName { get; set; } |
|
41 |
public uint DetectionPeriod { get; set; } |
|
42 |
public string T32InfoLocation { get; set; } |
|
43 |
public string T32ProcessName { get; private set; } |
|
44 |
public uint DetectionPeriod { get; private set; } |
|
45 |
public string T32InfoLocation { get; private set; } |
|
43 | 46 |
#endregion |
44 | 47 |
|
45 | 48 |
public ConfigLoader() { |
... | ... | |
49 | 52 |
ReadAllSettings(configuration); |
50 | 53 |
} |
51 | 54 |
|
52 |
private void ReadAllSettings(IConfigurationRoot configuration) {
|
|
55 |
private void ReadAllSettings(IConfiguration configuration) { |
|
53 | 56 |
|
54 | 57 |
try { |
55 | 58 |
var logging = configuration.GetSection(LoggingSection); |
... | ... | |
74 | 77 |
CacheFileName = cache["CacheFileName"]; |
75 | 78 |
|
76 | 79 |
|
77 |
var debugger = configuration.GetSection(DDSection); |
|
78 |
T32Address = debugger["T32Address"]; |
|
79 |
T32Port = int.Parse(debugger["T32Port"]); |
|
80 |
var debugger = configuration.GetSection(DdSection); |
|
80 | 81 |
T32ProcessName = debugger["T32ProcessName"]; |
81 | 82 |
T32InfoLocation = debugger["T32InfoLocation"]; |
82 | 83 |
DetectionPeriod = uint.Parse(debugger["DetectionPeriod"]); |
Také k dispozici: Unified diff
re #9566 Added InfoFetcher.cs, modified some other files (a bit of refactoring)