Beispiel #1
0
        public static void Main(string[] args)
        {
            try
            {
                ConfigTools.InitConf("Config.xml");
                ConfigTools.InitConf("Config_user.xml");
                ConfigTools.InitLightNovels("LightNovels.xml", true);
                ConfigTools.InitLightNovels("LightNovels_user.xml", true);
                consoleTools = new ConsoleTools(1);
                ConsoleTools ctForWebcrawler = new ConsoleTools(3);
                webCrawler = new WebCrawler(ctForWebcrawler, ctForWebcrawler);
            }
            catch (ApplicationException e)
            {
                consoleTools.Log(e.Message);
                return;
            }

            if (!consoleTools.Ask(String.Format(LightNovelSniffer_CLI_Strings.AskOutputFolderConfirmation, Globale.OUTPUT_FOLDER)))
            {
                string folder = consoleTools.AskInformation(LightNovelSniffer_CLI_Strings.AskOutputFolder);
                if (!string.IsNullOrEmpty(folder))
                {
                    Globale.OUTPUT_FOLDER = folder;
                }
            }

            consoleTools.Log(LightNovelSniffer_CLI_Strings.LogProgramStart);

            foreach (LnParameters ln in Globale.LN_TO_RETRIEVE)
            {
                if (consoleTools.Ask(string.Format(LightNovelSniffer_CLI_Strings.AskRetrieveLn, ln.name)))
                {
                    GetNovel(ln);
                }
            }

            if (Globale.INTERACTIVE_MODE && consoleTools.AskNegative(LightNovelSniffer_CLI_Strings.LogEndOfLnInConfig))
            {
                LnParameters ln;
                do
                {
                    ln = BuildDynamicLn();
                    GetNovel(ln);
                } while (!string.IsNullOrEmpty(ln.name));
            }

            consoleTools.Log(LightNovelSniffer_CLI_Strings.LogProgramEnd);
            if (Globale.INTERACTIVE_MODE)
            {
                Console.ReadLine();
            }
        }
Beispiel #2
0
        public static void Main(string[] args)
        {
            fileStream = new FileStream("log.txt", FileMode.Create, FileAccess.Write);
            fileWriter = new FileWriter(fileStream);

            try
            {
                ConfigTools.InitConf("Config.xml");
                ConfigTools.InitConf("Config_user.xml");
                ConfigTools.InitLightNovels("LightNovels.xml", true);
                ConfigTools.InitLightNovels("LightNovels_user.xml", true);
                consoleTools = new ConsoleTools(fileWriter, 1);
                ConsoleTools ctForCore = new ConsoleTools(fileWriter, 3);
                lightNovelSniffer = new LNS(ctForCore, ctForCore);
            }
            catch (ApplicationException e)
            {
                consoleTools.Log(e.Message);
                return;
            }

            ShowBannier();
            consoleTools.Log(LightNovelSniffer_CLI_Strings.LogProgramStart);

            if (!consoleTools.Ask(String.Format(LightNovelSniffer_CLI_Strings.AskOutputFolderConfirmation, Globale.OUTPUT_FOLDER)))
            {
                string folder = consoleTools.AskInformation(LightNovelSniffer_CLI_Strings.AskOutputFolder);
                if (!string.IsNullOrEmpty(folder))
                {
                    Globale.OUTPUT_FOLDER = folder;
                }
            }

            foreach (LnParameters ln in Globale.LN_TO_RETRIEVE)
            {
                if (consoleTools.Ask(string.Format(LightNovelSniffer_CLI_Strings.AskRetrieveLn, ln.name)))
                {
                    GetNovel(ln);
                }
            }

            if (Globale.INTERACTIVE_MODE && consoleTools.AskNegative(LightNovelSniffer_CLI_Strings.LogEndOfLnInConfig))
            {
                LnParameters ln;
                do
                {
                    ln = BuildDynamicLn();
                    GetNovel(ln);
                } while (!string.IsNullOrEmpty(ln.name));
            }

            consoleTools.Log(LightNovelSniffer_CLI_Strings.LogProgramEnd);

            fileWriter.Close();
            fileStream.Close();

            if (Globale.INTERACTIVE_MODE)
            {
                Console.ReadLine();
            }
        }