WriteError() 공개 정적인 메소드

public static WriteError ( string message ) : void
message string
리턴 void
예제 #1
0
        protected void Connect(string server, IrcRegistrationInfo registrationInfo)
        {
            // Create new IRC client and connect to given server.
            var client = new StandardIrcClient();

            client.FloodPreventer = new IrcStandardFloodPreventer(4, 2000);
            client.Connected     += IrcClient_Connected;
            client.Disconnected  += IrcClient_Disconnected;
            client.Registered    += IrcClient_Registered;

            // Wait until connection has succeeded or timed out.
            using (var connectedEvent = new ManualResetEventSlim(false))
            {
                client.Connected += (sender2, e2) => connectedEvent.Set();
                client.Connect(server, false, registrationInfo);
                if (!connectedEvent.Wait(10000))
                {
                    client.Dispose();
                    ConsoleUtilities.WriteError("Connection to '{0}' timed out.", server);
                    return;
                }
            }

            // Add new client to collection.
            this.allClients.Add(client);

            Console.Out.WriteLine("Now connected to '{0}'.", server);
        }
예제 #2
0
        public static void Main(string[] args)
        {
            IrcBot bot = null;

            try
            {
                // Write information about program.
                Console.WriteLine(ProgramInfo.AssemblyTitle);
                Console.WriteLine("Version {0}", ProgramInfo.AssemblyVersion);
                Console.WriteLine(ProgramInfo.AssemblyCopyright);
                Console.WriteLine();

                // Create and run bot.
                bot = new MarkovChainTextBot();
                bot.Run();
            }
#if !DEBUG
            catch (Exception ex)
            {
                ConsoleUtilities.WriteError("Fatal error: " + ex.Message);
            }
#endif
            finally
            {
                if (bot != null)
                {
                    bot.Dispose();
                }
            }
        }
예제 #3
0
        private void ReadCommand(string command, IList <string> parameters)
        {
            CommandProcessor processor;

            if (this.commandProcessors.TryGetValue(command, out processor))
            {
                try
                {
                    processor(command, parameters);
                }
                catch (Exception ex)
                {
                    ConsoleUtilities.WriteError("Error: {0}", ex.Message);
                }
            }
            else
            {
                ConsoleUtilities.WriteError("Command '{0}' not recognized.", command);
            }
        }