Bari.Core.Generic.EnvironmentVariables.ResolveEnvironmentVariables C# (CSharp) Method

ResolveEnvironmentVariables() public static method

public static ResolveEnvironmentVariables ( IEnvironmentVariableContext context, StringBuilder resultBuilder, Action failLog = null ) : bool
context IEnvironmentVariableContext
resultBuilder StringBuilder
failLog Action
return bool
        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;
        }
EnvironmentVariables