Ejemplo n.º 1
0
        public static SolutionDescriptor CreateSolutionDescriptor(XmlElement element, string hintPath)
        {
            SolutionDescriptor solutionDescriptor = new SolutionDescriptor(element.Attributes["name"].InnerText);

            if (element.Attributes["directory"] != null)
            {
                solutionDescriptor.relativeDirectory = element.Attributes["directory"].InnerText;
            }

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

            solutionDescriptor.mainFolder.Read(element, hintPath);
            return(solutionDescriptor);
        }
Ejemplo n.º 2
0
		public static SolutionDescriptor CreateSolutionDescriptor(XmlElement element, string hintPath)
		{
			SolutionDescriptor solutionDescriptor = new SolutionDescriptor(element.Attributes["name"].InnerText);
			
			if (element.Attributes["directory"] != null) {
				solutionDescriptor.relativeDirectory = element.Attributes["directory"].InnerText;
			}
			
			if (element["Options"] != null && element["Options"]["StartupProject"] != null) {
				solutionDescriptor.startupProject = element["Options"]["StartupProject"].InnerText;
			}
			
			solutionDescriptor.mainFolder.Read(element, hintPath);
			return solutionDescriptor;
		}
Ejemplo n.º 3
0
		void LoadFromXml(XmlElement templateElement, string xmlFileName)
		{
			// required for warning messages for unknown elements
			templateElement.SetAttribute("fileName", xmlFileName);
			
			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 = config["Icon"].InnerText;
			}
			
			if (config["SupportedTargetFrameworks"] != null) {
				supportedTargetFrameworks =
					config["SupportedTargetFrameworks"].InnerText.Split(';')
					.Select<string,TargetFramework>(TargetFramework.GetByName).ToArray();
			}
			
			string hintPath = Path.GetDirectoryName(xmlFileName);
			if (templateElement["Solution"] != null) {
				solutionDescriptor = SolutionDescriptor.CreateSolutionDescriptor(templateElement["Solution"], hintPath);
			} else if (templateElement["Combine"] != null) {
				solutionDescriptor = SolutionDescriptor.CreateSolutionDescriptor(templateElement["Combine"], hintPath);
				WarnObsoleteNode(templateElement["Combine"], "Use <Solution> instead!");
			}
			
			if (templateElement["Project"] != null) {
				projectDescriptor = new ProjectDescriptor(templateElement["Project"], hintPath);
			}
			
			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<ProjectCreateInformation> action = ReadAction(el);
					if (action != null)
						openActions.Add(action);
				}
			}
		}
Ejemplo n.º 4
0
        void LoadFromXml(XmlElement templateElement, string xmlFileName)
        {
            // required for warning messages for unknown elements
            templateElement.SetAttribute("fileName", xmlFileName);

            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 = config["Icon"].InnerText;
            }

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

            string hintPath = Path.GetDirectoryName(xmlFileName);

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

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

            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 <ProjectCreateInformation> action = ReadAction(el);
                    if (action != null)
                    {
                        openActions.Add(action);
                    }
                }
            }
        }