コード例 #1
0
        public override void PreProcess(GameList games, GameDB db)
        {
            this.games = games;
            this.db    = db;

            GetRecommendations();
        }
コード例 #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);
 }
コード例 #3
0
ファイル: AutoCatGenre.cs プロジェクト: satma/depressurizer
        /// <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));
                    }
                }
            }
        }
コード例 #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);
                }
            }
        }
コード例 #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 ) );
                    }
                }
            }
        }
コード例 #6
0
ファイル: GameDB.cs プロジェクト: BenjaTheGamer/depressurizer
 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;
 }
コード例 #7
0
 public virtual void DeProcess()
 {
     games = null;
     db    = null;
 }
コード例 #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;
 }
コード例 #9
0
ファイル: AutoCat.cs プロジェクト: r-pufky/depressurizer
 public virtual void DeProcess() {
     games = null;
     db = null;
 }
コード例 #10
0
ファイル: AutoCat.cs プロジェクト: r-pufky/depressurizer
 /// <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;
 }
コード例 #11
0
ファイル: CDlgFetch.cs プロジェクト: alca259/depressurizer
 protected override void RunProcess()
 {
     Added = 0;
     doc   = GameDB.FetchAppListFromWeb();
     OnThreadCompletion();
 }
コード例 #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;
 }
コード例 #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);
 }
コード例 #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;
     }
 }
コード例 #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 ) );
                    }
                }
            }
        }
コード例 #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;
 }