C# Class FiftyOne.Foundation.Mobile.Redirection.RequestHistory

Class used to record details of devices that have already accessed the mobile web site to determine if the request is the 1st one or a subsequent one.
Inheritance: IRequestHistory
显示文件 Open project: 51Degrees/dotNET-Device-Detection Class Usage Examples

Public Methods

Method Description
IsPresent ( HttpRequest request ) : bool

Checks to find out if the device associated with the HttpRequest has already been seen by the application. Always returns false if the sync file has not been specified.

Remove ( HttpRequest request ) : void

Removes this device request from the previous devices list.

Set ( HttpRequest request ) : void

Adds this device request to the previous devices list.

Private Methods

Method Description
Add ( object record ) : void

Adds the current request record to the file containing details of all the available requests.

CheckIfServiceRequired ( ) : void

If the last time the devices file was serviced to remove old entries is older than 1 minute start a thread to service the devices file and remove old entries. If the redirect timeout is 0 indicating infinite then nothing should be purged.

OpenSyncFilePath ( FileMode mode, FileAccess access, FileShare share ) : FileStream

Opens the file for read and if an exception is thrown will return null rather than the exception.

ProcessSyncFile ( ) : void
ReadRecords ( FileStream stream, long purgeDate ) : byte[]

Read the records that should be retained in the sync file.

RefreshSyncFile ( ) : void

Checks to determine if new records need to be processed and if so loads them into memory.

RequestHistory ( ) : System
ServiceRequestHistory ( object purgeDate ) : void

Removes entries from the memory version and sync file that are older than the purgeDate specified.

Method Details

IsPresent() public method

Checks to find out if the device associated with the HttpRequest has already been seen by the application. Always returns false if the sync file has not been specified.
public IsPresent ( HttpRequest request ) : bool
request System.Web.HttpRequest HttpRequest to be checked.
return bool

Remove() public method

Removes this device request from the previous devices list.
public Remove ( HttpRequest request ) : void
request System.Web.HttpRequest HttpRequest of the device.
return void

Set() public method

Adds this device request to the previous devices list.
public Set ( HttpRequest request ) : void
request System.Web.HttpRequest HttpRequest of the device.
return void