예제 #1
0
        private void TranslateFile(IStorage fromStorage, IStorage toStorage, string fromFile, string toFile, Dictionary <string, string> replacementVariants)
        {
            var contents = fromStorage.File.ReadAllText(fromFile);

            contents = PerformOneTranslation(replacementVariants, contents);

            toStorage.File.WriteAllText(contents, toFile);
            PathTranslated?.Invoke(this, new PathEventArgs(fromFile));
        }
예제 #2
0
 private void TranslateToSameDirectory(Dictionary <string, string> replacementVariants)
 {
     foreach (var file in _sourceStorage.Directory.GetFiles(_inPath, SearchOption.TopDirectoryOnly, _extensions))
     {
         var translatedFileName =
             $"{Path.GetDirectoryName(file)}{Path.DirectorySeparatorChar}translated_{Path.GetFileName(file)}";
         TranslateFile(_sourceStorage, _sourceStorage, file, translatedFileName, replacementVariants);
     }
     PathTranslated?.Invoke(this, new PathEventArgs(_inPath));
 }