コード例 #1
0
ファイル: CommonProject.cs プロジェクト: ichengzi/atnets
 /// <summary>
 /// 建立一个新的工程
 /// </summary>
 /// <param name="fileName">新建工程文件的完整路径</param>
 public static IProject NewProject(string fileName)
 {
     fileName = fileName + ".atnprj";
     IProject project = new CommonProject(fileName);
     XElement xElement = new XElement("Project",
         new XElement("Name", project.Name),
         new XElement("GuidID", project.GuidID),
         new XElement("Items", ""));
     xElement.Save(fileName);
     return project;
 }
コード例 #2
0
ファイル: CommonProject.cs プロジェクト: ichengzi/atnets
        /// <summary>
        /// 建立一个新的工程
        /// </summary>
        /// <param name="fileName">新建工程文件的完整路径</param>
        public static IProject NewProject(string fileName)
        {
            fileName = fileName + ".atnprj";
            IProject project  = new CommonProject(fileName);
            XElement xElement = new XElement("Project",
                                             new XElement("Name", project.Name),
                                             new XElement("GuidID", project.GuidID),
                                             new XElement("Items", ""));

            xElement.Save(fileName);
            return(project);
        }
コード例 #3
0
ファイル: ParseProject.cs プロジェクト: ichengzi/atnets
 /// <summary>
 /// 转换文件到Project对象
 /// </summary>
 /// <param name="fileName"></param>
 /// <returns></returns>
 public static IProject ParseToProject(string fileName)
 {
     IProject project;
     if (!File.Exists(fileName))
     {
         throw new FileNotFoundException(fileName);
     }
     XElement rootElement = XElement.Load(fileName);
     IEnumerable<XElement> element = from el in rootElement.Elements() select el;
     string guid = element.Where(el => el.Name == "GuidID").First<XElement>().Value;
     project = new CommonProject(fileName, guid);
     ParseToProjectItem(rootElement,project);
     return project;
 }
コード例 #4
0
ファイル: CommonProject.cs プロジェクト: ichengzi/atnets
        protected override void Save(string fileName)
        {
            if (fileName.IndexOf(".atnprj") == -1)
            {
                fileName = fileName + ".atnprj";
            }
            IProject project  = new CommonProject(fileName);
            XElement xElement = new XElement("Project",
                                             new XElement("Name", project.Name),
                                             new XElement("GuidID", project.GuidID),
                                             new XElement("Items", ""));

            xElement.Save(fileName);
        }
コード例 #5
0
ファイル: CommonProject.cs プロジェクト: ichengzi/atnets
 public override void SaveAs(string fileName)
 {
     OpenFileDialog openFileDialog = new OpenFileDialog();
     openFileDialog.InitialDirectory = "projects";
     openFileDialog.DefaultExt = "atnprj";
     openFileDialog.Filter = "Atnet Project files (*.atnprj)|*.atnprj";
     openFileDialog.ShowDialog();
     if (openFileDialog.FileName != null && openFileDialog.FileName != "")
     {
         IProject project = new CommonProject(openFileDialog.FileName);
         XElement xElement = new XElement("Project",
             new XElement("Name", project.Name),
             new XElement("GuidID", project.GuidID),
             new XElement("Items", ""));
         xElement.Save(openFileDialog.FileName);
     }
 }
コード例 #6
0
ファイル: CommonProject.cs プロジェクト: ichengzi/atnets
        public override void SaveAs(string fileName)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.InitialDirectory = "projects";
            openFileDialog.DefaultExt       = "atnprj";
            openFileDialog.Filter           = "Atnet Project files (*.atnprj)|*.atnprj";
            openFileDialog.ShowDialog();
            if (openFileDialog.FileName != null && openFileDialog.FileName != "")
            {
                IProject project  = new CommonProject(openFileDialog.FileName);
                XElement xElement = new XElement("Project",
                                                 new XElement("Name", project.Name),
                                                 new XElement("GuidID", project.GuidID),
                                                 new XElement("Items", ""));
                xElement.Save(openFileDialog.FileName);
            }
        }
コード例 #7
0
ファイル: CommonProject.cs プロジェクト: ichengzi/atnets
 protected override void Save(string fileName)
 {
     if (fileName.IndexOf(".atnprj") == -1)
     {
         fileName = fileName + ".atnprj";
     }
     IProject project = new CommonProject(fileName);
     XElement xElement = new XElement("Project",
         new XElement("Name", project.Name),
         new XElement("GuidID", project.GuidID),
         new XElement("Items", ""));
     xElement.Save(fileName);
 }