C# 클래스 FiftyOne.Foundation.Mobile.Detection.WebProvider

A provider with methods designed to be called from within web applications where HttpRequest objects can be used to provide the necessary evidence for detection.
상속: Provider, IDisposable
파일 보기 프로젝트 열기: 51Degrees/dotNET-Device-Detection 1 사용 예제들

공개 메소드들

메소드 설명
CheckDataFileRefresh ( object state ) : void

Checks if the data file has been updated and refreshes if it has.

Download ( ) : LicenceKeyResults

Checks for a new version of the data file if licence keys are available.

Refresh ( ) : void

Forces the application to reload the active provider on the next request.

보호된 메소드들

메소드 설명
Dispose ( bool disposing ) : void

Disposes of the DataSet if one is available.

비공개 메소드들

메소드 설명
CheckDataFileHasRefreshed ( FiftyOne.Foundation.Mobile.Detection.Entities.DataSet dataSet ) : bool

Returns true if a newer data set is now available.

CleanTemporaryFiles ( ) : void

Cleans up any temporary files that remain from previous providers.

Create ( ) : WebProvider

Forces the provider to update current ActiveProvider with new data.

CreateNewTemporaryFile ( FileInfo masterFile ) : FileInfo

Create a new temporary file for use the stream factory.

GetActiveProvider ( ) : WebProvider

A reference to the active provider.

GetContextItems ( HttpRequest request ) : System.Collections.IDictionary

Returns a collection that can be used to persist data across the request. If using .NET 4 or above the HttpRequest context items collection is used. If lower versions then the current context, if it exists is used. If there is no collection available then null is returned and the requesting routine will need to work without the benefit of persisting the detection result across the request.

The implementation varies by .NET version.

GetDataFileDate ( string fileName ) : DateTime?

Creates a stream data set for the file provided and returns the published data of the file. Throws an exception if there's a problem accessing the file.

GetMatch ( HttpRequest request ) : Match

Returns the match results for the request, or creates one if one does not already exist. If the match has already been calculated it is fetched from the context items collection.

GetRequiredHeaders ( HttpRequest request ) : NameValueCollection

Gets the required headers. If the MVC method SetBrowserOverride has been used the User-Agent will be escapted and may contain + characters which need to be removed.

Requests after SetOverrideBrowser are still expected to use the overriden alias. The override useragent is stored in cookie which ASP.NET unpacks automatically, however it is url encoded with pluses instead of spaces. This code transforms the useragent back, but a new NameValueCollection is needed as the original collection cannot be modified.

GetTempFileDataSet ( ) : FiftyOne.Foundation.Mobile.Detection.Entities.DataSet

Returns a data set initialised with a temporary data file. If an existing one is present that can be used then it will be favoured. If a new one is needed then one will be created.

GetTempFileName ( ) : string

Returns a temporary file name for the data file.

OnProcessExit ( object sender, EventArgs e ) : void

The application is being disposed of either due to a recycle event or shutdown. Ensure the active provider is disposed of to release resources.

WebProvider ( FiftyOne.Foundation.Mobile.Detection.Entities.DataSet dataSet ) : System

Constructs a new instance of the provider with the data set supplied.

메소드 상세

CheckDataFileRefresh() 공개 정적인 메소드

Checks if the data file has been updated and refreshes if it has.
public static CheckDataFileRefresh ( object state ) : void
state object Required for timer callback. This parameter is not used.
리턴 void

Dispose() 보호된 메소드

Disposes of the DataSet if one is available.
protected Dispose ( bool disposing ) : void
disposing bool /// True if the calling method is Dispose, false for the finaliser. ///
리턴 void

Download() 공개 정적인 메소드

Checks for a new version of the data file if licence keys are available.
public static Download ( ) : LicenceKeyResults
리턴 LicenceKeyResults

Refresh() 공개 정적인 메소드

Forces the application to reload the active provider on the next request.
public static Refresh ( ) : void
리턴 void