Blogposter.Utils.OpenXmlfile C# (CSharp) Метод

OpenXmlfile() публичный статический Метод

public static OpenXmlfile ( ) : XmlDocument
Результат System.Xml.XmlDocument
        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;
        }