markus / ConvertService / ServiceBase / Markus.Service.Station / Helper / ConfigHelper.cs @ ff4b1e6e
이력 | 보기 | 이력해설 | 다운로드 (1011 Bytes)
1 | 53c9637d | taeseongkim | using Markus.Service.Station; |
---|---|---|---|
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 |
||
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 | } |