Пример #1
0
        /// <summary>
        /// Loads the project from the given path.
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public static Project LoadXml(XmlDocument document)
        {
            if (document == null)
            {
                throw new ArgumentNullException("document");
            }

            // select the project node...
            XmlElement projectElement = (XmlElement)document.SelectSingleNode("Project");

            if (projectElement == null)
            {
                throw new InvalidOperationException("Project element not found.");
            }

            // create...
            Project newProject = new Project();

            // load settings...
            XmlElement settingsElement = (XmlElement)projectElement.SelectSingleNode("Settings");

            if (settingsElement != null)
            {
                newProject.Settings = Settings.FromXml(settingsElement);
            }

            // load settings...
//			XmlElement extendedPropertySettingsElement = (XmlElement)projectElement.SelectSingleNode("ExtendedPropertySettings");
//			if(extendedPropertySettingsElement != null)
//				newProject.ExtendedPropertySettings = ExtendedPropertySettings.FromXml(extendedPropertySettingsElement);
//			else
//				newProject.ExtendedPropertySettings = new ExtendedPropertySettings();

            // merge the schema in...
            XmlElement schemaElement = (XmlElement)projectElement.SelectSingleNode("SqlSchema");

            if (schemaElement != null)
            {
                newProject.Schema = SqlSchema.FromXml(schemaElement);
            }

            // flag...
            newProject.SetDirty(false);

            // return...
            return(newProject);
        }