C# Class MaxMind.GeoIPCountry

Inheritance: IDisposable
Afficher le fichier Open project: NyxStudios/TShock Class Usage Examples

Méthodes publiques

Méthode Description
Dispose ( ) : void
GeoIPCountry ( Stream datafile ) : System

Initialises a new instance of this class.

The stream is not closed when this class is disposed. Be sure to clean up afterwards!

GeoIPCountry ( string filename ) : System

Initialises a new instance of this class, using an on-disk database.

The file will be closed when this class is disposed.

GetCountryCode ( IPAddress ip ) : string

Retrieves a two-letter code, defined by MaxMind, which details the country the specified IP address is located.

The IP address must be IPv4.

GetCountryNameByCode ( string countrycode ) : string

Gets the English name of a country, by a country code.

TryGetCountryCode ( IPAddress ip ) : string

Retrieves a two-letter code, defined by MaxMind, which details the country the specified IP address is located. Does not throw exceptions on failure.

Private Methods

Méthode Description
AddressToLong ( IPAddress ip ) : long
FindCountryCode ( long offset, long ipnum, int depth ) : long
FindIndex ( IPAddress ip ) : int

Method Details

Dispose() public méthode

public Dispose ( ) : void
Résultat void

GeoIPCountry() public méthode

Initialises a new instance of this class.
The stream is not closed when this class is disposed. Be sure to clean up afterwards!
public GeoIPCountry ( Stream datafile ) : System
datafile Stream An already open stream pointing to the contents of a GeoIP.dat file.
Résultat System

GeoIPCountry() public méthode

Initialises a new instance of this class, using an on-disk database.
The file will be closed when this class is disposed.
public GeoIPCountry ( string filename ) : System
filename string Path to database file.
Résultat System

GetCountryCode() public méthode

Retrieves a two-letter code, defined by MaxMind, which details the country the specified IP address is located.
The IP address must be IPv4.
public GetCountryCode ( IPAddress ip ) : string
ip System.Net.IPAddress IP address to query.
Résultat string

GetCountryNameByCode() public static méthode

Gets the English name of a country, by a country code.
public static GetCountryNameByCode ( string countrycode ) : string
countrycode string Country code to look up, returned by GetCountryCode or TryGetCountryCode.
Résultat string

TryGetCountryCode() public méthode

Retrieves a two-letter code, defined by MaxMind, which details the country the specified IP address is located. Does not throw exceptions on failure.
public TryGetCountryCode ( IPAddress ip ) : string
ip System.Net.IPAddress IP address to query.
Résultat string