public override void PreProcess(GameList games, GameDB db) { this.games = games; this.db = db; GetRecommendations(); }
/// <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); }
/// <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)); } } } }
/// <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> /// 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 ) ); } } } }
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; }
public virtual void DeProcess() { games = null; db = null; }
/// <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; }
/// <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; }
protected override void RunProcess() { Added = 0; doc = GameDB.FetchAppListFromWeb(); OnThreadCompletion(); }
/// <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; }
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; } }
/// <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 ) ); } } } }