fCraft.IPBanList.Remove C# (CSharp) Method

Remove() public static method

Removes a given IP address from the ban list (if present).
public static Remove ( [ address, bool raiseEvents ) : bool
address [ Address to unban.
raiseEvents bool Whether to raise RemovingIPBan and RemovedIPBan events.
return bool
        public static bool Remove( [NotNull] IPAddress address, bool raiseEvents )
        {
            if ( address == null )
                throw new ArgumentNullException( "address" );
            lock ( BanListLock ) {
                if ( !Bans.ContainsKey( address.ToString() ) ) {
                    return false;
                }
                IPBanInfo info = Bans[address.ToString()];
                if ( raiseEvents ) {
                    if ( RaiseRemovingIPBanEvent( info ) )
                        return false;
                }
                if ( Bans.Remove( address.ToString() ) ) {
                    if ( raiseEvents )
                        RaiseRemovedIPBanEvent( info );
                    Save();
                    return true;
                } else {
                    return false;
                }
            }
        }