Ejemplo n.º 1
0
        public override void PreProcess(GameList games, GameDB db)
        {
            this.games = games;
            this.db    = db;

            GetRecommendations();
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Prepares to categorize games. Prepares a list of genre categories to remove. Does nothing if removeothergenres is false.
 /// </summary>
 public override void PreProcess(GameList games, GameDB db)
 {
     base.PreProcess(games, db);
     gamelist = games;
     devList  = Program.GameDB.CalculateSortedDevList(OwnedOnly ? gamelist : null, MinCount);
     pubList  = Program.GameDB.CalculateSortedPubList(OwnedOnly ? gamelist : null, MinCount);
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Prepares to categorize games. Prepares a list of genre categories to remove. Does nothing if removeothergenres is false.
        /// </summary>
        public override void PreProcess(GameList games, GameDB db)
        {
            base.PreProcess(games, db);
            if (RemoveOtherGenres)
            {
                SortedSet <string> genreStrings = db.GetAllGenres();
                genreCategories = new SortedSet <Category>();

                foreach (string cStr in genreStrings)
                {
                    if (games.CategoryExists(String.IsNullOrEmpty(Prefix) ? (cStr) : (Prefix + cStr)) && !IgnoredGenres.Contains(cStr))
                    {
                        genreCategories.Add(games.GetCategory(cStr));
                    }
                }
            }
        }
Ejemplo n.º 4
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);
                }
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Prepares to categorize games. Prepares a list of genre categories to remove. Does nothing if removeothergenres is false.
        /// </summary>
        public override void PreProcess( GameList games, GameDB db ) {
            base.PreProcess( games, db );
            if( RemoveOtherGenres ) {

                SortedSet<string> genreStrings = db.GetAllGenres();
                genreCategories = new SortedSet<Category>();

                foreach( string cStr in genreStrings ) {
                    if( games.CategoryExists( String.IsNullOrEmpty( Prefix ) ? ( cStr ) : ( Prefix + cStr ) ) && !IgnoredGenres.Contains( cStr ) ) {
                        genreCategories.Add( games.GetCategory( cStr ) );
                    }
                }
            }
        }
Ejemplo n.º 6
0
 public int MergeGameDB( GameDB merge, bool overwriteGenres, out int genresUpdated ) {
     genresUpdated = 0;
     int added = 0;
     foreach( GameDBEntry mEntry in merge.Games.Values ) {
         if( this.Games.ContainsKey( mEntry.Id ) ) {
             if( overwriteGenres || string.IsNullOrEmpty(this.Games[mEntry.Id].Genre) ) {
                 this.Games[mEntry.Id].Genre = mEntry.Genre;
                 genresUpdated++;
             }
         } else {
             this.Games.Add( mEntry.Id, mEntry );
             added++;
         }
     }
     return added;
 }
Ejemplo n.º 7
0
 public virtual void DeProcess()
 {
     games = null;
     db    = null;
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Must be called before any categorizations are done. Should be overridden to perform any necessary database analysis or other preparation.
 /// After this is called, no configuration options should be changed before using CategorizeGame.
 /// </summary>
 public virtual void PreProcess(GameList games, GameDB db)
 {
     this.games = games;
     this.db    = db;
 }
Ejemplo n.º 9
0
 public virtual void DeProcess() {
     games = null;
     db = null;
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Must be called before any categorizations are done. Should be overridden to perform any necessary database analysis or other preparation.
 /// After this is called, no configuration options should be changed before using CategorizeGame.
 /// </summary>
 public virtual void PreProcess( GameList games, GameDB db ) {
     this.games = games;
     this.db = db;
 }
Ejemplo n.º 11
0
 protected override void RunProcess()
 {
     Added = 0;
     doc   = GameDB.FetchAppListFromWeb();
     OnThreadCompletion();
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Prepares to categorize games. Prepares a list of genre categories to remove. Does nothing if removeothergenres is false.
 /// </summary>
 public override void PreProcess(GameList games, GameDB db)
 {
     base.PreProcess(games, db);
     gamelist = games;
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Prepares to categorize games. Prepares a list of genre categories to remove. Does nothing if removeothergenres is false.
 /// </summary>
 public override void PreProcess(GameList games, GameDB db)
 {
     base.PreProcess(games, db);
     gamelist = games;
     devList = Program.GameDB.CalculateSortedDevList(OwnedOnly ? gamelist : null, MinCount);
     pubList = Program.GameDB.CalculateSortedPubList(OwnedOnly ? gamelist : null, MinCount);
 }
Ejemplo n.º 14
0
 private void MergeGenres() {
     OpenFileDialog dlg = new OpenFileDialog();
     dlg.DefaultExt = "gz";
     dlg.AddExtension = true;
     dlg.CheckFileExists = true;
     dlg.Filter = GlobalStrings.DBEditDlg_DialogFilter;
     DialogResult res = dlg.ShowDialog();
     if( res == System.Windows.Forms.DialogResult.OK ) {
         GameDB mDb = new GameDB();
         mDb.Load( dlg.FileName );
         int updated;
         int added = Program.GameDB.MergeGameDB( mDb, false, out updated );
         RefreshGameList();
         UnsavedChanges = true;
     }
 }
Ejemplo n.º 15
0
        /// <summary>
        /// Prepares to categorize games. Prepares a list of genre categories to remove. Does nothing if removeothergenres is false.
        /// </summary>
        public override void PreProcess( GameList games, GameDB db )
        {
            base.PreProcess( games, db );
            if( removeOtherGenres ) {
                SortedSet<string> catStrings = new SortedSet<string>();
                char[] sep = new char[] { ',' };
                foreach( GameDBEntry dbEntry in db.Games.Values ) {
                    if( !String.IsNullOrEmpty( dbEntry.Genre ) ) {
                        string[] cats = dbEntry.Genre.Split( sep );
                        foreach( string cStr in cats ) {
                            catStrings.Add( cStr.Trim() );
                        }
                    }
                }

                genreCategories = new SortedSet<Category>();
                foreach( string cStr in catStrings ) {
                    if( games.CategoryExists( cStr ) ) {
                        genreCategories.Add( games.GetCategory( cStr ) );
                    }
                }
            }
        }
Ejemplo n.º 16
0
 /// <summary>
 /// Prepares to categorize games. Prepares a list of genre categories to remove. Does nothing if removeothergenres is false.
 /// </summary>
 public override void PreProcess(GameList games, GameDB db)
 {
     base.PreProcess(games, db);
     gamelist = games;
 }