Exemplo n.º 1
0
        private void GenerateButton_Click(object sender, EventArgs e)
        {
            SetMessage(SourceFile);

            var generator = new RandomTextGenerator
            {
                SourcePath = SourceFile,
                OutputPath = $"c:/logs/output_{DateTime.Now.Minute}.txt",
                ReplaceCarriageNewLines = ReplaceBreaksWithLine ? Environment.NewLine : string.Empty
            };

            generator.Parse(TextLength);

            SetMessage(generator.OutputMessage);

            SetMessage(generator.Print(500));
        }
Exemplo n.º 2
0
        private static void RunRandomTextGenerator()
        {
            Console.WriteLine($"{Ansi.MAGENTA}RANDOM TEXT GENERATOR!{Ansi.GRAY_0}");
            Console.WriteLine($"{Ansi.MAGENTA}----------------------{Ansi.GRAY_0}");
            Console.WriteLine($"{Ansi.MAGENTA}-------type G to gen--{Ansi.GRAY_0}");
            Console.WriteLine($"{Ansi.MAGENTA}-------type C to con--{Ansi.GRAY_0}");

            var exitKey = Console.ReadLine();

            while (exitKey == "G")
            {
                GenerateText();
                exitKey = Console.ReadLine();
            }

            if (exitKey == "C")
            {
                if (AskForPath("source", out var path) && AskForPath("output", out var outputPath))
                {
                    // GenerateText()
                    try
                    {
                        var generator = new RandomTextGenerator {
                            SourcePath = path, OutputPath = outputPath
                        };
                        generator.Parse(30000);

                        Console.WriteLine($"{Ansi.MAGENTA}{generator.OutputMessage}{Ansi.GRAY_0}");
                        // Console.WriteLine($"{Ansi.GREEN_BACK}{generator.View()}{Ansi.GRAY_0}");
                        Console.WriteLine($"{Ansi.GREEN_BACK}{generator.Print(500)}{Ansi.GRAY_0}");
                        Console.WriteLine($"{Ansi.RED_1}Press any key to exit.{Ansi.GRAY_0}");
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e);
                        Console.WriteLine("Error, Press key to exit.");
                    }
                    var exitKeys = Console.ReadLine();
                }
            }
        }
Exemplo n.º 3
0
        private static void GenerateText()
        {
            try
            {
                // var generator = new RandomTextGenerator {SourcePath = path, OutputPath = outputPath };
                var generator = new RandomTextGenerator {
                    SourcePath = "c:/logs/radiohead_lyrics_07-20-19.txt", OutputPath = $"c:/logs/output_{DateTime.Now.Minute}.txt"
                };
                generator.Parse(int.MaxValue);

                Console.WriteLine($"{Ansi.MAGENTA}{generator.OutputMessage}{Ansi.GRAY_0}");
                // Console.WriteLine($"{Ansi.BRIGHT_GREEN}{generator.ViewChar()}{Ansi.GRAY_0}");
                Console.WriteLine($"{Ansi.GREEN_BACK}{generator.Print(900)}{Ansi.GRAY_0}");
                Console.WriteLine($"{Ansi.RED_1}Press any key to exit.{Ansi.GRAY_0}");
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                Console.WriteLine("Error, Press key to exit.");
            }
        }