C# Class FiftyOne.Foundation.Mobile.Detection.TrieProvider

Decision trie data structure provider.
Inheritance: IDisposable
Datei anzeigen Open project: 51Degrees/dotNET-Device-Detection Class Usage Examples

Public Properties

Property Type Description
Copyright string

Protected Properties

Property Type Description
_properties byte[]
_propertyHttpHeaders List
_propertyIndex int>.Dictionary
_propertyNames List

Public Methods

Method Description
Dispose ( ) : void

Disposes of all the resources used by the provider.

GetDeviceId ( int deviceIndex ) : string

Returns the device id matching the device index.

GetDeviceIndex ( string userAgent ) : int

Returns the index of the device associated with the given User-Agent. The index returned may vary across different versions of the source data file and should not be stored. The "Id" property will remain unique.

GetDeviceIndexes ( NameValueCollection headers ) : int>.IDictionary

Returns a collection of device indexes for each of the relevent HTTP headers provided. Those headers which are unrelated to device detection are ignored.

GetPropertyValue ( int>.IDictionary deviceIndexes, int propertyIndex ) : string

Returns the value of the property index provided from the device indexes provided. Matches the Http header to the property index.

GetPropertyValue ( int>.IDictionary deviceIndexes, string property ) : string

Returns the property value based on the device indexes provided.

GetPropertyValue ( NameValueCollection headers, string propertyName ) : string

Returns the value of the property for the User-Agent provided.

GetPropertyValue ( int deviceIndex, int propertyIndex ) : string

Returns the value of the property index provided for the device index provided.

GetPropertyValue ( int deviceIndex, string property ) : string

Returns the property value based on the device index provided.

GetPropertyValue ( string userAgent, string propertyName ) : string

Returns the value of the property for the User-Agent provided.

GetUserAgent ( string userAgent ) : string

Returns the User-Agent matched against the one provided.

SizeOfOffsets ( OffsetType offsetType ) : int

The number of bytes each offset takes.

Protected Methods

Method Description
Dispose ( bool disposing ) : void

Disposes of all the resources used by the provider.

GetStringValue ( int offset ) : string

Returns the string at the offset provided.

Private Methods

Method Description
GetChild ( int lookupOffset, byte value ) : byte

Returns the offset in the node for the current character.

GetDeviceIndex ( BinaryReader reader, byte userAgent, int index, int parentDeviceIndex ) : int

Returns the offset in the device byte array to the device matching the useragent provided.

GetDeviceIndex ( BinaryReader reader, byte userAgent, int index, int parentDeviceIndex, StringBuilder matchedUserAgent ) : int

Returns the offset in the device byte array to the device matching the useragent provided.

GetUserAgentByteArray ( string userAgent ) : byte[]

Converts a User-Agent in to a null terminated byte array.

SetNextNodePosition ( BinaryReader reader, byte childIndex, byte numberOfChildren, OffsetType offsetType ) : void

Returns the position in the nodes stream of the next node.

TrieProvider ( string copyright, byte strings, byte properties, byte devices, byte lookupList, long nodesLength, long nodesOffset, Pool pool ) : System

Constructs a new instance of a tree provider.

Method Details

Dispose() public method

Disposes of all the resources used by the provider.
public Dispose ( ) : void
return void

Dispose() protected method

Disposes of all the resources used by the provider.
protected Dispose ( bool disposing ) : void
disposing bool True if the calling method is Dispose, false for the finaliser.
return void

GetDeviceId() public method

Returns the device id matching the device index.
public GetDeviceId ( int deviceIndex ) : string
deviceIndex int Index of the device whose Id should be returned
return string

GetDeviceIndex() public method

Returns the index of the device associated with the given User-Agent. The index returned may vary across different versions of the source data file and should not be stored. The "Id" property will remain unique.
public GetDeviceIndex ( string userAgent ) : int
userAgent string
return int

GetDeviceIndexes() public method

Returns a collection of device indexes for each of the relevent HTTP headers provided. Those headers which are unrelated to device detection are ignored.
public GetDeviceIndexes ( NameValueCollection headers ) : int>.IDictionary
headers System.Collections.Specialized.NameValueCollection Collection of HTTP headers and values
return int>.IDictionary

GetPropertyValue() public method

Returns the value of the property index provided from the device indexes provided. Matches the Http header to the property index.
public GetPropertyValue ( int>.IDictionary deviceIndexes, int propertyIndex ) : string
deviceIndexes int>.IDictionary _indexes for the device.
propertyIndex int Index of the property required.
return string

GetPropertyValue() public method

Returns the property value based on the device indexes provided.
public GetPropertyValue ( int>.IDictionary deviceIndexes, string property ) : string
deviceIndexes int>.IDictionary Http headers and their device index.
property string The name of the property required.
return string

GetPropertyValue() public method

Returns the value of the property for the User-Agent provided.
public GetPropertyValue ( NameValueCollection headers, string propertyName ) : string
headers System.Collections.Specialized.NameValueCollection Collection of HTTP headers and values
propertyName string Name of the property required
return string

GetPropertyValue() public method

Returns the value of the property index provided for the device index provided.
public GetPropertyValue ( int deviceIndex, int propertyIndex ) : string
deviceIndex int Index for the device.
propertyIndex int Index of the property required.
return string

GetPropertyValue() public method

Returns the property value based on the device index provided.
public GetPropertyValue ( int deviceIndex, string property ) : string
deviceIndex int The index of the device whose property should be returned.
property string The name of the property required.
return string

GetPropertyValue() public method

Returns the value of the property for the User-Agent provided.
public GetPropertyValue ( string userAgent, string propertyName ) : string
userAgent string User agent of the request
propertyName string Name of the property required
return string

GetStringValue() protected method

Returns the string at the offset provided.
protected GetStringValue ( int offset ) : string
offset int
return string

GetUserAgent() public method

Returns the User-Agent matched against the one provided.
public GetUserAgent ( string userAgent ) : string
userAgent string
return string

SizeOfOffsets() public static method

The number of bytes each offset takes.
public static SizeOfOffsets ( OffsetType offsetType ) : int
offsetType OffsetType
return int

Property Details

Copyright public_oe property

The copy right notice associated with the data file.
public string Copyright
return string

_properties protected_oe property

Byte array of the available properties.
protected byte[] _properties
return byte[]

_propertyHttpHeaders protected_oe property

List of Http headers for each property index.
protected List _propertyHttpHeaders
return List

_propertyIndex protected_oe property

Dictionary of property names to indexes.
protected Dictionary _propertyIndex
return int>.Dictionary

_propertyNames protected_oe property

List of the available property names.
protected List _propertyNames
return List