protected override bool LoadDocument(XmlDocument doc) { XmlElement root = doc.DocumentElement; if (root == null || !Constants.TAG.Soluton.Equals(root.Name)) { return(false); } this.Type = root.GetAttribute(Constants.Attribute.Type); String version = root.GetAttribute(Constants.Attribute.Version); Dictionary <String, String> dProjectFile = new Dictionary <string, string>(); foreach (XmlElement group in root.ChildNodes) { if (Constants.TAG.Projects.Equals(group.Name)) { // ProjectGroup foreach (XmlElement itemElement in group.ChildNodes) { // 根据项目相关信息,创建项目实例; if (Constants.TAG.Project.Equals(itemElement.Name)) { String include = itemElement.GetAttribute(Constants.Attribute.FilePath); String projFile = this.GetFullPath(include); if (File.Exists(projFile)) { ProjectManager project = new ProjectManager(projFile); this.AddChild(project); project.Load(); } } } } else if (Constants.TAG.Global.Equals(group.Name)) { // Global } } this.UpdateActiveCpu(); return(true); }
public ProjectManager OpenProject(String projectFile) { if (!File.Exists(projectFile)) { return(null); } if (!ProjectManager.IsProjectFile(projectFile)) { return(null); } ProjectManager project = new ProjectManager(projectFile); project.Load(); this.AddChild(project); this.UpdateActiveCpu(); this.SaveFile(this.FullName); return(project); }