示例#1
0
 public FrmMain()
 {
     InitializeComponent();
      syslogListener = new SyslogListener(IPAddress.Any);
      dsMain = new easysyslogmonDataSet1();
      taRules = new EasySyslogMonitor.easysyslogmonDataSet1TableAdapters.rulesTableAdapter();
      taRules.Fill(dsMain.rules);
      parser = new SyslogParser(dsMain.rules);
      memoryBuffer = new MemoryBuffer(TimeSpan.FromSeconds(30), parser);
      syslogListener.MessageReceived += new MessageReceivedEventHandler(syslogListener_MessageReceived);
 }
示例#2
0
 public SyslogParser(easysyslogmonDataSet1.rulesDataTable tRules)
 {
     rules = tRules;
      templates = new Dictionary<string, string>();
      foreach (easysyslogmonDataSet1.rulesRow rule in rules) {
     try {
        string tempTemplateString = System.IO.File.ReadAllText(rule.template);
        templates.Add(rule.template, tempTemplateString);
     } catch (Exception ex) {
        EventLogger.WriteEventToWindowsLog("Cannot find template " + rule.template + ".\n\n[" + ex.Message + "]", System.Diagnostics.EventLogEntryType.Error);
     }
      }
 }