SetFavorite() public method

public SetFavorite ( bool fav ) : void
fav bool
return void
示例#1
0
        private void cmdOk_Click(object sender, EventArgs e)
        {
            if (editMode)
            {
                Game.Name       = txtName.Text;
                Game.Executable = txtExecutable.Text;
            }
            else
            {
                int id;
                if (!int.TryParse(txtId.Text, out id))
                {
                    MessageBox.Show(GlobalStrings.DlgGameDBEntry_IDMustBeInteger, GlobalStrings.Gen_Warning,
                                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                if (Data.Games.ContainsKey(id))
                {
                    MessageBox.Show(GlobalStrings.DBEditDlg_GameIdAlreadyExists, GlobalStrings.DBEditDlg_Error,
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                Game = new GameInfo(id, txtName.Text, Data, txtExecutable.Text);
                Game.ApplySource(GameListingSource.Manual);
                Data.Games.Add(id, Game);
            }

            Game.SetFavorite(chkFavorite.Checked);

            Game.Hidden = chkHidden.Checked;

            DialogResult = DialogResult.OK;
            Close();
        }
示例#2
0
        private static void AddGameFromXmlNode(XmlNode node, Profile profile, int profileVersion)
        {
            int id;

            if (XmlUtil.TryGetIntFromNode(node[XmlName_Game_Id], out id))
            {
                GameListingSource source = XmlUtil.GetEnumFromNode(node[XmlName_Game_Source], GameListingSource.Unknown);

                if ((source < GameListingSource.Manual) && profile.IgnoreList.Contains(id))
                {
                    return;
                }

                string   name = XmlUtil.GetStringFromNode(node[XmlName_Game_Name], null);
                GameInfo game = new GameInfo(id, name, profile.GameData);
                game.Source = source;
                profile.GameData.Games.Add(id, game);

                game.Hidden     = XmlUtil.GetBoolFromNode(node[XmlName_Game_Hidden], false);
                game.Executable = XmlUtil.GetStringFromNode(node[XmlName_Game_Executable], null);
                game.LastPlayed = XmlUtil.GetIntFromNode(node[XmlName_Game_LastPlayed], 0);

                if (profileVersion < 1)
                {
                    string catName;
                    if (XmlUtil.TryGetStringFromNode(node[XmlName_Game_Category], out catName))
                    {
                        game.AddCategory(profile.GameData.GetCategory(catName));
                    }

                    if (node.SelectSingleNode(XmlName_Old_Game_Favorite) != null)
                    {
                        game.SetFavorite(true);
                    }
                }
                else
                {
                    XmlNode catListNode = node.SelectSingleNode(XmlName_Game_CategoryList);
                    if (catListNode != null)
                    {
                        XmlNodeList catNodes = catListNode.SelectNodes(XmlName_Game_Category);
                        foreach (XmlNode cNode in catNodes)
                        {
                            string cat;
                            if (XmlUtil.TryGetStringFromNode(cNode, out cat))
                            {
                                game.AddCategory(profile.GameData.GetCategory(cat));
                            }
                        }
                    }
                }
            }
        }
示例#3
0
        private static void AddGameFromXmlNode( XmlNode node, Profile profile, int profileVersion ) {
            int id;
            if( XmlUtil.TryGetIntFromNode( node[XmlName_Game_Id], out id ) ) {
                GameListingSource source = XmlUtil.GetEnumFromNode<GameListingSource>( node[XmlName_Game_Source], GameListingSource.Unknown );

                if( source < GameListingSource.Manual && profile.IgnoreList.Contains( id ) ) {
                    return;
                }

                string name = XmlUtil.GetStringFromNode( node[XmlName_Game_Name], null );
                GameInfo game = new GameInfo( id, name, profile.GameData );
                game.Source = source;
                profile.GameData.Games.Add( id, game );

                game.Hidden = XmlUtil.GetBoolFromNode( node[XmlName_Game_Hidden], false );

                if( profileVersion < 1 ) {
                    string catName;
                    if( XmlUtil.TryGetStringFromNode( node[XmlName_Game_Category], out catName ) ) {
                        game.AddCategory( profile.GameData.GetCategory( catName ) );
                    }
                    if( ( node.SelectSingleNode( XmlName_Old_Game_Favorite ) != null ) ) {
                        game.SetFavorite( true );
                    }
                } else {
                    XmlNode catListNode = node.SelectSingleNode( XmlName_Game_CategoryList );
                    if( catListNode != null ) {
                        XmlNodeList catNodes = catListNode.SelectNodes( XmlName_Game_Category );
                        foreach( XmlNode cNode in catNodes ) {
                            string cat;
                            if( XmlUtil.TryGetStringFromNode( cNode, out cat ) ) {
                                game.AddCategory( profile.GameData.GetCategory( cat ) );
                            }
                        }
                    }
                }
            }
        }