Ejemplo n.º 1
0
        /// <summary>
        /// Open a project
        /// </summary>
        /// <param name="fullpath">the full path of the xml file</param>
        public void Open(string fullpath)
        {
            // set project fullpath
            FileName = Path.GetFileName(fullpath);

            // set project save path
            string path = Path.GetDirectoryName(fullpath);

            ProjectPath = path;

            // load document
            XDocument document = XDocument.Load(fullpath, LoadOptions.SetLineInfo);

            // set project name
            XAttribute name = document.Root.Attribute("name");

            if (name == null)
            {
                throw new InvalidXMLException("project root node does not contain a name attribute");
            }
            ProjectName = name.Value;

            // load filetree from the xml
            FileTree.LoadFromXML(document.Root);
            ProjectIsOpen = true;
        }