C# Class BF2Statistics.HostsFile

Datei anzeigen Open project: BF2Statistics/ControlCenter Class Usage Examples

Public Properties

Property Type Description
OrigContents List

Protected Properties

Property Type Description
Entries IPAddress>.Dictionary
HostFile System.IO.FileInfo
Security System.Security.AccessControl.FileSecurity
WorldSid System.Security.Principal.SecurityIdentifier

Public Methods

Method Description
Get ( string Domain ) : IPAddress

Returns the IP address for the provided domain name

GetLines ( ) : IPAddress>.Dictionary

Returns a list of all current hosts file lines

HasAnyEntry ( IEnumerable Domains ) : bool

Returns whether the hostsfile contains any of the domain names provided

HasEntry ( string Domain ) : bool

Returns whether the hostsfile contains the specified domain name

HostsFile ( ) : System
Remove ( string Domain ) : bool

Removes a domain name from the hosts file

RemoveAll ( IEnumerable Domains ) : bool

Removes all of the specified domain names from the hosts file

Save ( ) : void

Saves all currently set domains and IPs to the hosts file

Set ( string Domain, IPAddress Ip ) : void

Sets a domain name with an IP in the hosts file

Protected Methods

Method Description
ParseEntries ( ) : void

Method Details

Get() public method

Returns the IP address for the provided domain name
public Get ( string Domain ) : IPAddress
Domain string The domain name
return System.Net.IPAddress

GetLines() public method

Returns a list of all current hosts file lines
public GetLines ( ) : IPAddress>.Dictionary
return IPAddress>.Dictionary

HasAnyEntry() public method

Returns whether the hostsfile contains any of the domain names provided
public HasAnyEntry ( IEnumerable Domains ) : bool
Domains IEnumerable An array of domain names to check for
return bool

HasEntry() public method

Returns whether the hostsfile contains the specified domain name
public HasEntry ( string Domain ) : bool
Domain string The domain name
return bool

HostsFile() public method

public HostsFile ( ) : System
return System

ParseEntries() protected method

protected ParseEntries ( ) : void
return void

Remove() public method

Removes a domain name from the hosts file
public Remove ( string Domain ) : bool
Domain string The domain name
return bool

RemoveAll() public method

Removes all of the specified domain names from the hosts file
public RemoveAll ( IEnumerable Domains ) : bool
Domains IEnumerable
return bool

Save() public method

Saves all currently set domains and IPs to the hosts file
public Save ( ) : void
return void

Set() public method

Sets a domain name with an IP in the hosts file
public Set ( string Domain, IPAddress Ip ) : void
Domain string The domain name
Ip System.Net.IPAddress The IP address
return void

Property Details

Entries protected_oe property

A list of "hostname" => "IPAddress" in the hosts file.
protected Dictionary Entries
return IPAddress>.Dictionary

HostFile protected_oe property

The fileinfo object for the HostsFile
protected FileInfo,System.IO HostFile
return System.IO.FileInfo

OrigContents public_oe property

Each line of the hosts file stored in a list. ALl redirects are removed from this list before being stored here.
public List OrigContents
return List

Security protected_oe property

Hosts file security object
protected FileSecurity,System.Security.AccessControl Security
return System.Security.AccessControl.FileSecurity

WorldSid protected_oe static_oe property

The windows permission that represents everyone
protected static SecurityIdentifier,System.Security.Principal WorldSid
return System.Security.Principal.SecurityIdentifier