public static void AddBlacklist(IBlackList blackList, string blacklist) { if (blacklists.ContainsKey(blackList.GetType().Name) == false) { try { blackList.Initialize(blacklist); blackList.UpdateBlacklist(); blacklists.Add(blackList.GetType().Name, blackList); } catch (Exception ex) { Console.Write(ex.ToString()); } } else { // update the blacklist IBlackList referrerBlacklist = blacklists[blackList.GetType().Name] as IBlackList; try { referrerBlacklist.Initialize(blacklist); BlacklistUpdateState updateState = referrerBlacklist.UpdateBlacklist(); if (updateState == BlacklistUpdateState.Failed) { new EventDataItem(EventCodes.Error, blackList.ToString() + " could not be updated: ", ""); } } catch (Exception ex) { Console.Write(ex.ToString()); } } }
public static void AddBlacklist(IBlackList blackList, string path) { if (blacklists.ContainsKey(blackList.GetType().Name) == false) { bool success = InitializeBlacklist(blackList, path); if (success) blacklists.Add(blackList.GetType().Name, blackList); } else { IBlackList referrerBlacklist = blacklists[blackList.GetType().Name]; InitializeBlacklist(referrerBlacklist, path); } }
public static void AddBlacklist(IBlackList blackList, string path) { if (blacklists.ContainsKey(blackList.GetType().Name) == false) { bool success = InitializeBlacklist(blackList, path); if (success) { blacklists.Add(blackList.GetType().Name, blackList); } } else { IBlackList referrerBlacklist = blacklists[blackList.GetType().Name]; InitializeBlacklist(referrerBlacklist, path); } }