Пример #1
0
 private static void CreateService()
 {
     if (service != null)
     {
         service.Dispose();
     }
     service = IPBanService.CreateService <IPBanService>();
     service.Start();
 }
Пример #2
0
        public static void MacMain(string[] args)
        {
            IPBanService service = IPBanService.CreateService();

            service.Start();
            IPBanLog.Warn("IPBan Mac Service Running, Press Ctrl-C to quit.");
            ManualResetEvent wait = new ManualResetEvent(false);

            wait.WaitOne();
        }
Пример #3
0
 private static void CreateService(bool testing)
 {
     if (service != null)
     {
         service.Dispose();
     }
     service = IPBanService.CreateService(testing);
     service.Start();
     eventViewer = new IPBanWindowsEventViewer(service);
 }
Пример #4
0
        public static void LinuxMain(string[] args)
        {
            bool         testing = false; // TODO: Change to true if we are running Linux tests
            IPBanService service = IPBanService.CreateService(testing);

            service.Start();
            IPBanLog.Write(LogLevel.Warning, "IPBan Linux Service Running, Press Ctrl-C to quit.");
            ManualResetEvent wait = new ManualResetEvent(false);

            wait.WaitOne();
        }
Пример #5
0
        public static int RunConsole(string[] args)
        {
            IPBanService service = CreateService();

            if (args.Contains("test", StringComparer.OrdinalIgnoreCase))
            {
                service.RunTestsOnStart = true;
            }
            service.Start();
            Console.WriteLine("Press ENTER to quit");
            Console.ReadLine();
            service.Stop();
            return(0);
        }
Пример #6
0
        private static void CreateService(bool test)
        {
            if (service != null)
            {
                service.Dispose();
            }
            service = IPBanService.CreateService();
            if (test)
            {
                // TODO: Move to unit test project
                service.MultiThreaded     = false;
                service.ManualCycle       = true;
                service.SubmitIPAddresses = false;
                service.DB.Truncate(true);
            }
            service.Start();

            // attach Windows event viewer to the service
            eventViewer = new IPBanWindowsEventViewer(service);
        }
Пример #7
0
 protected override void OnStart(string[] args)
 {
     base.OnStart(args);
     service = CreateService();
     service.Start();
 }