markus / ConvertService / ServiceBase / Markus.Service.Extensions / Helper / ConfigHelper.cs @ 43e1d368
이력 | 보기 | 이력해설 | 다운로드 (989 Bytes)
1 |
|
---|---|
2 |
using Salaros.Configuration; |
3 |
using System; |
4 |
using System.Collections.Generic; |
5 |
using System.Globalization; |
6 |
using System.Linq; |
7 |
using System.Text; |
8 |
using System.Threading.Tasks; |
9 |
|
10 |
namespace Markus.Service.Helper |
11 |
{ |
12 |
public class ConfigHelper |
13 |
{ |
14 |
public static ConfigParser AppConfig(string ConfigFileName) |
15 |
{ |
16 |
var startDir = AppDomain.CurrentDomain.BaseDirectory; |
17 |
var configFilePath = $"{System.IO.Path.Combine(startDir, ConfigFileName)}"; |
18 |
|
19 |
if (!System.IO.File.Exists(configFilePath)) |
20 |
{ |
21 |
throw new Exception($"Config File Not Found. {configFilePath}"); |
22 |
} |
23 |
|
24 |
return new ConfigParser(configFilePath, |
25 |
new ConfigParserSettings |
26 |
{ |
27 |
MultiLineValues = MultiLineValues.Simple | MultiLineValues.AllowValuelessKeys | MultiLineValues.QuoteDelimitedValues, |
28 |
Culture = new CultureInfo("en-US") |
29 |
}); |
30 |
} |
31 |
} |
32 |
} |