/// <summary> /// Merge, in place, the values of this instance Parameters using the values of the context /// dictionary passed in the argument as context values. /// Old parameter values are replaced and lost. /// </summary> /// <param name="context"></param> public void ResolveParameters(Dictionary<string, string> context) { ParameterResolver resolver = new ParameterResolver(); resolver.SetContext(context); Dictionary<string, string> cloned = CloneParameters(); foreach (string key in cloned.Keys) { Parameters[key] = resolver.Resolve(cloned[key]); } }
/// <summary> /// Merges a template string using this instance Parameters as context values. /// </summary> /// <param name="template"></param> /// <returns></returns> public string ResolveTemplate(string template) { ParameterResolver resolver = new ParameterResolver(); resolver.SetContext(Parameters); return resolver.Resolve(template); }
/// <summary> /// Merges the values of this instance Parameters using the values of the context /// dictionary passed in the argument as context values, then returns the merged values in /// a new dictionary. /// </summary> /// <param name="context"></param> /// <returns></returns> public Dictionary<string, string> GetParametersResolved(Dictionary<string, string> context) { ParameterResolver resolver = new ParameterResolver(); resolver.SetContext(context); Dictionary<string, string> retval = new Dictionary<string, string>(); foreach (string key in this.Parameters.Keys) { retval[key] = resolver.Resolve(this.Parameters[key]); } return retval; }