Beispiel #1
0
        public string Transform(string source)
        {
            var baseTrasformer = new TextSteppedTransformer(Rules);

            baseTrasformer.Reset(source);
            while (baseTrasformer.Next())
            {
                ;
            }
            return(baseTrasformer.Text);
        }
 public static void WriteStepsToFiles(this ITextTransformer transformer, string sourceText, string targetPath, bool skipFilesWithNoChanges)
 {
     if (transformer != null && !transformer.Rules.IsNullOrEmpty())
     {
         targetPath.GetPathParts(out var directoryName, out var targetFilename, out var targetExtension);
         Steps.DeleteAllSteps(directoryName, targetFilename, targetExtension);
         var lastText           = "";
         var steppedTransformer = new TextSteppedTransformer(transformer.Rules, sourceText);
         while (steppedTransformer.Next())
         {
             var newText = steppedTransformer.Text;
             Steps.WriteStep(transformer, directoryName, targetFilename, targetExtension, steppedTransformer.Current, ref lastText, newText, skipFilesWithNoChanges);
         }
     }
 }
 public static IList <string> GetSteps(this ITextTransformer transformer, string sourceText)
 {
     if (transformer != null && !transformer.Rules.IsNullOrEmpty())
     {
         var steps = new List <string>();
         var steppedTransformer = new TextSteppedTransformer(transformer.Rules, sourceText);
         while (steppedTransformer.Next())
         {
             steps.Add(steppedTransformer.Text);
         }
         return(steps);
     }
     else
     {
         return(Array.Empty <string>());
     }
 }