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;
|
}
|
}
|
}
|