Exemplo n.º 1
0
        private static void StartUpdating()
        {
            Console.WriteLine($"Getting updates on {DateTime.Now}");
            var freshNewsCount = Helper.UpdateNewsDb();

            if (freshNewsCount > 0)
            {
                Helper.ShowNotify(freshNewsCount + " fresh news downloaded");
            }
            Console.WriteLine($"Update finished on {DateTime.Now}");
            Console.WriteLine(new string('*', 50));
        }
Exemplo n.º 2
0
        private static void GenerateDoc()
        {
            Console.WriteLine($"Generating Doc on {DateTime.Now}");
            var news = Helper.CategorizeNewsByAttackType(Helper.GetUnGeneratedNews());

            if (!news.Any())
            {
                Helper.ShowNotify("No News to generate Document");
                return;
            }

            DocHelper.GenerateDocument(news.Take(100).ToList());
            if (news.Count > 100)
            {
                DocHelper.GenerateDocument(news.Skip(100).ToList());
            }
            Helper.ShowNotify("TechWatch document generated");

            new Thread(() =>
            {
                DbHelper.UpdateDbSetNewsReadBit(news);
            }).Start();
        }