public static XmlDocument OpenXmlfile()
{
XmlDocument doc = new XmlDocument ();
try
{
doc.Load(settingsfile);
if (doc.ChildNodes [1].Name == "accounts")
{
string contents = doc.ChildNodes [1].InnerXml;
doc.LoadXml("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"+
"<preferences>" + contents + "</preferences>");
}
}
catch
{
doc.LoadXml("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"+
"<preferences></preferences>");
}
return doc;
}