Ejemplo n.º 1
0
        /**************************
        *   ===== Processing =====
        **************************/

        private void ProcessThread(int id, string html)
        {
            if (String.IsNullOrEmpty(html))
            {
                DatabaseQueue.Enqueue(new DbModels.Thread()
                {
                    Id = id
                });
                TelemetryManager.IncrimentEmptyThreads();
                return;
            }

            RobloxThread thread = new RobloxThread(id);

            thread.AddPage(html);
            if (thread.IsEmpty)
            {
                DatabaseQueue.Enqueue(new DbModels.Thread()
                {
                    Id = id
                });
                TelemetryManager.IncrimentEmptyThreads();
                return;
            }
            if (thread.PagesCount > 1 && thread.CurrentPage < thread.PagesCount)
            {
                PageDownloadingQueue.Enqueue(thread);
                return;
            }

            DbModels.Thread dbThread = thread.ToDbThread();
            DatabaseQueue.Enqueue(dbThread);
            thread = null; //TODO: Evaluate necessity
            return;
        }
Ejemplo n.º 2
0
 //Return value indicates if the thread is finished or not
 private bool ProcessThreadPage(RobloxThread thread, string html)
 {
     if (String.IsNullOrEmpty(html))
     {
         thread.Errors += $"; Page {thread.CurrentPage} is error";
         return(true);
     }
     thread.AddPage(html);
     if (thread.CurrentPage < thread.PagesCount)
     {
         PageDownloadingQueue.Enqueue(thread);
         return(false);
     }
     return(true);
 }
Ejemplo n.º 3
0
 public UnparsedPage(RobloxThread thread, string html)
 {
     Thread = thread;
     Html   = html;
 }
Ejemplo n.º 4
0
        private async Task DownloadThreadPage(RobloxThread thread)
        {
            string html = await client.GetThread(thread.ThreadId, thread.CurrentPage, thread.GetNextPageParams());

            PageProcessingQueue.Enqueue(new UnparsedPage(thread, html));
        }