Exemplo n.º 1
0
        static bool ParseArguments(string [] args)
        {
            foreach (string arg in args)
            {
                if (arg.StartsWith(projectNameArg))
                {
                    projectName = arg.Substring(projectNameArg.Length).Trim('"');
                }
                else if (arg.StartsWith(userNameArg))
                {
                    userName = arg.Substring(userNameArg.Length).Trim('"');
                }
                else if (arg.StartsWith(inputFileArg))
                {
                    inputFile = arg.Substring(inputFileArg.Length).Trim('"');
                }
                else if (arg.StartsWith(outputFileArg))
                {
                    outputFile = arg.Substring(outputFileArg.Length).Trim('"');
                }
                else if (arg.StartsWith(authorNameArg))
                {
                    authorName = arg.Substring(authorNameArg.Length).Trim('"');
                }
            }

            if (projectName != null && userName != null && outputFile != null)
            {
                projectDescription  = "Generated with CodeDocTools (https://github.com/borjafdezgauna/CoderDocTools)"; //
                tempFolder          = projectName;
                markDownInputFolder = tempFolder;
                if (inputFile == null)
                {
                    inputFile = "Home.md";
                }
                executionMode = ExecutionMode.GitHubWikiToPDF;
                return(true); //GitHub wiki -> PDF mode
            }
            if (inputFile != null && outputFile != null)
            {
                if (projectName == null)
                {
                    projectName = WikiToPDFConverter.DocNameFromFilename(inputFile);
                }
                projectDescription = "Generated with CodeDocTools (https://github.com/borjafdezgauna/CoderDocTools)";
                tempFolder         = "tmp";
                string inputDocName = Path.GetFileNameWithoutExtension(inputFile);
                markDownInputFolder = Path.GetDirectoryName(inputFile);
                inputFile           = Path.GetFileName(inputFile);
                executionMode       = ExecutionMode.LocalMarkdownFileToPDF;
                return(true); //Local Markdown file -> PDF mode
            }
            return(false);    //error parsing arguments
        }