Ejemplo n.º 1
0
        private void SetupEventLogWatcher()
        {
            try
            {
                List <string> ignored     = new List <string>();
                string        queryString = GetEventLogQueryString(ignored);
                if (queryString != previousQueryString)
                {
                    IPBanLog.Warn("Event viewer query string: {0}", queryString);
                    foreach (string path in ignored)
                    {
                        IPBanLog.Warn("Ignoring event viewer path {0}", path);
                    }

                    watcher?.Dispose();
                    query   = new EventLogQuery(null, PathType.LogName, queryString);
                    watcher = new EventLogWatcher(query);
                    watcher.EventRecordWritten += EventRecordWritten;
                    watcher.Enabled             = true;
                    previousQueryString         = queryString;
                }
            }
            catch (Exception ex)
            {
                IPBanLog.Error("Failed to create event viewer watcher", ex);
            }
        }
Ejemplo n.º 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();
        }