C# Class BF2Statistics.Web.Bf2Stats.Controller

Show file Open project: BF2Statistics/ControlCenter

Protected Properties

Property Type Description
CacheFile System.IO.FileInfo
Client HttpClient

Public Methods

Method Description
Controller ( HttpClient Client ) : System
FormatDate ( int Time ) : string

Takes a timestamp and converts it to a data format that was used in BF2sClone

FormatTime ( int Time ) : string

Formats an integer timestamp to a timespan format that was used in BF2sClone

HandleRequest ( MvcRoute Route ) : void

Processes the request, and sends a resonse back to the client

SendCachedResponse ( string CacheFileName ) : void

Fills the client response with the contents of the Cache file specified

Protected Methods

Method Description
CacheFileExpired ( string CacheFileName, int CacheTime ) : bool

Returns whether or not the Cache file is expired

CorrectUrls ( string source, BF2PageModel Model ) : string

This method will reformat all base url's to point to the requested hostname and bf2stats querypath.

EnsureTemplate ( string Name ) : bool

Returns whether the template name provided has been compiled with the Razor Engine

SendTemplateResponse ( string TemplateName, Type ModelType, object Model, string CacheFileName = "" ) : void

Runs the specified Template through the RazorEngine and sends the contents back to the client in the Response

Method Details

CacheFileExpired() protected method

Returns whether or not the Cache file is expired
protected CacheFileExpired ( string CacheFileName, int CacheTime ) : bool
CacheFileName string The Cache file name
CacheTime int The expire time of the cache file in Minutes
return bool

Controller() public method

public Controller ( HttpClient Client ) : System
Client HttpClient
return System

CorrectUrls() protected method

This method will reformat all base url's to point to the requested hostname and bf2stats querypath.
protected CorrectUrls ( string source, BF2PageModel Model ) : string
source string
Model BF2PageModel
return string

EnsureTemplate() protected method

Returns whether the template name provided has been compiled with the Razor Engine
protected EnsureTemplate ( string Name ) : bool
Name string The name of the template
return bool

FormatDate() public method

Takes a timestamp and converts it to a data format that was used in BF2sClone
public FormatDate ( int Time ) : string
Time int
return string

FormatTime() public method

Formats an integer timestamp to a timespan format that was used in BF2sClone
public FormatTime ( int Time ) : string
Time int
return string

HandleRequest() public abstract method

Processes the request, and sends a resonse back to the client
public abstract HandleRequest ( MvcRoute Route ) : void
Route MvcRoute
return void

SendCachedResponse() public method

Fills the client response with the contents of the Cache file specified
public SendCachedResponse ( string CacheFileName ) : void
CacheFileName string The name of the cache file
return void

SendTemplateResponse() protected method

Runs the specified Template through the RazorEngine and sends the contents back to the client in the Response
protected SendTemplateResponse ( string TemplateName, Type ModelType, object Model, string CacheFileName = "" ) : void
TemplateName string The name of the cshtml template file we are parsing
ModelType System.Type The Model type used in the template file
Model object The Model used in the template file
CacheFileName string The name of the Cached file if we are using one. Leave blank for no caching.
return void

Property Details

CacheFile protected property

Our cache file object if we need it. This will be NULL until
protected FileInfo,System.IO CacheFile
return System.IO.FileInfo

Client protected property

Gets the HttpClient object that made this request
protected HttpClient Client
return HttpClient