Ejemplo n.º 1
0
        /// <summary>
        ///     Runs the next job in the queue, in a thread-safe manner. Aborts ASAP if the form is closed.
        /// </summary>
        /// <returns>True if a job was run, false if it was aborted first</returns>
        private bool RunNextJob()
        {
            int id = GetNextGameId();

            if (id == 0)
            {
                return(false);
            }

            if (Stopped)
            {
                return(false);
            }

            DatabaseEntry newGame = new DatabaseEntry(id);

            newGame.ScrapeStore();

            // This lock is critical, as it makes sure that the abort check and the actual game update funtion essentially atomically with reference to form-closing.
            // If this isn't the case, the form could successfully close before this happens, but then it could still go through, and that's no good.
            lock (abortLock)
            {
                if (!Stopped)
                {
                    results.Add(newGame);
                    OnJobCompletion();
                    return(true);
                }

                return(false);
            }
        }
Ejemplo n.º 2
0
        private void RunJob(int appId)
        {
            if (Stopped)
            {
                return;
            }

            DatabaseEntry entry = Program.Database.Contains(appId) ? Program.Database.Games[appId] : new DatabaseEntry(appId);

            entry.ScrapeStore();

            if (entry.LastStoreScrape == 0)
            {
                entry.ScrapeTrueSteamAchievements();
            }

            lock (SyncRoot)
            {
                if (Stopped)
                {
                    return;
                }

                _results.Add(entry);
                OnJobCompletion();
            }
        }
Ejemplo n.º 3
0
        private void RunJob(int appId)
        {
            if (Stopped)
            {
                return;
            }

            DatabaseEntry entry = new DatabaseEntry
            {
                Id = appId
            };

            entry.ScrapeStore();

            lock (SyncRoot)
            {
                if (Stopped)
                {
                    return;
                }

                _results.Add(entry);
                OnJobCompletion();
            }
        }
Ejemplo n.º 4
0
        private void RunJob(int appId)
        {
            lock (SyncRoot)
            {
                if (_stopped)
                {
                    return;
                }
            }

            DatabaseEntry entry = Database.Contains(appId, out entry) ? entry : new DatabaseEntry(appId);

            entry.ScrapeStore();

            if (entry.LastStoreScrape == 0)
            {
                entry.ScrapeTrueSteamAchievements();
            }

            lock (SyncRoot)
            {
                if (_stopped)
                {
                    return;
                }

                _results.Add(entry);
                OnJobCompletion();
            }
        }
Ejemplo n.º 5
0
        private bool RunNextJob()
        {
            if (!GetNextJob(out ScrapeJob job))
            {
                return(false);
            }

            DatabaseEntry newGame = new DatabaseEntry(job.Id)
            {
                AppId = job.ScrapeId
            };

            newGame.ScrapeStore(FormMain.SteamWebApiKey, Database.LanguageCode);
            if (Stopped)
            {
                return(false);
            }

            if (newGame.LastStoreScrape != 0)
            {
                _results.Enqueue(newGame);
            }

            OnJobCompletion();

            return(true);
        }
Ejemplo n.º 6
0
        private void RunJob(int appId)
        {
            if (Stopped)
            {
                return;
            }

            DatabaseEntry entry = Database.Instance.Contains(appId) ? Database.Instance.Games[appId] : new DatabaseEntry(appId);

            try
            {
                entry.ScrapeStore();
            }
            catch (Exception)
            {
                Logger.Instance.Warn("Error while scraping appid: {0}", appId);
                return;
            }

            if (entry.LastStoreScrape == 0)
            {
                try
                {
                    entry.ScrapeTrueSteamAchievements();
                }
                catch (Exception)
                {
                    Logger.Instance.Warn("Error while scraping TSA appid: {0}", appId);
                    return;
                }
            }

            lock (SyncRoot)
            {
                if (Stopped)
                {
                    return;
                }

                _results.Add(entry);
                OnJobCompletion();
            }
        }
Ejemplo n.º 7
0
 public DatabaseEntryTests()
 {
     _entry1.ScrapeStore(StoreLanguage.English);
     _entry2.ScrapeStore(StoreLanguage.Dutch);
     _entry3.ScrapeStore(StoreLanguage.ChineseSimplified);
 }