Exemple #1
0
        public static void Main()
        {
            Console.Title = Title;

            FileExplorer.InitPaths();
            TypeWriter.Initialize();
            Console.ForegroundColor = ConsoleColor.White;

            Console.WriteLine("Welcome to the WarriorsSnuggery DocWriter. This program will search through the installation and create a documentation of the modding rules.");
            Console.WriteLine("Available are: ALL, ACTORS, PARTICLES, WEAPONS, TERRAIN, WALLS, MAPS, SPELLS, TROPHIES and SOUNDS.");

            Console.ForegroundColor = ConsoleColor.Yellow;

            Console.Write("Please enter what content should be created (e.g. ACTORS, TERRAIN): ");
            Console.ResetColor();

            var input = Console.ReadLine();

            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.Write("Write the documentation in dark mode? (y to accept): ");
            Console.ResetColor();

            DarkMode          = Console.ReadKey().Key == ConsoleKey.Y;
            HTMLWriter.Colors = DarkMode ? HTMLWriter.DarkModeColors : HTMLWriter.LightModeColors;
            Console.WriteLine();

            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine("--------------------------------------------------------------");

            DocumentationType[] types;
            try
            {
                types = getTypes(input);
            }
            catch (Exception)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Invalid input.");
                Console.ReadKey();
                return;
            }

            if (Debugger.IsAttached)
            {
                start(types);
            }
            else
            {
                try
                {
                    start(types);
                }
                catch (Exception)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("Failed to init document/write rules.");
                    Console.ReadKey();
                    return;
                }
            }

            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine("--------------------------------------------------------------");
            Console.WriteLine("Done!");
            Console.ReadKey();
        }