Пример #1
0
        private static void Main(string[] args)
        {
            Console.Title = "Sentro";
            Console.WriteLine(Sento);
            var needReboot = ConfigureRegistry();

            if (needReboot)
            {
                Console.WriteLine("modified registry file, please reboot.");
                return;
            }
            using (new SingleGlobalInstance(1000))
            {
                _handler = ConsoleEventCallback;       //used to detect terminiation
                SetConsoleCtrlHandler(_handler, true); //using mutix and callbacks
                Console.CancelKeyPress += delegate { CleanUpSentro(); };
                string command;
                do
                {
                    command = ReadLineAsync().Result;
                    if (command.IsNullOrEmpty())
                    {
                        continue;
                    }

                    var function = command.Split(' ')[0].ToLower();
                    switch (function)
                    {
                    case "arp":
                        new Thread(() => InputHandler.Arp(command)).Start();
                        break;

                    case "traffic":
                        InputHandler.Traffic(command);
                        break;

                    case "exit":
                        break;
                    }
                } while (command != null && !command.Equals("exit"));

                CleanUpSentro();
            }
        }