Example #1
0
        public override bool Execute(DocExportInput input)
        {
            Exporter.Warnings.Clear();

            var settings = input.ToSettings();

            switch (input.ExportMode)
            {
            case ExportStyle.FileDump:
                settings.UrlStyle = UrlStyle.FileExport;
                break;

            case ExportStyle.Website:
                settings.UrlStyle = UrlStyle.WebsiteExport;
                break;

            case ExportStyle.ProjectWebsite:
                if (input.ProjectFlag.IsEmpty())
                {
                    throw new Exception("You need to specify the GitHub project name as the --project flag in order to use the ProjectWebsite export mode");
                }

                settings.UrlStyle = UrlStyle.ProjectWebsiteExport;
                break;
            }


            var project = new DocProject(settings);

            project.StartScanning();

            if (!Directory.Exists(input.Destination))
            {
                Console.WriteLine("Creating directory " + input.Destination);
                Directory.CreateDirectory(input.Destination);
            }

            project.ExportTo(input.Destination);

            if (Exporter.Warnings.Any())
            {
                foreach (var warning in Exporter.Warnings)
                {
                    ConsoleWriter.Write(ConsoleColor.White, " * " + warning);
                }

                throw new Exception("Detected problems with the content");
            }

            return(true);
        }
        public override bool Execute(DocExportInput input)
        {
            var settings = input.ToSettings();

            settings.UrlStyle = input.ExportMode == ExportStyle.FileDump ? UrlStyle.FileExport : UrlStyle.WebsiteExport;

            var project = new DocProject(settings);

            if (!Directory.Exists(input.Destination))
            {
                Console.WriteLine("Creating directory " + input.Destination);
                Directory.CreateDirectory(input.Destination);
            }

            project.ExportTo(input.Destination);

            return(true);
        }
        public override bool Execute(DocExportInput input)
        {
            var settings = input.ToSettings();

            switch (input.ExportMode)
            {
            case ExportStyle.FileDump:
                settings.UrlStyle = UrlStyle.FileExport;
                break;

            case ExportStyle.Website:
                settings.UrlStyle = UrlStyle.WebsiteExport;
                break;

            case ExportStyle.ProjectWebsite:
                if (input.ProjectFlag.IsEmpty())
                {
                    throw new Exception("You need to specify the GitHub project name as the --project flag in order to use the ProjectWebsite export mode");
                }

                settings.UrlStyle = UrlStyle.ProjectWebsiteExport;
                break;
            }


            var project = new DocProject(settings);

            project.StartScanning();

            if (!Directory.Exists(input.Destination))
            {
                Console.WriteLine("Creating directory " + input.Destination);
                Directory.CreateDirectory(input.Destination);
            }

            project.ExportTo(input.Destination);

            return(true);
        }