internal void ExecutePostActions(GenInfo genInfo, TemplateCreationResult generationResult) { // Get post actions from template var postActions = PostactionFactory.FindPostActions(genInfo, generationResult); foreach (var postAction in postActions) { postAction.Execute(); } }
private static void AddProjectParams(GenInfo projectGenInfo, UserSelection userSelection) { projectGenInfo?.Parameters.Add(GenParams.Username, Environment.UserName); projectGenInfo?.Parameters.Add(GenParams.WizardVersion, string.Concat("v", GenContext.ToolBox.WizardVersion)); projectGenInfo?.Parameters.Add(GenParams.TemplatesVersion, string.Concat("v", GenContext.ToolBox.TemplatesVersion)); projectGenInfo?.Parameters.Add(GenParams.ProjectType, userSelection.ProjectType); projectGenInfo?.Parameters.Add(GenParams.FrontEndFramework, userSelection.FrontEndFramework); projectGenInfo?.Parameters.Add(GenParams.BackEndFramework, userSelection.BackEndFramework); projectGenInfo?.Parameters.Add(GenParams.Platform, userSelection.Platform); }
private static GenInfo CreateGenInfo(string name, ITemplateInfo template, List <GenInfo> queue, bool newItemGeneration) { var genInfo = new GenInfo(name, template); queue.Add(genInfo); AddDefaultParams(genInfo, newItemGeneration); return(genInfo); }
private static void AddTemplate(GenInfo mainGenInfo, List <GenInfo> queue, ITemplateInfo targetTemplate, UserSelection userSelection, bool newItemGeneration) { if (targetTemplate != null) { foreach (var export in targetTemplate.GetExports()) { mainGenInfo.Parameters.Add(export.Key, export.Value); } var genInfo = CreateGenInfo(mainGenInfo.Name, targetTemplate, queue, newItemGeneration); genInfo?.Parameters.Add(GenParams.HomePageName, userSelection.HomeName); genInfo?.Parameters.Add(GenParams.ProjectName, GenContext.Current.ProjectName); } }
private static GenInfo CreateGenInfo(string name, ITemplateInfo template, List <GenInfo> queue, UserSelection userSelection, bool newItemGeneration) { var genInfo = new GenInfo(name, template); queue.Add(genInfo); AddDefaultParams(genInfo, userSelection, newItemGeneration); if (template.GetTemplateOutputType() == TemplateOutputType.Project) { AddProjectParams(genInfo, userSelection); } return(genInfo); }
private static void AddProjectParams(GenInfo projectGenInfo, UserSelection userSelection) { projectGenInfo?.Parameters.Add(GenParams.Username, Environment.UserName); projectGenInfo?.Parameters.Add(GenParams.WizardVersion, string.Concat("v", GenContext.ToolBox.WizardVersion)); projectGenInfo?.Parameters.Add(GenParams.TemplatesVersion, string.Concat("v", GenContext.ToolBox.TemplatesVersion)); projectGenInfo?.Parameters.Add(GenParams.ProjectType, userSelection.Context.ProjectType); projectGenInfo?.Parameters.Add(GenParams.FrontEndFramework, userSelection.Context.FrontEndFramework ?? string.Empty); projectGenInfo?.Parameters.Add(GenParams.BackEndFramework, userSelection.Context.BackEndFramework ?? string.Empty); projectGenInfo?.Parameters.Add(GenParams.Platform, userSelection.Context.Platform); foreach (var property in userSelection.Context.PropertyBag) { projectGenInfo?.Parameters.Add($"{GenParams.GenerationPropertiesPrefix}.{property.Key.ToLowerInvariant()}", property.Value); } }
private static void AddDefaultParams(GenInfo genInfo, bool newItemGeneration) { var ns = string.Empty; if (newItemGeneration) { ns = GenContext.ToolBox.Shell.GetActiveProjectNamespace(); } if (string.IsNullOrEmpty(ns)) { ns = GenContext.Current.SafeProjectName; } genInfo.Parameters.Add(GenParams.RootNamespace, ns); }
internal string GetStatusText(GenInfo genInfo) { switch (genInfo.Template.GetTemplateType()) { case TemplateType.Project: return(string.Format(StringRes.StatusBarGeneratingProjectMessage, genInfo.Name)); case TemplateType.Page: return(string.Format(StringRes.StatusBarGeneratingPageMessage, $"{genInfo.Name} ({genInfo.Template.Name})")); case TemplateType.Feature: return(string.Format(StringRes.StatusBarGeneratingFeatureMessage, $"{genInfo.Name} ({genInfo.Template.Name})")); default: return(null); } }
private static void AddCasingParams(string name, ITemplateInfo template, GenInfo genInfo) { foreach (var textCasing in template.GetTextCasings()) { var value = textCasing.Key == "sourceName" ? name : genInfo.Parameters.SafeGet($"wts.{textCasing.Key}"); if (!string.IsNullOrEmpty(value)) { if (!genInfo.Parameters.ContainsKey(textCasing.ParameterName)) { genInfo.Parameters.Add(textCasing.ParameterName, textCasing.Transform(value)); } } } }
private static void AddDefaultParams(GenInfo genInfo, bool newItemGeneration) { var ns = string.Empty; if (newItemGeneration) { ns = GenContext.ToolBox.Shell.GetActiveProjectNamespace(); } if (string.IsNullOrEmpty(ns)) { ns = GenContext.Current.SafeProjectName; } // TODO: This is needed to make legacy tests work, remove once 3.1 is released genInfo.Parameters.Add(GenParams.ItemNamespace, ns); genInfo.Parameters.Add(GenParams.RootNamespace, ns); }
private static void AddTemplate(GenInfo mainGenInfo, List <GenInfo> queue, ITemplateInfo targetTemplate, UserSelection userSelection, bool newItemGeneration) { if (targetTemplate != null) { foreach (var export in targetTemplate.GetExports()) { mainGenInfo.Parameters.Add(export.Key, export.Value); } var genInfo = CreateGenInfo(mainGenInfo.Name, targetTemplate, queue, newItemGeneration); foreach (var param in mainGenInfo.Parameters) { if (!genInfo.Parameters.ContainsKey(param.Key)) { genInfo.Parameters.Add(param.Key, param.Value); } } AddCasingParams(mainGenInfo.Name, targetTemplate, genInfo); } }