Run() public méthode

public Run ( ChatServer chatServer ) : void
chatServer ChatServer ///
Résultat void
        /// <summary>
        /// </summary>
        /// <param name="args">
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// </exception>
        private static void CommandLoop(string[] args)
        {
            // Hard coded, because we only use TCP connections
            const bool TCPEnable = true;
            const bool UDPEnable = false;

            bool processedargs = false;

            string consoleCommand;

            while (true)
            {
                if (!processedargs)
                {
                    if (args.Length == 1)
                    {
                        if (args[0].ToLower() == "/autostart")
                        {
                            Console.WriteLine(locales.ServerConsoleAutostart);
                            chatServer.Start(TCPEnable, UDPEnable);
                        }

                        processedargs = true;
                    }
                }

                Console.Write(Environment.NewLine + locales.ServerConsoleCommand + ">>");

                consoleCommand = Console.ReadLine();

                while (consoleCommand.IndexOf("  ") > -1)
                {
                    consoleCommand = consoleCommand.Replace("  ", " ");
                }

                consoleCommand = consoleCommand.Trim();
                switch (consoleCommand.ToLower())
                {
                    case "start":
                        if (chatServer.IsRunning)
                        {
                            Colouring.Push(ConsoleColor.Red);
                            Console.WriteLine(locales.ServerConsoleServerIsRunning);
                            Colouring.Pop();
                            break;
                        }

                        if (Config.Instance.CurrentConfig.UseIRCRelay == true)
                        {
                            Console.WriteLine("Starting RelayBot. Version {0}", ProgramInfo.AssemblyVersion);

                            // Call the IRC Bot stuff here..
                            RelayBot ircbot = new RelayBot();

                            ircbot.Run(chatServer);
                            chatServer.Start(TCPEnable, UDPEnable);
                            break;
                        }

                        chatServer.Start(TCPEnable, UDPEnable);
                        break;
                    case "stop":
                        if (!chatServer.IsRunning)
                        {
                            Colouring.Push(ConsoleColor.Red);
                            Console.WriteLine(locales.ServerConsoleServerIsNotRunning);
                            Colouring.Pop();
                            break;
                        }

                        chatServer.Stop();
                        break;
                    case "exit":
                        return;
                    case "running":
                        if (chatServer.IsRunning)
                        {
                            Console.WriteLine(locales.ServerConsoleServerIsRunning);
                            break;
                        }

                        Console.WriteLine(locales.ServerConsoleServerIsNotRunning);
                        break;

                    case "help":
                        ct.TextRead("chatcmdhelp.txt");
                        break;
                    case "help start":
                        Console.WriteLine(locales.ServerConsoleCommandHelp_start);
                        break;
                    case "help exit":
                        Console.WriteLine(locales.ServerConsoleCommandHelp_stop);
                        break;
                    case "help running":
                        ct.TextRead("chathelpcmdrunning.txt");
                        break;
                    case "debugnetwork":
                        DebugNetwork = !DebugNetwork;
                        Colouring.Push(ConsoleColor.Green);
                        if (DebugNetwork)
                        {
                            Console.WriteLine("Debugging network functions enabled");
                        }
                        else
                        {
                            Console.WriteLine("Debugging network functions disabled");
                        }

                        Colouring.Pop();
                        break;
                }
            }
        }
        private static void StartRelayBot()
        {
            if (Config.Instance.CurrentConfig.UseIRCRelay == true)
            {
                Console.WriteLine("Starting RelayBot. Version {0}", ProgramInfo.AssemblyVersion);

                // Call the IRC Bot stuff here..
                RelayBot ircbot = new RelayBot();

                ircbot.Run(chatServer);
            }
        }