protected string GetVariableValue(string variableName) { int pos = variableName.IndexOf(':'); string formatString = ""; if (pos > 0) { formatString = variableName.Substring(pos + 1); variableName = variableName.Substring(0, pos); } if (String.IsNullOrWhiteSpace(variableName)) { return(""); } SnippetVariable snippetVariable = FindVariable(variableName); if (snippetVariable != null) { return(snippetVariable.GetValue(formatString)); } //predefined variables if (this.Functions.ContainsKey(variableName)) { return(this.Functions[variableName].GetValue(formatString)); } return(""); }
public void CopyFrom(SnippetVariable source) { this.Name = source.Name; this.Description = source.Description; this.Value = source.Value; }
public SnippetVariable(SnippetVariable source) : this() { CopyFrom(source); }