/// <summary> /// Reload the blacklist from the database. /// </summary> private void RefreshBlacklist() { List <BlacklistEntry> LocalBlacklist = new List <BlacklistEntry>(); string Query = String.Format( @"SELECT `blacklist_entry_type`, `blacklist_entry_match` FROM `blacklist_entries` WHERE `product_id` = {0}", MasterServer.ProductID); using (MySqlDataReader Reader = MasterServer.ExecuteQuery(Query)) { while (Reader.Read()) { BlacklistEntry.BlacklistType EntryType = (BlacklistEntry.BlacklistType)Reader.GetUInt32(0); string EntryMatch = Reader.GetString(1); BlacklistEntry Entry = new BlacklistEntry(EntryMatch, EntryType); LocalBlacklist.Add(Entry); } } // // Exchange the current blacklist with the new version. If a // thread was using the old blacklist, the old object will remain // valid (it is immutable once published) until all references are // expunged and garbage collection collects the object. // Thread.MemoryBarrier(); Blacklist = LocalBlacklist; }
/// <summary> /// Reload the blacklist from the database. /// </summary> private void RefreshBlacklist() { List<BlacklistEntry> LocalBlacklist = new List<BlacklistEntry>(); string Query = String.Format( @"SELECT `blacklist_entry_type`, `blacklist_entry_match` FROM `blacklist_entries` WHERE `product_id` = {0}", MasterServer.ProductID); using (MySqlDataReader Reader = MasterServer.ExecuteQuery(Query)) { while (Reader.Read()) { BlacklistEntry.BlacklistType EntryType = (BlacklistEntry.BlacklistType)Reader.GetUInt32(0); string EntryMatch = Reader.GetString(1); BlacklistEntry Entry = new BlacklistEntry(EntryMatch, EntryType); LocalBlacklist.Add(Entry); } } // // Exchange the current blacklist with the new version. If a // thread was using the old blacklist, the old object will remain // valid (it is immutable once published) until all references are // expunged and garbage collection collects the object. // Thread.MemoryBarrier(); Blacklist = LocalBlacklist; }