Source/NFX/Environment/ConfigNode.cs
/// <summary>
/// Evaluates a value string expanding all variables with var-paths relative to this node.
/// Evaluates configuration variables such as "$(varname)" or "$(@varname)". Varnames are paths
/// to other config nodes from the same configuration or variable names when prefixed with "~". If varname starts with "@" then it gets combined
///  with input as path string. "~" is used to qualify environment vars that get resolved through Configuration.EnvironmentVarResolver
///  Example: `....add key="Schema.$(/A/B/C/$attr)" value="$(@~HOME)bin\Transforms\"...`
/// </summary>
Evaluates a value string expanding all variables with var-paths relative to this node.
Evaluates configuration variables such as "$(varname)" or "$(@varname)". Varnames are paths
to other config nodes from the same configuration or variable names when prefixed with "~". If varname starts with "@" then it gets combined
with input as path string.
Evaluates a value string expanding all variables with var - paths relative to this node . Evaluates configuration variables such as " $ ( varname ) " or " $ ( @varname ) " . Varnames are paths to other config nodes from the same configuration or variable names when prefixed with " ~ " . If varname starts with " @ " then it gets combined with input as path string .
public string EvaluateValueVariables(string value)
        {
          if (value == null) return null;
          var VAR_ESCAPE = m_Configuration.Variable_ESCAPE;
          if (value.IndexOf(VAR_ESCAPE)==0)
           return value.Length > VAR_ESCAPE.Length ? value.Substring(VAR_ESCAPE.Length) : string.Empty;
          HashSet<string> vlist;
          if (ts_Count==0)
          {
            vlist = new HashSet<string>();
            ts_VarNames = vlist;
          }
          else
            vlist = ts_VarNames;
          ts_Count++;
          try
          {
                  var VAR_START = m_Configuration.Variable_START;
                  var VAR_END = m_Configuration.Variable_END;
                  var VAR_PATH_MOD = m_Configuration.Variable_PATH_MOD;
                       while(true)
                       {
                         var idxs = value.IndexOf(VAR_START);
                         if (idxs<0) break;
                         var idxe = value.IndexOf(VAR_END, idxs);
                         if (idxe<=idxs) break;
                         var vname = value.Substring(idxs + VAR_START.Length, 1 + idxe - idxs - VAR_START.Length - VAR_END.Length).Trim();
                         if (vlist.Contains(vname))
                           throw new ConfigException(string.Format(StringConsts.CONFIG_RECURSIVE_VARS_ERROR, value));
                         vlist.Add(vname);
                         try
                         {
                             if (vname.StartsWith(VAR_PATH_MOD))
                             {
                               value = replacePaths(value, VAR_START + vname + VAR_END, getValueFromMacroOrEnvVarOrNavigationWithCheck(vname.Replace(VAR_PATH_MOD, string.Empty)));
                             }
                             else
                             {
                               value = value.Replace(VAR_START + vname + VAR_END, getValueFromMacroOrEnvVarOrNavigationWithCheck(vname));
                             }
                         }
                         finally
                         {
                             vlist.Remove(vname);
                         }
                       }
                  return value;
          }
          finally
          {
            ts_Count--;
            if (ts_Count==0)
             ts_VarNames = null;
          }
        }
public string EvaluateValueVariables ( string value ) { if ( value == null ) return null ; var VAR_ESCAPE = m_Configuration . Variable_ESCAPE ; if ( value . IndexOf ( VAR_ESCAPE ) == 0 ) return value . Length > VAR_ESCAPE . Length ? value . Substring ( VAR_ESCAPE . Length ) : string . Empty ; HashSet < string > vlist ; if ( ts_Count == 0 ) { vlist = new HashSet < string > ( ) ; ts_VarNames = vlist ; } else vlist = ts_VarNames ; ts_Count ++ ; try { var VAR_START = m_Configuration . Variable_START ; var VAR_END = m_Configuration . Variable_END ; var VAR_PATH_MOD = m_Configuration . Variable_PATH_MOD ; while ( true ) { var idxs = value . IndexOf ( VAR_START ) ; if ( idxs < 0 ) break ; var idxe = value . IndexOf ( VAR_END , idxs ) ; if ( idxe <= idxs ) break ; var vname = value . Substring ( idxs + VAR_START . Length , 1 + idxe - idxs - VAR_START . Length - VAR_END . Length ) . Trim ( ) ; if ( vlist . Contains ( vname ) ) throw new ConfigException ( string . Format ( StringConsts . CONFIG_RECURSIVE_VARS_ERROR , value ) ) ; vlist . Add ( vname ) ; try { if ( vname . StartsWith ( VAR_PATH_MOD ) ) { value = replacePaths ( value , VAR_START + vname + VAR_END , getValueFromMacroOrEnvVarOrNavigationWithCheck ( vname . Replace ( VAR_PATH_MOD , string . Empty ) ) ) ; } else { value = value . Replace ( VAR_START + vname + VAR_END , getValueFromMacroOrEnvVarOrNavigationWithCheck ( vname ) ) ; } } finally { vlist . Remove ( vname ) ; } } return value ; } finally { ts_Count -- ; if ( ts_Count == 0 ) ts_VarNames = null ; } }
Evaluates a value string expanding all variables with var-paths relative to this node.
Evaluates a value string expanding all variables with var - paths relative to this node .
value
string