private static void Main(string[] args) { options = new Options(); var argumentParser = new Parser(); if (!argumentParser.ParseArguments(args, options)) { ShowErrorAndExit("invalid command line arguments."); } if (options.OutputFilter != null) { filter = new Regex(options.OutputFilter, RegexOptions.IgnoreCase); } if (options.ProviderFilter != null) { Guid.TryParse(options.ProviderFilter, out providerIDFilter); } if (options.OutputFile != null) { Console.WriteLine("Sending all output to {0}", options.OutputFile); Console.SetOut(new StreamWriter(options.OutputFile, false)); } if (options.Realtime) { SetupRealtimeProcessor(); } else { SetupFileProcessor(); } processor.ProcessEventTypes = EventTypes.All; // Make sure we stop processing on ctrl+c. Console.CancelKeyPress += (sender, eventArgs) => { processor.StopProcessing(); eventArgs.Cancel = true; // prevent process termination }; if (options.StatisticsOutput) { var statistics = new EventStatistics(processor); processor.Process(); statistics.DumpStatistics(); } else { processor.SessionStart += HandleSessionStart; processor.SessionEnd += HandleSessionEnd; processor.EventProcessed += HandleEvent; processor.Process(); if (options.Verbose || options.Summary) { Console.WriteLine("Total events: {0}, lost: {1}, unreadable: {2}", processor.Count, processor.EventsLost, processor.UnreadableEvents); } } processor.Dispose(); Console.Out.Flush(); }