@@ -59,6 +59,9 @@ public void Add(string ip, string netmask)
5959 if ( String . IsNullOrEmpty ( ip ) ) throw new ArgumentNullException ( nameof ( ip ) ) ;
6060 if ( String . IsNullOrEmpty ( netmask ) ) throw new ArgumentNullException ( nameof ( netmask ) ) ;
6161
62+ ip = IPAddress . Parse ( ip ) . ToString ( ) ;
63+ netmask = IPAddress . Parse ( netmask ) . ToString ( ) ;
64+
6265 string baseAddress = GetBaseIpAddress ( ip , netmask ) ;
6366 IPAddress parsed = IPAddress . Parse ( baseAddress ) ;
6467 if ( Exists ( baseAddress , netmask ) ) return ;
@@ -83,6 +86,9 @@ public bool Exists(string ip, string netmask)
8386 if ( String . IsNullOrEmpty ( ip ) ) throw new ArgumentNullException ( nameof ( ip ) ) ;
8487 if ( String . IsNullOrEmpty ( netmask ) ) throw new ArgumentNullException ( nameof ( netmask ) ) ;
8588
89+ ip = IPAddress . Parse ( ip ) . ToString ( ) ;
90+ netmask = IPAddress . Parse ( netmask ) . ToString ( ) ;
91+
8692 lock ( _CacheLock )
8793 {
8894 if ( _Cache . ContainsKey ( ip ) )
@@ -116,6 +122,8 @@ public void Remove(string ip)
116122 {
117123 if ( String . IsNullOrEmpty ( ip ) ) throw new ArgumentNullException ( nameof ( ip ) ) ;
118124
125+ ip = IPAddress . Parse ( ip ) . ToString ( ) ;
126+
119127 lock ( _CacheLock )
120128 {
121129 _Cache = _Cache . Where ( d => ! d . Key . Equals ( ip ) ) . ToDictionary ( d => d . Key , d => d . Value ) ;
@@ -140,6 +148,8 @@ public bool MatchExists(string ip)
140148 {
141149 if ( String . IsNullOrEmpty ( ip ) ) throw new ArgumentNullException ( nameof ( ip ) ) ;
142150
151+ ip = IPAddress . Parse ( ip ) . ToString ( ) ;
152+
143153 IPAddress parsed = IPAddress . Parse ( ip ) ;
144154
145155 lock ( _CacheLock )
0 commit comments