string MergeDefaultParameters(string defaultParameters) { List <TemplateParameter> priorityParameters = null; var parameters = new List <string> (); var cacheParameters = templateInfo.CacheParameters.Where(m => !string.IsNullOrEmpty(m.Value.DefaultValue)); if (!cacheParameters.Any()) { return(defaultParameters); } if (!string.IsNullOrEmpty(defaultParameters)) { priorityParameters = TemplateParameter.CreateParameters(defaultParameters).ToList(); defaultParameters += ","; } foreach (var p in cacheParameters) { if (priorityParameters != null && !priorityParameters.Exists(t => t.Name == p.Key)) { parameters.Add($"{p.Key}={p.Value.DefaultValue}"); } } return(defaultParameters += string.Join(",", parameters)); }
public static IEnumerable<TemplateParameter> CreateParameters (string condition) { string[] parts = condition.Split (new [] {';', ','}, StringSplitOptions.RemoveEmptyEntries); foreach (string part in parts) { var parameter = new TemplateParameter (part); if (!parameter.IsValid) { LoggingService.LogWarning ("Invalid template condition '{0}'", condition); } yield return parameter; } }
public static IEnumerable <TemplateParameter> CreateParameters(string condition) { string[] parts = condition.Split(new [] { ';', ',' }, StringSplitOptions.RemoveEmptyEntries); foreach (string part in parts) { var parameter = new TemplateParameter(part); if (!parameter.IsValid) { LoggingService.LogWarning("Invalid template condition '{0}'", condition); } yield return(parameter); } }
public bool IsExcluded(ProjectCreateParameters projectCreateParameters) { if (String.IsNullOrEmpty(condition)) { return(false); } if (templateParameters == null) { templateParameters = TemplateParameter.CreateParameters(condition).ToList(); } return(templateParameters.Any(parameter => IsExcluded(parameter, projectCreateParameters))); }
static IEnumerable <TemplateParameter> GetValidParameters(string parameters) { return(TemplateParameter.CreateParameters(parameters) .Where(parameter => parameter.IsValid)); }
bool IsExcluded(TemplateParameter parameter, ProjectCreateParameters parameters) { return(!String.Equals(parameters [parameter.Name], parameter.Value, StringComparison.OrdinalIgnoreCase)); }
bool IsExcluded (TemplateParameter parameter, ProjectCreateParameters parameters) { return !String.Equals (parameters [parameter.Name], parameter.Value, StringComparison.OrdinalIgnoreCase); }