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