protected virtual void ExpandDefaultValues(int noOfRuns, IList <ITokenDescription> tokens)
        {
            foreach (var tokenDescription in Manifest.Tokens.Where(t => !string.IsNullOrEmpty(t.Default) && !t.Default.Contains("$")).ToArray())
            {
                if (Manifest.ReplacementTokens.ContainsKey(tokenDescription.Key))
                {
                    continue;
                }
                Manifest.ReplacementTokens.Add(tokenDescription.Key, tokenDescription.Default);
            }

            ReplaceTokensService = new ReplaceTokensService(Manifest.ReplacementTokens);
            foreach (var tokenDescription in Manifest.Tokens.Where(t => !string.IsNullOrEmpty(t.Default) && t.Default.Contains("$")))
            {
                tokenDescription.Default = ReplaceTokensService.Replace(tokenDescription.Default);
            }

            if (!Manifest.Tokens.Any(t => t.Default.Contains("$")) || noOfRuns >= tokens.Count)
            {
                return;
            }
            noOfRuns++;

            ExpandDefaultValues(noOfRuns, tokens);
        }
 public FileTokenReplace(string filePath, ReplaceTokensService tokensService, ManualResetEvent done)
 {
     FilePath       = filePath;
     _tokensService = tokensService;
     _doneEvent     = done;
 }
Esempio n. 3
0
 public ReplaceTokensInFilesService(string[] filePaths, IDictionary <string, string> replacementTokens)
 {
     FilePaths            = filePaths;
     ReplacementTokens    = replacementTokens;
     ReplaceTokensService = new ReplaceTokensService(replacementTokens);
 }