Ejemplo n.º 1
0
 /// <summary>
 /// Dispose of an IPBanService created with CreateAndStartIPBanTestService
 /// </summary>
 /// <param name="service">Service to dispose</param>
 public static void DisposeIPBanTestService(IPBanService service)
 {
     if (service != null)
     {
         service.Firewall.Truncate();
         service.RunCycle().Sync();
         service.Dispose();
         IPBanService.UtcNow = default;
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Dispose of an IPBanService created with CreateAndStartIPBanTestService
 /// </summary>
 /// <param name="service">Service to dispose</param>
 public static void DisposeIPBanTestService(IPBanService service)
 {
     if (service != null)
     {
         if (File.Exists(Path.Combine(AppContext.BaseDirectory, "nlog.config")))
         {
             File.Delete(Path.Combine(AppContext.BaseDirectory, "nlog.config"));
         }
         service.Firewall.Truncate();
         service.RunCycleAsync().Sync();
         service.IPBanDelegate = null;
         service.Dispose();
         NLog.Time.TimeSource.Current = new NLog.Time.AccurateUtcTimeSource();
         IPBanService.UtcNow          = default;
     }
 }