예제 #1
0
 /// <summary>
 /// Clears the banned hosts list and initializes it with the latest version.
 /// </summary>
 private void InitializeBannedHosts()
 {
     try
     {
         ICrawlWaveServer server = proxy;
         try
         {
             server.IsAlive();
         }
         catch
         {
             if (globals.Settings.LogLevel <= CWLogLevel.LogWarning)
             {
                 globals.FileLog.LogWarning("HostBanFilter failed to connect to the server.");
             }
             return;
         }
         DataSet             ds = new DataSet();
         SerializedException sx = server.SendBannedHosts(globals.Client_Info, out ds);
         if (sx != null)
         {
             if (globals.Settings.LogLevel <= CWLogLevel.LogWarning)
             {
                 globals.FileLog.LogWarning("HostBanFilter failed to download a list of banned hosts.");
             }
             return;
         }
         else
         {
             if (ds.Tables[0].Rows.Count > 0)
             {
                 lock (hostTable.SyncRoot)
                 {
                     hostTable.Clear();
                     foreach (DataRow dr in ds.Tables[0].Rows)
                     {
                         Guid g = (Guid)(dr[0]);
                         try
                         {
                             hostTable.Add(g.ToByteArray(), null);
                         }
                         catch
                         {
                             continue;
                         }
                     }
                 }
             }
         }
         ds.Dispose();
     }
     catch
     {}
 }