C# Класс BF2Statistics.Gamespy.GpcmClient

Gamespy Client Manager This class is used to proccess the client login process, create new user accounts, and fetch profile information gpcm.gamespy.com
Наследование: IDisposable
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
ConnectionId int
Created System.DateTime

Защищенные свойства (Protected)

Свойство Тип Описание
Crc BF2Statistics.Utilities.Crc16

Открытые методы

Метод Описание
Disconnect ( int code ) : void

Logs the client out of the game client, and closes the stream

Codes: 0 => Client sends the "logout" command 1 => The login timer elapsed and the client wasnt logged in or this object was disposed, forcefully disconnected 2 => Invalid login query, or username was incorrect 3 => Incorrect Password 4 => An error occured while trying to login the client (could be database related) 5 => Cant create account, username exists already 6 => Error Creating new account in database 7 => Invalid query for account creation, or an exception was thrown while trying to create account 8 => Remote Connection closed the Stream or was un-readchable 9 => Forced server shutdown [No events called, database sessions are not updated, and EventArgs are disposed]

Dispose ( ) : void

Disposes of the client object. The connection is no longer closed here and the Disconnect even is NO LONGER fired

Equals ( object Obj ) : bool
GetHashCode ( ) : int
GpcmClient ( GamespyTcpStream ConnectionStream, int ConnectionId ) : System

Constructor

ProcessLogin ( string>.Dictionary Recv ) : void

This method verifies the login information sent by the client, and returns encrypted data for the client to verify as well

SendKeepAlive ( ) : void

Polls the connection, and checks for drops

SendServerChallenge ( ) : void

This method starts off by sending a random string 10 characters in length, known as the Server challenge key. This is used by the client to return a client challenge key, which is used to validate login information later.

Приватные методы

Метод Описание
ConvertToKeyValue ( string parts ) : string>.Dictionary

Converts a recived parameter array from the client string to a keyValue pair dictionary

CreateNewUser ( string>.Dictionary Recv ) : void

Whenever the "newuser" command is recieved, this method is called to add the new users information into the database

GenerateProof ( string challenge1, string challenge2 ) : string

Generates an MD5 hash, which is used to verify the clients login information

GenerateRandomString ( int length ) : string

Generates a random alpha-numeric string

GenerateSig ( ) : string

Generates a random signature

SendProfile ( ) : void

This method is called when the client requests for the Account profile

Stream_DataReceived ( string message ) : void

Event called when a complete message has been recieved

Stream_OnDisconnect ( ) : void

Event fired when the stream disconnects. Even though its 1 line, we un-register it at one point, so it needs to be here

UpdateUser ( string>.Dictionary Recv ) : void

Updates the Users Country code when sent by the client

Описание методов

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

Logs the client out of the game client, and closes the stream
Codes: 0 => Client sends the "logout" command 1 => The login timer elapsed and the client wasnt logged in or this object was disposed, forcefully disconnected 2 => Invalid login query, or username was incorrect 3 => Incorrect Password 4 => An error occured while trying to login the client (could be database related) 5 => Cant create account, username exists already 6 => Error Creating new account in database 7 => Invalid query for account creation, or an exception was thrown while trying to create account 8 => Remote Connection closed the Stream or was un-readchable 9 => Forced server shutdown [No events called, database sessions are not updated, and EventArgs are disposed]
public Disconnect ( int code ) : void
code int /// The disconnect code. If set to 9, the OnDisconect event will not be called, the database /// will not be updated to reset everyone's session code, and the EventArgs objects will NOT /// be returned to the IO pool. You should only set to 9 for a planned server shutdown. ///
Результат void

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

Disposes of the client object. The connection is no longer closed here and the Disconnect even is NO LONGER fired
public Dispose ( ) : void
Результат void

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

public Equals ( object Obj ) : bool
Obj object
Результат bool

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

public GetHashCode ( ) : int
Результат int

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

Constructor
public GpcmClient ( GamespyTcpStream ConnectionStream, int ConnectionId ) : System
ConnectionStream BF2Statistics.Gamespy.Net.GamespyTcpStream
ConnectionId int
Результат System

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

This method verifies the login information sent by the client, and returns encrypted data for the client to verify as well
public ProcessLogin ( string>.Dictionary Recv ) : void
Recv string>.Dictionary
Результат void

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

Polls the connection, and checks for drops
public SendKeepAlive ( ) : void
Результат void

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

This method starts off by sending a random string 10 characters in length, known as the Server challenge key. This is used by the client to return a client challenge key, which is used to validate login information later.
public SendServerChallenge ( ) : void
Результат void

Описание свойств

ConnectionId публичное свойство

Indicates the connection ID for this connection
public int ConnectionId
Результат int

Crc защищенное статическое свойство

Our CRC16 object for generating Checksums
protected static Crc16,BF2Statistics.Utilities Crc
Результат BF2Statistics.Utilities.Crc16

Created публичное свойство

Indicates the date and time this connection was created
public DateTime,System Created
Результат System.DateTime