| 12345678910111213141516171819202122232425262728293031 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Net.Mime;
- using System.Text;
- using System.Threading.Tasks;
- using MqttMsgServer.Tools;
- namespace MqttMsgServer
- {
- 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;
- }
- }
- }
|