public Project(XmlDocument xml) { if (xml.DocumentElement == null) { throw new ProjectLoadException(); } for (var i = 0; i < xml.DocumentElement.ChildNodes.Count; i++) { var node = xml.DocumentElement.ChildNodes.Item(i); if (node == null) { continue; } switch (node.Name) { case "ProjectPath": ProjectPath = node.InnerText; var sp = ProjectPath?.Split('\\'); ProjectName = sp.Length > 0 ? sp[sp.Length - 1].Split('.')[0] : "Invalid Project Name".Split('.')[0]; break; case "RackSetups": LoadRackSetups(node); break; } } }