Esempio n. 1
0
        static void Main(string[] args)
        {
            Options o = new Options();

            if (args.Any())
            {
                /* do stuff without a GUI */
                Parser.Default.ParseArguments(args, o);

                if (o.Help == true)
                {
                    Console.WriteLine(CommandLine.Text.HelpText.AutoBuild(o));
                    return;
                }

                o.Link = o.Link.Trim(' ', '\t', '\n', '\v', '\f', '\r', '"', '\'');

                Syousetsu.Constants sc  = new Syousetsu.Constants();
                HtmlDocument        toc = Syousetsu.Methods.GetTableOfContents(o.Link, sc.SyousetsuCookie);

                sc.Chapters.Add("");
                sc.SeriesTitle    = Syousetsu.Methods.GetTitle(toc);
                sc.Link           = o.Link;
                sc.Start          = o.Start;
                sc.End            = String.IsNullOrWhiteSpace(o.End) ? Syousetsu.Methods.GetTotalChapters(toc).ToString() : o.End;
                sc.SeriesCode     = Syousetsu.Methods.GetSeriesCode(o.Link);
                sc.FilenameFormat = GetFilenameFormat();
                Syousetsu.Methods.GetAllChapterTitles(sc, toc);
                Syousetsu.Constants.FileType fileType = Syousetsu.Constants.FileType.Text;
                switch (o.Format.ToUpper())
                {
                case "HTML": { fileType = Syousetsu.Constants.FileType.HTML; break; }

                case "TXT": { fileType = Syousetsu.Constants.FileType.Text; break; }

                default: { fileType = Syousetsu.Constants.FileType.Text; break; }
                }
                sc.CurrentFileType = fileType;
                Syousetsu.Methods.GetAllChapterTitles(sc, toc);

                if (o.ToC == true)
                {
                    Syousetsu.Create.GenerateTableOfContents(sc, toc);
                }

                System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
                sw.Start();
                Syousetsu.Methods.AddDownloadJob(sc);
                sw.Stop();

                Console.WriteLine(sw.Elapsed);
            }
        }
 private void rbHtml_Checked(object sender, RoutedEventArgs e)
 {
     _fileType = Syousetsu.Constants.FileType.HTML;
 }
 private void rbText_Checked(object sender, RoutedEventArgs e)
 {
     _fileType = Syousetsu.Constants.FileType.Text;
 }