Example #1
0
        private bool ResolveEnvironmentVariables(IPatternResolutionContext context, StringBuilder resultBuilder)
        {
            Match match;

            do
            {
                match = envVarsRegex.Match(resultBuilder.ToString());

                if (match.Success)
                {
                    string value = context.GetEnvironmentVariable(match.Groups[1].Captures[0].Value);
                    if (value == null)
                    {
                        log.InfoFormat("Failed to resolve FS repository pattern {0}: environment variable {1} does not exists", pattern, match.Value);
                        return(false);
                    }
                    else
                    {
                        resultBuilder.Remove(match.Index, match.Length);
                        resultBuilder.Insert(match.Index, value);
                    }
                }
            } while (match.Success);

            return(true);
        }
Example #2
0
        private bool ResolveEnvironmentVariables(IPatternResolutionContext context, StringBuilder resultBuilder)
        {
            Match match;
            do
            {
                match = envVarsRegex.Match(resultBuilder.ToString());

                if (match.Success)
                {
                    string value = context.GetEnvironmentVariable(match.Groups[1].Captures[0].Value);
                    if (value == null)
                    {
                        log.InfoFormat("Failed to resolve FS repository pattern {0}: environment variable {1} does not exists", pattern, match.Value);
                        return false;
                    }
                    else
                    {
                        resultBuilder.Remove(match.Index, match.Length);
                        resultBuilder.Insert(match.Index, value);
                    }
                }
            } while (match.Success);
            
            return true;
        }