BF2Statistics.Database.GamespyDatabase.GetUser C# (CSharp) Метод

GetUser() публичный Метод

Fetches an account from the gamespy database
public GetUser ( int Pid ) : object>.Dictionary
Pid int The account player ID
Результат object>.Dictionary
        public Dictionary<string, object> GetUser(int Pid)
        {
            // Fetch the user
            var Rows = base.Query("SELECT * FROM accounts WHERE id=@P0", Pid);
            return (Rows.Count == 0) ? null : Rows[0];
        }

Same methods

GamespyDatabase::GetUser ( string Nick ) : object>.Dictionary

Usage Example

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="Pid">The player account ID</param>
        public AccountEditForm(int Pid)
        {
            InitializeComponent();
            this.AccountId = Pid;

            // Register for Events
            GpcmClient.OnSuccessfulLogin += GpcmClient_OnSuccessfulLogin;
            GpcmClient.OnDisconnect += GpcmClient_OnDisconnect;

            // Fill the account information boxes
            using (GamespyDatabase Database = new GamespyDatabase())
            {
                Dictionary<string, object> User = Database.GetUser(AccountId);
                PlayerID.Value = AccountId = Int32.Parse(User["id"].ToString());
                AccountNick.Text = User["name"].ToString();
                AccountEmail.Text = User["email"].ToString();

                // Disable options if user is online
                if (GamespyEmulator.IsPlayerConnected(AccountId))
                {
                    SatusLabel.Text = "Online (IP: " + User["lastip"].ToString() + ")";
                    UpdateBtn.Enabled = false;
                    DeleteBtn.Enabled = false;
                    DisconnectBtn.Enabled = true;
                }
                else
                {
                    SatusLabel.Text = "Offline";
                }
            }
        }
All Usage Examples Of BF2Statistics.Database.GamespyDatabase::GetUser