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