Beispiel #1
0
        static void ProcessCommand(string msg)
        {
            if (msg.Length == 0 && msg.Contains(' ') == false)
            {
                return;
            }

            string[] settings = msg.Split(' ');

            switch (msg.Substring(0, 1).ToLower())
            {
            case "c":
                if (settings.Length >= 2)
                {
                    string serverident = settings[1].Split('.')[1];
                    int    i           = 1;
                    while (ircbot.ContainsKey(serverident))
                    {
                        serverident = serverident + i;
                        i++;
                    }
                    Nishbot irc = new Nishbot();



                    ircbot.Add(serverident, irc);
                    Console.WriteLine("Connecting to server " + settings[1] + " as '" + serverident + "'");
                }
                break;

            case "d":
                if (settings.Length >= 2)
                {
                    if (ircbot.ContainsKey(settings[1]))
                    {
                        ircbot.Remove(settings[1]);
                    }
                    else
                    {
                        Console.WriteLine("Connection not found");
                    }
                }
                break;

            case "j":
                if (settings.Length >= 3)
                {
                    if (ircbot.ContainsKey(settings[1]))
                    {
                    }
                    else
                    {
                        Console.WriteLine("Connection not found");
                    }
                }
                break;

            case "l":
                if (settings.Length >= 3)
                {
                    if (ircbot.ContainsKey(settings[1]))
                    {
                    }
                    else
                    {
                        Console.WriteLine("Connection not found");
                    }
                }
                break;

            default:
                Console.WriteLine("Invalid chat command");
                break;
            }
        }
Beispiel #2
0
        static void ProcessCommand(string msg)
        {
            if (msg.Length == 0 && msg.Contains(' ') == false)
                return;

            string[] settings = msg.Split(' ');

            switch (msg.Substring(0, 1).ToLower())
            {
                case "c":
                    if (settings.Length >= 2)
                    {
                        string serverident = settings[1].Split('.')[1];
                        int i = 1;
                        while(ircbot.ContainsKey(serverident))
                        {
                            serverident = serverident + i;
                            i++;
                        }
                        Nishbot irc = new Nishbot();



                        ircbot.Add(serverident, irc);
                        Console.WriteLine("Connecting to server " + settings[1] + " as '" + serverident + "'");
                    }
                    break;
                case "d":
                    if (settings.Length >= 2)
                    {
                        if (ircbot.ContainsKey(settings[1]))
                        {
                            ircbot.Remove(settings[1]);
                        }
                        else
                        {
                            Console.WriteLine("Connection not found");
                        }
                    }
                    break;
                case "j":
                    if (settings.Length >= 3)
                    {
                        if (ircbot.ContainsKey(settings[1]))
                        {

                        }
                        else
                        {
                            Console.WriteLine("Connection not found");
                        }

                    }
                    break;
                case "l":
                    if (settings.Length >= 3)
                    {
                        if (ircbot.ContainsKey(settings[1]))
                        {

                        }
                        else
                        {
                            Console.WriteLine("Connection not found");
                        }
                    }
                    break;
                default:
                    Console.WriteLine("Invalid chat command");
                    break;
            }
        }