private TaskDefinitionValidationResult.TaskDefinitionValidationResultItem GetValidationResultItem(TaskParameter parameter, Dictionary<string, string> valueDictionary) { var item = new TaskDefinitionValidationResult.TaskDefinitionValidationResultItem { FieldName = parameter.FieldName, Sensitive = parameter.Sensitive, Optional = parameter.Optional }; if (!valueDictionary.ContainsKey(parameter.FieldName) || string.IsNullOrEmpty(valueDictionary[parameter.FieldName])) { item.Present = false; } else { item.Present = true; //if (!item.Sensitive) //{ item.FieldValue = valueDictionary[parameter.FieldName]; //} } return item; }
private List<TaskParameter> FindNestedParameters(object options, Func<string, List<string>> findFunction) { var list = new List<TaskParameter>(); if (options != null) { foreach (var propInfo in options.GetType().GetProperties()) { if (propInfo.PropertyType == typeof(string)) { string value = (string)propInfo.GetValue(options, null); if (!string.IsNullOrEmpty(value)) { var valueList = findFunction(value); var x = new List<TaskParameter>(); foreach(var valueItem in valueList) { var taskParameter = new TaskParameter() { FieldName = valueItem, FieldType = EnumTaskParameterType.String }; if(taskParameter.FieldName.StartsWith("SENSITIVE:", StringComparison.CurrentCultureIgnoreCase)) { taskParameter.FieldName = taskParameter.FieldName.Substring("SENSITIVE:".Length); taskParameter.Sensitive = true; } if(taskParameter.FieldName.StartsWith("OPTIONAL:", StringComparison.CurrentCultureIgnoreCase)) { taskParameter.FieldName = taskParameter.FieldName.Substring("OPTIONAL:".Length); taskParameter.Optional = true; } if (taskParameter.FieldName.StartsWith("SENSITIVE:", StringComparison.CurrentCultureIgnoreCase)) { taskParameter.FieldName = taskParameter.FieldName.Substring("SENSITIVE:".Length); taskParameter.Sensitive = true; } x.Add(taskParameter); } if (x != null && x.Any()) { list.AddRange(x); } } } else if (propInfo.PropertyType.IsClass) { var value = propInfo.GetValue(options, null); if (value != null) { if (typeof(IEnumerable).IsAssignableFrom(value.GetType())) { foreach (var item in (IEnumerable)value) { var x = this.FindNestedParameters(item, findFunction); if (x != null && x.Any()) { list.AddRange(x); } } } } else { var x = this.FindNestedDeployParameters(value); if (x != null && x.Any()) { list.AddRange(x); } } } } } return list; }