Ejemplo n.º 1
0
        public static async Task Main(string[] args)
        {
            Downloader dwn = Downloader.GetInstance();

            using (IMDBContext context = new IMDBContext())
            {
                dwn.DatabaseReady += () =>
                {
                    var currentCount = context.Titles.Count();
                    Console.WriteLine(currentCount);
                    foreach (var Title in TitleOperations.StartParsing(currentCount))
                    {
                        context.Add(Title);
                        Console.WriteLine("Добавлена запись ->" + Title.Tconst);
                    }
                    context.SaveChanges();
                    Console.WriteLine("База обновлена!");
                };



                while (true)
                {
                    await dwn.GetArchiveAsync();

                    Thread.Sleep(TimeSpan.FromDays(1));
                }
            }
        }
Ejemplo n.º 2
0
 public static TitleOperations GetInstance()
 {
     if (instance == null)
     {
         instance = new TitleOperations();
     }
     return(instance);
 }