Esempio n. 1
0
        static void Main(string[] args)
        {
            PerformanceCounters.CreateSentinelCostPerformanceCounters(categoryName, categoryHelp);

            //_logName = args[0];
            //Enum.TryParse(args[1], out dataType);

            ConfigHelperObject = new ConfigHelper();
            bool resetListener = true;

            ///  Run the console app
            ConsoleKeyInfo cki;

            Console.WriteLine("Press any combination of CTL.");
            Console.WriteLine("Press the Escape (Esc) key to quit: \n");
            Task runTask = null;

            cancellationTokenSource = new CancellationTokenSource();
            cancellationToken       = cancellationTokenSource.Token;

            do
            {
                // Run importing in background
                if (runTask == null)
                {
                    logName         = GetEventLogSelection();
                    dataType        = GetDataTypeSelection();
                    CompressionType = GetCompressionSelection();
                    Console.WriteLine("Press any CTL+B to make a different selection.");
                    runTask = Task.Run(() => Subscribe(logName), cancellationToken);
                }

                cki = Console.ReadKey();

                if ((cki.Modifiers & ConsoleModifiers.Control) != 0 && cki.Key == ConsoleKey.B)
                {
                    Console.Write("CTL+");
                    Console.WriteLine($"Stop reading {logName}  task...");

                    cancellationTokenSource.Cancel();
                    runTask = null;
                }
            }while (cki.Key != ConsoleKey.Escape);
        }
Esempio n. 2
0
        public static void Main(string[] args)
        {
            PerformanceCounters.CreateSentinelCostPerformanceCounters(categoryName, categoryHelp, true);

            CreateHostBuilder(args).Build().Run();
        }