Bot.Modules.moderation.del_auto C# (CSharp) Method

del_auto() private static method

private static del_auto ( string nick, string channel, string hostname, string type, bot ircbot ) : void
nick string
channel string
hostname string
type string
ircbot bot
return void
        private static void del_auto(string nick, string channel, string hostname, string type, bot ircbot)
        {
            string list_file = ircbot.cur_dir + Path.DirectorySeparatorChar + "modules" + Path.DirectorySeparatorChar + "auto_kb" + Path.DirectorySeparatorChar + ircbot.Conf.Server_Name + "_list.txt";
            bool found_nick = false;
            if (File.Exists(list_file))
            {
                string[] old_file = System.IO.File.ReadAllLines(list_file);
                List<string> new_file = new List<string>();
                foreach (string file_line in old_file)
                {
                    char[] charSeparator = new char[] { '*' };
                    string[] auto_nick = file_line.Split(charSeparator, 5);
                    if (nick.Equals(auto_nick[0], StringComparison.InvariantCultureIgnoreCase) && hostname.Equals(auto_nick[1]) && channel.Equals(auto_nick[2]) && type.Equals(auto_nick[3]))
                    {
                        found_nick = true;
                    }
                    else
                    {
                        new_file.Add(file_line);
                    }
                }
                if (found_nick == false)
                {
                    ircbot.sendData("PRIVMSG", channel + " :" + nick + " is not in the a" + type + " list.");
                }
                else
                {
                    System.IO.File.WriteAllLines(@list_file, new_file);
                    string ban = "*!*@" + hostname;
                    if (String.IsNullOrEmpty(hostname))
                    {
                        ban = nick + "!*@*";
                    }
                    if (type.Equals("b"))
                    {
                        ircbot.sendData("MODE", channel + " -b " + ban);
                    }
                    else if (type.Equals("kb"))
                    {
                        ircbot.sendData("MODE", channel + " -b " + ban);
                    }
                    else
                    {
                    }
                }
            }
            else
            {
                ircbot.sendData("PRIVMSG", channel + " :" + nick + " is not in the a" + type + " list.");
            }
            if (found_nick == true)
            {
                ircbot.sendData("PRIVMSG", channel + " :" + nick + " has been removed from the a" + type + " list.");
            }
        }