/// <summary> /// 获取一个项目类 /// </summary> /// <param name="projectnode">xml项目节点</param> /// /// <param name="dictionary">上级目录</param> /// <returns></returns> protected ProjectClass GetProjectClass(XmlElement projectnode, string dictionary) { string name = projectnode.GetAttribute("ProjectName"); ProjectClass pro = new ProjectClass(this.ProjectLanguage); pro.RootPath = dictionary; pro.OutPath = dictionary + "bin//Debug//"; pro.FilesPath = dictionary; pro.ConfigFilePath = dictionary + name; pro.ProjectName = name; XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(pro.ConfigFilePath); XmlElement rootElenemts = (XmlElement)xmlDoc.SelectSingleNode("Config"); //pro.ProjectName = rootElenemts.GetAttribute("ProjectName"); XmlNodeList ProjectFileNodelist = rootElenemts.SelectNodes("ProjectFile"); foreach (XmlElement enemt in ProjectFileNodelist) { ///获取文件名 string filename = enemt.GetAttribute("FileName"); PicTransfromXmlFile transf = new PicTransfromXmlFile(); pro.AddPicTabPage(transf.XmlToPic(dictionary + filename)); } ///保存关闭文件 xmlDoc.Save(pro.ConfigFilePath); ///设置项目语言 pro.Language = this.ProjectLanguage; return(pro); }
/// <summary> /// 保存这个项目的所有文件 /// </summary> public void SaveProject() { ///保存配置文件 UpdateConfigFile.UpdateConfig(MyListProjectFiles, ConfigFilePath, ProjectName); ///保存如文件 PicTransfromXmlFile writefile = new PicTransfromXmlFile(); ///循环所有代码 foreach (PicTabPage page in MyListPicPage.Values) { writefile.PicToXml(page, FilesPath); } }