Exemple #1
0
        public void EntryPoint()
        {
            if (Help)
            {
                displayHelp();
                return;
            }

            Matcher.IsFriendly = Friendly;

            _stopwatch = maybe(Verbose || Stopwatch, () => new Stopwatch());
            _stopwatch.IfThen(s => s.Start());

            if (Find)
            {
                find();
            }
            else if (Replace)
            {
                replaceAction();
            }
            else if (Regex)
            {
                regexAction();
            }
            else if (Sub)
            {
                substitute();
            }
            else if (Pattern.IsNotEmpty())
            {
                find();
            }
            else
            {
                throw "Didn't recognize action".Throws();
            }

            if (_stopwatch.If(out var stopwatch))
            {
                stopwatch.Stop();
                WriteLine();
                WriteLine($"Elapsed time: {stopwatch.Elapsed.ToLongString(true)}");
            }

            if (Find && Verbose)
            {
                WriteLine($"File count  : {fileTally}");
                WriteLine($"Line count  : {lineTally}");
            }
        }
Exemple #2
0
 public void Print(string value) => textBoxInterface.IfThen(tbi =>
 {
     tbi.Writer.Write(value);
     putter.Reset();
 });