BF2Statistics.HostsFile.RemoveAll C# (CSharp) Method

RemoveAll() public method

Removes all of the specified domain names from the hosts file
public RemoveAll ( IEnumerable Domains ) : bool
Domains IEnumerable
return bool
        public bool RemoveAll(IEnumerable<string> Domains)
        {
            bool Return = false;
            foreach (string host in Domains)
            {
                if (Entries.Remove(host))
                    Return = true;
            }

            return Return;
        }

Usage Example

        /// <summary>
        /// Removes all gamespy related redirects in the specified hosts file container
        /// </summary>
        /// <param name="HostFile"></param>
        private static void RemoveRedirects(HostsFile HostFile)
        {
            // Remove Gamespy Addresses. Use a Bitwise OR here to execute both methods
            if (HostFile.Remove(Bf2StatsHost) | HostFile.RemoveAll(GamespyHosts))
            {
                // Save Changes
                HostFile.Save();

                // Flush the Cache of the gamespy hosts
                foreach (string host in GamespyHosts)
                {
                    DnsFlushResolverCacheEntry(host);
                }

                // Flush stats server
                DnsFlushResolverCacheEntry(Bf2StatsHost);
            }
        }
All Usage Examples Of BF2Statistics.HostsFile::RemoveAll