C# Класс BF2Statistics.Redirector

Provides Methods to apply and remove Gamespy Redirects
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
Bf2StatsHost string
DnsCacheReport BF2Statistics.Gamespy.Redirector.GamespyDnsReport
GamespyHosts string[]
GamespyServerAddress System.Net.IPAddress
StatsServerAddress System.Net.IPAddress

Открытые методы

Метод Описание
ApplyRedirectsAsync ( IProgress Progress ) : Task

Applies the specified IP address redirects for the chosen redirect method

Initialize ( ) : Task

The main entry point for the redirector

RebuildDNSCache ( CancellationToken CancelToken ) : void

Preforms the pings required to fill the dns cache. The reason we ping, is because once the HOSTS file is locked, any request made to a url (when the DNS cache is empty), will skip the hosts file, because it cant be read. If we ping first, then the DNS cache fills up with the IP addresses in the hosts file.

RemoveRedirects ( ) : void

Remove the redirects currently active

SetRedirectMode ( RedirectMode Mode ) : bool

Sets a new Redirect method. Using this method removes any previous redirects

VerifyDNSCache ( IProgress Progress = null ) : bool

Queries the DNS Cache for the Gamespy hosts, and verifies that the IP addresses in the DNS Cache match that of the desired redirect IP

Приватные методы

Метод Описание
DnsFlushResolverCache ( ) : UInt32
DnsFlushResolverCacheEntry ( string hostName ) : int
RemoveRedirects ( HostsFile HostFile ) : void

Removes all gamespy related redirects in the specified hosts file container

Описание методов

ApplyRedirectsAsync() публичный статический Метод

Applies the specified IP address redirects for the chosen redirect method
public static ApplyRedirectsAsync ( IProgress Progress ) : Task
Progress IProgress
Результат Task

Initialize() публичный статический Метод

The main entry point for the redirector
public static Initialize ( ) : Task
Результат Task

RebuildDNSCache() публичный статический Метод

Preforms the pings required to fill the dns cache. The reason we ping, is because once the HOSTS file is locked, any request made to a url (when the DNS cache is empty), will skip the hosts file, because it cant be read. If we ping first, then the DNS cache fills up with the IP addresses in the hosts file.
public static RebuildDNSCache ( CancellationToken CancelToken ) : void
CancelToken System.Threading.CancellationToken
Результат void

RemoveRedirects() публичный статический Метод

Remove the redirects currently active
public static RemoveRedirects ( ) : void
Результат void

SetRedirectMode() публичный статический Метод

Sets a new Redirect method. Using this method removes any previous redirects
public static SetRedirectMode ( RedirectMode Mode ) : bool
Mode RedirectMode The new redirect mode
Результат bool

VerifyDNSCache() публичный статический Метод

Queries the DNS Cache for the Gamespy hosts, and verifies that the IP addresses in the DNS Cache match that of the desired redirect IP
public static VerifyDNSCache ( IProgress Progress = null ) : bool
Progress IProgress
Результат bool

Описание свойств

Bf2StatsHost публичное статическое свойство

Returns the hostname for the battlefield 2 stats server
public static string Bf2StatsHost
Результат string

DnsCacheReport публичное статическое свойство

Gets the last DnsCacheReport object generated by the VerifyDNSCache method
public static GamespyDnsReport,BF2Statistics.Gamespy.Redirector DnsCacheReport
Результат BF2Statistics.Gamespy.Redirector.GamespyDnsReport

GamespyHosts публичное статическое свойство

Returns an array of all gamespy related service hostnames
public static string[] GamespyHosts
Результат string[]

GamespyServerAddress публичное статическое свойство

Gets or Sets the Gamespy Server address. If redirects are enabled, changes will not take effect until they are removed.
public static IPAddress,System.Net GamespyServerAddress
Результат System.Net.IPAddress

StatsServerAddress публичное статическое свойство

Gets or Sets the Stats Server address. If redirects are enabled, changes will not take effect until they are removed.
public static IPAddress,System.Net StatsServerAddress
Результат System.Net.IPAddress