markus / ConvertService / ServiceBase / Markus.Service.Extensions / Helper / ConfigHelper.cs @ 8ebd5302
이력 | 보기 | 이력해설 | 다운로드 (989 Bytes)
1 | 43e1d368 | taeseongkim | |
---|---|---|---|
2 | using Salaros.Configuration; |
||
3 | 53c9637d | taeseongkim | 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 | 150747cb | taeseongkim | var startDir = AppDomain.CurrentDomain.BaseDirectory; |
17 | var configFilePath = $"{System.IO.Path.Combine(startDir, ConfigFileName)}"; |
||
18 | 53c9637d | taeseongkim | |
19 | 150747cb | taeseongkim | if (!System.IO.File.Exists(configFilePath)) |
20 | 53c9637d | taeseongkim | { |
21 | throw new Exception($"Config File Not Found. {configFilePath}"); |
||
22 | } |
||
23 | |||
24 | 150747cb | taeseongkim | return new ConfigParser(configFilePath, |
25 | 53c9637d | taeseongkim | new ConfigParserSettings |
26 | { |
||
27 | MultiLineValues = MultiLineValues.Simple | MultiLineValues.AllowValuelessKeys | MultiLineValues.QuoteDelimitedValues, |
||
28 | Culture = new CultureInfo("en-US") |
||
29 | }); |
||
30 | } |
||
31 | } |
||
32 | } |