public static bool ResolveEnvironmentVariables(IEnvironmentVariableContext context, StringBuilder resultBuilder, Action<string> failLog = null) { Match match; do { match = envVarsRegex.Match(resultBuilder.ToString()); if (match.Success) { string value = context.GetEnvironmentVariable(match.Groups[1].Captures[0].Value); if (value == null) { if (failLog != null) failLog(match.Value); return false; } else { resultBuilder.Remove(match.Index, match.Length); resultBuilder.Insert(match.Index, value); } } } while (match.Success); return true; }
public static bool ResolveEnvironmentVariables(IEnvironmentVariableContext context, StringBuilder resultBuilder, Action <string> failLog = null) { Match match; do { match = envVarsRegex.Match(resultBuilder.ToString()); if (match.Success) { string value = context.GetEnvironmentVariable(match.Groups[1].Captures[0].Value); if (value == null) { if (failLog != null) { failLog(match.Value); } return(false); } else { resultBuilder.Remove(match.Index, match.Length); resultBuilder.Insert(match.Index, value); } } } while (match.Success); return(true); }
public string GetEnvironmentVariable(string name) { var result = baseImpl.GetEnvironmentVariable(name); if (String.IsNullOrWhiteSpace(result)) { return("0"); } else { return(result); } }
public string GetEnvironmentVariable(string name) { return(environmentVariableContext.GetEnvironmentVariable(name)); }