public static ArrayList XmlGetServer(string name)
{
if (!File.Exists(Settings.Default.cfgpath))
{
return new ArrayList();
}
ArrayList server = new ArrayList();
string host = "";
string user = "";
string pass = "";
int type = 0;
string file = Settings.Default.cfgpath;
XmlDocument xmldoc = new XmlDocument();
xmldoc.Load(file);
XmlNodeList xmlnode = xmldoc.SelectNodes("//*[@Name=" + ParseXpathString(name) + "]");
if (xmlnode != null)
{
if (xmlnode.Count > 0)
{
foreach (XmlElement childnode in xmlnode[0].ChildNodes)
{
switch (childnode.Name)
{
case "Host":
host = childnode.InnerText;
break;
case "User":
user = childnode.InnerText;
break;
case "Password":
pass = childnode.InnerText;
break;
case "Type":
Int32.TryParse(childnode.InnerText, out type);
break;
}
}
}
else return new ArrayList();
}
server.AddRange(new string[] {name, host, user, pass, type.ToString()});
return server;
}