C# Class BF2Statistics.ASP.StatsManager

The StatsManager is used to provide methods that allow you to Validate ASP servers, Authorize game server IP addresses to post snapshot data, and import snapshot data into the stats database.
Show file Open project: BF2Statistics/ControlCenter

Public Methods

Method Description
ExportPlayerXml ( string XmlPath, int Pid, string Name ) : void

Exports a players stats and history into an Xml file

GenerateNewAIPid ( ) : int

Returns a new PID number for use when creating a new AI Bot for the stats database

GenerateNewPlayerPid ( ) : int

Returns a new PID number for use when creating a new player for the stats database

ImportPlayerXml ( string XmlPath ) : void

Imports a Player XML Sheet from the specified path

IsAuthorizedGameServer ( IPAddress RemoteIP ) : bool

Returns whether the specified IP address is authorized to POST snapshot data to this ASP server. All local IP address are automatically authorized.

Load ( StatsDatabase Driver ) : void

Method to be called everytime the HttpStatsServer is started

QueueServerSnapshot ( string Data, IPAddress ServerAddress ) : void

Adds a server's posted snapshot into the Snapshot Processing Queue, which will process the snapshot as soon as possible. This method is Non-Blocking.

Any errors that occur during the actual import of the data will be logged inside the StatsDebug log

ValidateASPService ( string Url ) : void

Returns whether the specified URI is a valid, and available ASP Service

Private Methods

Method Description
ProcessQueue ( ) : void

If not already running, Whenever a snapshot is added to the Processing Queue, This method will get called to Dequeue and process all snapshots

StatsManager ( ) : System

Static constructor to register for Queue Events

Method Details

ExportPlayerXml() public static method

Exports a players stats and history into an Xml file
public static ExportPlayerXml ( string XmlPath, int Pid, string Name ) : void
XmlPath string The folder path to where the XML will be saved
Pid int Player ID
Name string Player Name
return void

GenerateNewAIPid() public static method

Returns a new PID number for use when creating a new AI Bot for the stats database
public static GenerateNewAIPid ( ) : int
return int

GenerateNewPlayerPid() public static method

Returns a new PID number for use when creating a new player for the stats database
public static GenerateNewPlayerPid ( ) : int
return int

ImportPlayerXml() public static method

Imports a Player XML Sheet from the specified path
public static ImportPlayerXml ( string XmlPath ) : void
XmlPath string The full path to the XML file
return void

IsAuthorizedGameServer() public static method

Returns whether the specified IP address is authorized to POST snapshot data to this ASP server. All local IP address are automatically authorized.
public static IsAuthorizedGameServer ( IPAddress RemoteIP ) : bool
RemoteIP System.Net.IPAddress The server IP to authorize
return bool

Load() public static method

Method to be called everytime the HttpStatsServer is started
public static Load ( StatsDatabase Driver ) : void
Driver BF2Statistics.Database.StatsDatabase
return void

QueueServerSnapshot() public static method

Adds a server's posted snapshot into the Snapshot Processing Queue, which will process the snapshot as soon as possible. This method is Non-Blocking.
Any errors that occur during the actual import of the data will be logged inside the StatsDebug log
/// Thrown if the Server IP is not authorized to post game data to this server /// /// Thrown if the provided Snapshot data is not valid, and cannot be processed ///
public static QueueServerSnapshot ( string Data, IPAddress ServerAddress ) : void
Data string The snapshot data provided by the server.
ServerAddress System.Net.IPAddress The IP address of the server.
return void

ValidateASPService() public static method

Returns whether the specified URI is a valid, and available ASP Service
public static ValidateASPService ( string Url ) : void
Url string The root url to the ASP server. Dont include the /ASP/ path!
return void