private static ScopeSpecification CreateScope(ScopeSpecification scopeSpec, CopyScopeValue copyAction = null) { var spec = new ScopeSpecification(); foreach (var scope in scopeSpec) { if (scope.Key != ScopeField.Action) spec.Add(scope.Key, new ScopeValue(scope.Value)); else if (copyAction != null) spec.Add(scope.Key, copyAction(scope)); } return spec; }
private static ScopeSpecification CreateScope(ScopeSpecification scopeSpec, CopyScopeValue copyAction = null) { var spec = new ScopeSpecification(); foreach (var scope in scopeSpec) { if (scope.Key != ScopeField.Action) { spec.Add(scope.Key, new ScopeValue(scope.Value)); } else if (copyAction != null) { spec.Add(scope.Key, copyAction(scope)); } } return(spec); }
public void CopyVariables(IList <VariableResource> source, CopyScopeValue copyAction = null) { foreach (var variable in source) { if (variable.IsSensitive) { const string warning = "Variable '{0}' was sensitive. Sensitive flag has been removed and the value has been set to an empty string."; _writeWarning(string.Format(warning, variable.Name)); } var newVariable = new VariableResource { Name = variable.Name, IsEditable = variable.IsEditable, IsSensitive = false, Prompt = variable.Prompt, Value = variable.IsSensitive ? "" : variable.Value, Scope = CreateScope(variable.Scope, copyAction) }; _variableSet.Add(newVariable); } }
public void CopyVariables(IList<VariableResource> source, CopyScopeValue copyAction = null) { foreach (var variable in source) { if (variable.IsSensitive) { const string warning = "Variable '{0}' was sensitive. Sensitive flag has been removed and the value has been set to an empty string."; _writeWarning(string.Format(warning, variable.Name)); } var newVariable = new VariableResource { Name = variable.Name, IsEditable = variable.IsEditable, IsSensitive = false, Prompt = variable.Prompt, Value = variable.IsSensitive ? "" : variable.Value, Scope = CreateScope(variable.Scope, copyAction) }; _variableSet.Add(newVariable); } }