MvcWrench.Models.ClassStatus.GetInstance C# (CSharp) Method

GetInstance() public static method

public static GetInstance ( string source ) : ClassStatus
source string
return ClassStatus
        public static ClassStatus GetInstance(string source)
        {
            if (instance == null) {
                ClassStatus status = new ClassStatus ();

                XmlDocument doc = new XmlDocument ();
                doc.Load (source);

                foreach (XmlElement p in doc.DocumentElement.SelectNodes ("/profiles/profile")) {
                    StatusProfile sp = new StatusProfile ();
                    sp.Name = p.GetAttribute ("name");
                    sp.Profile = p.GetAttribute ("profile");
                    sp.Reference = p.GetAttribute ("reference");
                    sp.Icon = p.GetAttribute ("icon");

                    foreach (XmlElement child in p.ChildNodes)
                        sp.Assemblies.Add (child.InnerText);

                    status.Profiles.Add (sp);
                }

                instance = status;
            }

            return instance;
        }