Exemplo n.º 1
0
 /// <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;
 }
Exemplo n.º 2
0
        /// <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);
        }
Exemplo n.º 3
0
 /// <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;
 }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
 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);
     }
 }
Exemplo n.º 6
0
        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);
            }
        }
Exemplo n.º 7
0
 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);
 }