Beispiel #1
0
        public static string g_sProjectFolder = "";        //BAD BAD BAD, BAD ME.

        //users can either pass in args 1. the filename (code) 2.the FOLDER PATH (result), and 3. (optionally) the header text. OR run the executable and manually put it all in
        static void Main(string[] args)
        {
            List <List <string> > indexInformation = null;

            // set up the engine
            List <ILogger> logSystem = new List <ILogger>();

            logSystem.Add(new ConsoleLogger(0));
            //logSystem.Add(new TextFileLogger(0));
            //logSystem.Add(new TextFileLogger("debug.txt", 1));
            //logSystem.Add(new TextFileLogger("errors.txt", -1, true));

            EngineGovernor engine = new EngineGovernor(logSystem);

            //running from executuable, instead of command line
            if (args.Length == 0)
            {
                Console.ForegroundColor = ConsoleColor.DarkCyan;
                Console.WriteLine("\n===================== DICI " + VERSION() + " =====================");
                Console.ForegroundColor = ConsoleColor.DarkGreen;
                Console.WriteLine("\nCopyright © 2015 Digital Warrior Labs");
                Console.Write("Engine version: ");
                Console.ForegroundColor = ConsoleColor.Cyan;
                Console.Write(EngineGovernor.VERSION());
                Console.ForegroundColor = ConsoleColor.DarkGreen;
                Console.Write("\nBuild Date: " + EngineGovernor.BUILD_DATE);
                Console.ForegroundColor = ConsoleColor.Gray;
                Console.WriteLine("\n\nWelcome to the Document It Console Interface!");

                string l_file         = "";
                string l_resultFolder = "";
                string l_headerText   = "";
                bool   exitFlag       = false;

                while (!exitFlag)
                {
                    //get the file name
                    Console.Write("\n\n\nEnter the filename of the code file you wish to document, or provide a .apiproj file. (This can be an absolute or relative file path.)\nAlternately, enter 'exit' to quit the program.\nfile: ");
                    l_file = Console.ReadLine();

                    //check for exit
                    if (l_file == "exit")
                    {
                        exitFlag = true; continue;
                    }

                    //check to see if the file is a .apiproj
                    if (l_file.EndsWith(".apiproj"))
                    {
                        indexInformation = runProject(l_file, null);                         // TODO: TAKE OUT ENTIRE SINGLE FILE THING AT SOME POINT
                        /*if (indexInformation != null) { createIndex(indexInformation); }*/
                        continue;
                    }

                    //get destination folder
                    Console.Write("\n\nEnter the folder path where you would like the HTML document to be stored. (This can be an absolute or relative file path. If left blank, the document will be saved in the same folder as this executable.)\nDestination folder: ");
                    l_resultFolder = Console.ReadLine();

                    //header text
                    Console.Write("\n\nEnter the header text you would like to appear in the upper left-hand corner of the document. (This can be used for project names, company names, etc.) If you don't care what it says, just hit enter, and the default program name will be substituted.\nHeader text: ");
                    l_headerText = Console.ReadLine();

                    //run(l_file, l_resultFolder, l_headerText);
                }

                //Console.WriteLine("Press any key to continue...");
                //Console.Read();
            }
            else
            {
                //COMMAND LINE HANDLING HERE
                string projectFile = args[0];
                if (!projectFile.EndsWith(".apiproj"))
                {
                    Console.WriteLine("If running this program with command line arguments, you MUST supply an .apiproj file as the first argument.");
                }

                indexInformation = runProject(projectFile, engine);
                //createIndex(indexInformation);
            }
        }