コード例 #1
0
 /// <summary>
 /// Clone this parameter resolver.
 /// </summary>
 /// <returns></returns>
 public ParameterResolver Clone()
 {
     ParameterResolver retval = new ParameterResolver();
     foreach (string k in Context.Keys)
         retval.Context.Add(k, Context[k]);
     return retval;
 }
コード例 #2
0
 /// <summary>
 /// Called before any write operation.
 /// </summary>
 /// <param name="ctx"></param>
 protected virtual void EnterNode(CodeEmitterContext ctx)
 {
     _currentContext = ctx;
     SetArtifactResultData(_currentContext.ArtifactResultData);
     _parameterResolver = ctx.GetDictionaryValue("ParameterResolver") as ParameterResolver;
     if (_parameterResolver == null)
     {
         _parameterResolver = new ParameterResolver();
         ctx.SetDictionaryValue("ParameterResolver", _parameterResolver);
     }
     _parameterResolverSave = _parameterResolver.Clone();
 }
コード例 #3
0
ファイル: ParameterHolder.cs プロジェクト: stfnbssl/Tree2Soft
 /// <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]);
     }
 }
コード例 #4
0
ファイル: ParameterHolder.cs プロジェクト: stfnbssl/Tree2Soft
 /// <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);
 }
コード例 #5
0
ファイル: ParameterHolder.cs プロジェクト: stfnbssl/Tree2Soft
 /// <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;
 }