C# Class BF2Statistics.Database.GamespyDatabase

A class to provide common tasks against the Gamespy Login Database
Inheritance: BF2Statistics.Database.DatabaseDriver, IDisposable
Show file Open project: BF2Statistics/ControlCenter Class Usage Examples

Public Properties

Property Type Description
LatestVersion System.Version

Public Methods

Method Description
CreateSqlTables ( ) : void

Tells the Database to install the Stats tables into the database

CreateUser ( int Pid, string Nick, string Pass, string Email, string Country ) : bool

Creates a new Gamespy Account

Only used in the Gamespy Account Creation Form

CreateUser ( string Nick, string Pass, string Email, string Country ) : int

Creates a new Gamespy Account

Used by the login server when a create account request is made

DeleteUser ( int Pid ) : int

Deletes a Gamespy Account

DeleteUser ( string Nick ) : int

Deletes a Gamespy Account

GamespyDatabase ( ) : System

Creates a new connection to the Gamespy Database

GetNumAccounts ( ) : int

Returns the number of accounts in the database

GetPlayerId ( string Nick ) : int

Fetches a Gamespy Account id from an account name

GetUser ( int Pid ) : object>.Dictionary

Fetches an account from the gamespy database

GetUser ( string Nick ) : object>.Dictionary

Fetches an account from the gamespy database

GetUsersByEmailPass ( string Email, string Password ) : object>>.List

Fetches an account from the gamespy database

GetUsersLike ( string Nick ) : List

Returns a list of player names that are similar to the passed parameter

MigrateTables ( ) : void

If there is any table updates that need to be applied, calling this method will apply each update until the current database version is up to date

SetPlayerId ( string Nick, int Pid ) : int

Sets the Account (Player) Id for an account by Name

UpdateUser ( int Id, int NewPid, string NewNick, string NewPassword, string NewEmail ) : void

Updates an Account's information by ID

UpdateUser ( string Nick, string Country ) : void

Updates an Accounts Country Code

UserExists ( int PID ) : bool

Returns wether an account exists from the provided Account Id

UserExists ( string Nick ) : bool

Returns wether an account exists from the provided Nick

Method Details

CreateSqlTables() public method

Tells the Database to install the Stats tables into the database
public CreateSqlTables ( ) : void
return void

CreateUser() public method

Creates a new Gamespy Account
Only used in the Gamespy Account Creation Form
public CreateUser ( int Pid, string Nick, string Pass, string Email, string Country ) : bool
Pid int The Profile Id to assign this account
Nick string The Account Name
Pass string The UN-HASHED Account Password
Email string The Account Email Address
Country string The Country Code for this Account
return bool

CreateUser() public method

Creates a new Gamespy Account
Used by the login server when a create account request is made
public CreateUser ( string Nick, string Pass, string Email, string Country ) : int
Nick string The Account Name
Pass string The UN-HASHED Account Password
Email string The Account Email Address
Country string The Country Code for this Account
return int

DeleteUser() public method

Deletes a Gamespy Account
public DeleteUser ( int Pid ) : int
Pid int
return int

DeleteUser() public method

Deletes a Gamespy Account
public DeleteUser ( string Nick ) : int
Nick string The Player's Nick, a.k.a Account name
return int

GamespyDatabase() public method

Creates a new connection to the Gamespy Database
public GamespyDatabase ( ) : System
return System

GetNumAccounts() public method

Returns the number of accounts in the database
public GetNumAccounts ( ) : int
return int

GetPlayerId() public method

Fetches a Gamespy Account id from an account name
public GetPlayerId ( string Nick ) : int
Nick string
return int

GetUser() public method

Fetches an account from the gamespy database
public GetUser ( int Pid ) : object>.Dictionary
Pid int The account player ID
return object>.Dictionary

GetUser() public method

Fetches an account from the gamespy database
public GetUser ( string Nick ) : object>.Dictionary
Nick string The user's Nick
return object>.Dictionary

GetUsersByEmailPass() public method

Fetches an account from the gamespy database
public GetUsersByEmailPass ( string Email, string Password ) : object>>.List
Email string The Account email
Password string the MD5 HASHED Account Password
return object>>.List

GetUsersLike() public method

Returns a list of player names that are similar to the passed parameter
public GetUsersLike ( string Nick ) : List
Nick string
return List

MigrateTables() public method

If there is any table updates that need to be applied, calling this method will apply each update until the current database version is up to date
public MigrateTables ( ) : void
return void

SetPlayerId() public method

Sets the Account (Player) Id for an account by Name
public SetPlayerId ( string Nick, int Pid ) : int
Nick string The account Nick we are setting the new Pid for
Pid int The new Pid
return int

UpdateUser() public method

Updates an Account's information by ID
public UpdateUser ( int Id, int NewPid, string NewNick, string NewPassword, string NewEmail ) : void
Id int The Current Account ID
NewPid int New Account ID
NewNick string New Account Name
NewPassword string New Account Password, UN HASHED. Leave empty to not set a new password
NewEmail string New Account Email Address
return void

UpdateUser() public method

Updates an Accounts Country Code
public UpdateUser ( string Nick, string Country ) : void
Nick string
Country string
return void

UserExists() public method

Returns wether an account exists from the provided Account Id
public UserExists ( int PID ) : bool
PID int
return bool

UserExists() public method

Returns wether an account exists from the provided Nick
public UserExists ( string Nick ) : bool
Nick string
return bool

Property Details

LatestVersion public static property

Indicates the most up to date database table version
public static Version,System LatestVersion
return System.Version