C# Class GameJoltAPI.Session

This singleton safe-thread handles sessions. All functions are exposed for manual use, there's also a function for automated handling.

See: http://gamejolt.com/api/doc/game/sessions/ for further information.

@author Christian "HyperGod" Bosence

@version 0.1.0.0

Show file Open project: Bosence/GameJolt-C--API

Public Methods

Method Description
changeStatus ( SessionStatus status ) : void

Changes the session to the one passed. Active by default. Won't update until next ping (at worst 60 seconds delay).

close ( ) : void

Closes the session. Call this when the game is closing, or you no longer want sessions.

Throws an API exception if unsuccesful.

open ( bool automated = true, int game_id = null, string username = null, string user_token = null ) : void

Opens the the session. Will auto-manage, if automated isn't overriden.

Throws an API exception if unsuccesful.

Don't need to set any parameters if you've set up Config.

ping ( ) : void

Do not use if automated. Pings the API, to indicate the session. Uses the stored status. changeStatus() to alter this.

Throws an API exception if unsuccesful.

Private Methods

Method Description
Session ( ) : System
pingE ( object source, System.Timers.ElapsedEventArgs e ) : void

Calls ping, with event parameters as required by timer. Doesn't need to be exposed, thus different accessor.

Method Details

changeStatus() public static method

Changes the session to the one passed. Active by default. Won't update until next ping (at worst 60 seconds delay).

public static changeStatus ( SessionStatus status ) : void
status SessionStatus SessionStatus enum to indicate the status.
return void

close() public static method

Closes the session. Call this when the game is closing, or you no longer want sessions.

Throws an API exception if unsuccesful.

public static close ( ) : void
return void

open() public static method

Opens the the session. Will auto-manage, if automated isn't overriden.

Throws an API exception if unsuccesful.

Don't need to set any parameters if you've set up Config.

public static open ( bool automated = true, int game_id = null, string username = null, string user_token = null ) : void
automated bool Do you want Session to set up a timer thread to automate the pinging? Defaults to true.
game_id int ID of your Game. Only set if you haven't in config. Don't need to set parameter if you've set up Config.
username string Username of your User. Don't need to set parameter if you've set up Config.
user_token string User token of your User. Don't need to set parameter if you've set up Config.
return void

ping() public static method

Do not use if automated. Pings the API, to indicate the session. Uses the stored status. changeStatus() to alter this.

Throws an API exception if unsuccesful.

public static ping ( ) : void
return void