using System; using System.Collections.Generic; using System.Linq; using System.Net.Mime; using System.Text; using System.Threading.Tasks; using WebScanner.Tools; namespace WebScanner { public class AppSetting { public static string AppConfigPath = $"{AppDomain.CurrentDomain.BaseDirectory}/AppConfig.xml"; public static string GetValue(string key) { XmlHelper xmlHelper = new XmlHelper(); var xmlNode = xmlHelper.GetXmlNodeByXpath(AppConfigPath, $"root/{key}"); return xmlNode?.InnerText; } public static int GetInt(string key) { string value = GetValue(key); if (int.TryParse(value, out var result)) { return result; } return result; } } }