public static SolutionDescriptor CreateSolutionDescriptor(XmlElement element, IReadOnlyFileSystem fileSystem)
        {
            SolutionDescriptor solutionDescriptor = new SolutionDescriptor(element.Attributes["name"].InnerText);

            if (element["Options"] != null && element["Options"]["StartupProject"] != null) {
                solutionDescriptor.startupProject = element["Options"]["StartupProject"].InnerText;
            }

            solutionDescriptor.mainFolder.Read(element, fileSystem);
            return solutionDescriptor;
        }
        public static SolutionDescriptor CreateSolutionDescriptor(XmlElement element, IReadOnlyFileSystem fileSystem)
        {
            SolutionDescriptor solutionDescriptor = new SolutionDescriptor(element.Attributes["name"].InnerText);

            if (element["Options"] != null && element["Options"]["StartupProject"] != null)
            {
                solutionDescriptor.startupProject = element["Options"]["StartupProject"].InnerText;
            }

            solutionDescriptor.mainFolder.Read(element, fileSystem);
            return(solutionDescriptor);
        }
		public ProjectTemplateImpl(XmlDocument doc, IReadOnlyFileSystem fileSystem)
		{
			var templateElement = doc.DocumentElement;
			originator   = templateElement.GetAttribute("originator");
			created      = templateElement.GetAttribute("created");
			lastmodified = templateElement.GetAttribute("lastModified");
			
			string newProjectDialogVisibleAttr  = templateElement.GetAttribute("newprojectdialogvisible");
			if (string.Equals(newProjectDialogVisibleAttr, "false", StringComparison.OrdinalIgnoreCase))
				newProjectDialogVisible = false;
			
			XmlElement config = templateElement["TemplateConfiguration"];
			
			name         = config["Name"].InnerText;
			category     = config["Category"].InnerText;
			
			if (config["LanguageName"] != null) {
				languagename = config["LanguageName"].InnerText;
				WarnObsoleteNode(config["LanguageName"], "use language attribute on the project node instead");
			}
			
			if (config["Subcategory"] != null) {
				subcategory = config["Subcategory"].InnerText;
			}
			
			if (config["Description"] != null) {
				description  = config["Description"].InnerText;
			}
			
			if (config["Icon"] != null) {
				icon = SD.ResourceService.GetImage(config["Icon"].InnerText);
			}
			
			if (config["SupportedTargetFrameworks"] != null) {
				var specifiedTargetFrameworks =
					config["SupportedTargetFrameworks"].InnerText.Split(';')
					.Select<string,TargetFramework>(TargetFramework.GetByName).ToArray();
				
				supportedTargetFrameworks = TargetFramework.TargetFrameworks.Where(fx => specifiedTargetFrameworks.Any(s => fx.IsBasedOn(s))).ToArray();
			} else {
				supportedTargetFrameworks = new TargetFramework[0];
			}
			
			if (templateElement["Solution"] != null) {
				solutionDescriptor = SolutionDescriptor.CreateSolutionDescriptor(templateElement["Solution"], fileSystem);
			} else if (templateElement["Combine"] != null) {
				solutionDescriptor = SolutionDescriptor.CreateSolutionDescriptor(templateElement["Combine"], fileSystem);
				WarnObsoleteNode(templateElement["Combine"], "Use <Solution> instead!");
			}
			
			if (templateElement["Project"] != null) {
				projectDescriptor = new ProjectDescriptor(templateElement["Project"], fileSystem);
			}
			
			if (solutionDescriptor == null && projectDescriptor == null
			    || solutionDescriptor != null && projectDescriptor != null)
			{
				throw new TemplateLoadException("Template must contain either Project or Solution node!");
			}
			
			// Read Actions;
			if (templateElement["Actions"] != null) {
				foreach (XmlElement el in templateElement["Actions"]) {
					Action<ProjectTemplateResult> action = ReadAction(el);
					if (action != null)
						openActions.Add(action);
				}
			}
		}
        public ProjectTemplateImpl(XmlDocument doc, IReadOnlyFileSystem fileSystem)
        {
            var templateElement = doc.DocumentElement;

            originator   = templateElement.GetAttribute("originator");
            created      = templateElement.GetAttribute("created");
            lastmodified = templateElement.GetAttribute("lastModified");

            string newProjectDialogVisibleAttr = templateElement.GetAttribute("newprojectdialogvisible");

            if (string.Equals(newProjectDialogVisibleAttr, "false", StringComparison.OrdinalIgnoreCase))
            {
                newProjectDialogVisible = false;
            }

            XmlElement config = templateElement["TemplateConfiguration"];

            name     = config["Name"].InnerText;
            category = config["Category"].InnerText;

            if (config["LanguageName"] != null)
            {
                languagename = config["LanguageName"].InnerText;
                WarnObsoleteNode(config["LanguageName"], "use language attribute on the project node instead");
            }

            if (config["Subcategory"] != null)
            {
                subcategory = config["Subcategory"].InnerText;
            }

            if (config["Description"] != null)
            {
                description = config["Description"].InnerText;
            }

            if (config["Icon"] != null)
            {
                icon = TemplateIconLoader.GetImage(config["Icon"].InnerText);
            }

            if (config["SupportedTargetFrameworks"] != null)
            {
                var specifiedTargetFrameworks =
                    config["SupportedTargetFrameworks"].InnerText.Split(';')
                    .Select <string, TargetFramework>(TargetFramework.GetByName).ToArray();

                supportedTargetFrameworks = SD.ProjectService.TargetFrameworks.Where(fx => specifiedTargetFrameworks.Any(s => fx.IsBasedOn(s))).ToArray();
            }
            else
            {
                supportedTargetFrameworks = new TargetFramework[0];
            }

            if (templateElement["Solution"] != null)
            {
                solutionDescriptor = SolutionDescriptor.CreateSolutionDescriptor(templateElement["Solution"], fileSystem);
            }
            else if (templateElement["Combine"] != null)
            {
                solutionDescriptor = SolutionDescriptor.CreateSolutionDescriptor(templateElement["Combine"], fileSystem);
                WarnObsoleteNode(templateElement["Combine"], "Use <Solution> instead!");
            }

            if (templateElement["Project"] != null)
            {
                projectDescriptor = new ProjectDescriptor(templateElement["Project"], fileSystem);
            }

            if (solutionDescriptor == null && projectDescriptor == null ||
                solutionDescriptor != null && projectDescriptor != null)
            {
                throw new TemplateLoadException("Template must contain either Project or Solution node!");
            }

            // Read Actions;
            if (templateElement["Actions"] != null)
            {
                foreach (XmlElement el in templateElement["Actions"])
                {
                    Action <ProjectTemplateResult> action = ReadAction(el);
                    if (action != null)
                    {
                        openActions.Add(action);
                    }
                }
            }
        }