Beispiel #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);
            }

            GameDBEntry newGame = new GameDBEntry();

            newGame.Id = 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);
            }
        }
Beispiel #2
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()
        {
            Game game = GetNextGame();

            if (game == null)
            {
                return(false);
            }
            if (Stopped)
            {
                return(false);
            }
            // TODO: Make sure this gets Totally Revamped when multiple cat options are put in place.
            GameDBEntry dbEntry = new GameDBEntry();
            AppType     type    = dbEntry.ScrapeStore(game.Id);

            if (type == AppType.WebError)
            {
                Failures++;
            }
            string genre = dbEntry.Genre;

            if (!fullGenre)
            {
                genre = GameDB.TruncateGenre(genre);
            }

            // 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)
                {
                    scrapeResults.Add(game.Id, genre);
                    OnJobCompletion();
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
        /// <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;

            GameDBEntry newGame = new GameDBEntry();
            newGame.ScrapeStore( id );

            // 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;
                } else {
                    return false;
                }
            }
        }
        /// <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() {
            Game game = GetNextGame();
            if( game == null ) {
                return false;
            }
            if( Stopped ) return false;
            // TODO: Make sure this gets Totally Revamped when multiple cat options are put in place.
            GameDBEntry dbEntry = new GameDBEntry();
            AppType type = dbEntry.ScrapeStore( game.Id );
            if( type == AppType.WebError ) {
                Failures++;
            }
            string genre = dbEntry.Genre;
            if( !fullGenre ) genre = GameDB.TruncateGenre( genre );

            // 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 ) {
                    scrapeResults.Add( game.Id, genre );
                    OnJobCompletion();
                    return true;
                } else {
                    return false;
                }
            }
        }