lss
2025-05-30 38eff4fc0100131b180ffa872009b502629743f5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
 
namespace HH.WCS.JingyuNongfu.util
{
    public class XmlHelper
    {
        public static string xmlPath = "";
        public static string xmlFileName = "settings.xml";
        public static XmlDocument xmldoc = new XmlDocument();
        static XmlHelper()
        {
            xmlPath = System.IO.Directory.GetCurrentDirectory();
            xmlPath += "/" + xmlFileName;
            xmldoc.Load(xmlPath);
        }
 
        public static string GetElementValue(string name) {
            string result = string.Empty;
            XmlNode xn = xmldoc.SelectSingleNode("Custom");
            XmlNodeList xnl = xn.ChildNodes;
            foreach (object node in xnl) {
                XmlElement xe = node as XmlElement;
                if (xe == null)
                    continue;
 
                if (xe.Name == name) {
                    result = xe.InnerText;
                    break;
                }
            }
            return result;
        }
    }
}