Example #1
0
 public ScopedState(ExpandableVars container)
 {
     this.container = container;
     Log.Debug("Saving expandable variable state:");
     Log.IndentedCollection(container.variables, kvp => $"{kvp.Key} => {kvp.Value}", Log.Debug);
     prevVars = new Dictionary <string, string>(container.variables);
 }
Example #2
0
 public ScopedVariable(ExpandableVars container, string varName, string varExpansion)
 {
     this.container = container;
     this.varName   = varName;
     container.variables.TryGetValue(varName, out prevExpansion);
     container.SetExpandableVariable(varName, varExpansion);
 }
Example #3
0
        public bool ExpandVairableInCopy(string varName, string varExpansion, out IExpandable outCopy)
        {
            bool    didCopy = false;
            Pattern newCopy = Copy();

            if (ExpandableVars.ExpandInCopy(Value, varName, varExpansion, out object value))
            {
                didCopy       = true;
                newCopy.Value = (string)value;
            }
            outCopy = newCopy;
            return(didCopy);
        }
Example #4
0
        public bool StripEscapedVariablesInCopy(out IExpandable outCopy)
        {
            bool    didStrip = false;
            Pattern newCopy  = Copy();

            if (ExpandableVars.StripEscapedVariablesInCopy(Value, out object value))
            {
                didStrip      = true;
                newCopy.Value = (string)value;
            }

            outCopy = newCopy;
            return(didStrip);
        }
Example #5
0
 public void ExpandVariableInPlace(string varName, string varExpansion)
 {
     ExpandableVars.ExpandInCopy(Value, varName, varExpansion, out object value);
     Value = (string)value;
 }