// Decompiled with JetBrains decompiler
// Type: Meebey.SmartIrc4net.Rfc2812
// Assembly: svchost, Version=3.2.4.0, Culture=neutral, PublicKeyToken=null
// MVID: 8F51F928-E1DB-4815-857F-7D580385B815
// Assembly location: C:\Users\Administrateur\Downloads\Virusshare-00000-msil\Backdoor.MSIL.IrcBot.lp-4dd7df88cffbf85a5894bc1b38660fa613c24b0e6c004ac00b2b119c03a35d3f.exe

using System;
using System.Text;
using System.Text.RegularExpressions;

namespace Meebey.SmartIrc4net
{
  public sealed class Rfc2812
  {
    private static Regex _NicknameRegex = new Regex("^[A-Za-z\\[\\]\\\\`_^{|}][A-Za-z0-9\\[\\]\\\\`_\\-^{|}]+$", RegexOptions.Compiled);

    private Rfc2812()
    {
    }

    public static bool IsValidNickname(string nickname) => nickname != null && nickname.Length > 0 && Rfc2812._NicknameRegex.Match(nickname).Success;

    public static string Pass(string password) => "PASS " + password;

    public static string Nick(string nickname) => "NICK " + nickname;

    public static string User(string username, int usermode, string realname) => "USER " + username + " " + usermode.ToString() + " * :" + realname;

    public static string Oper(string name, string password) => "OPER " + name + " " + password;

    public static string Privmsg(string destination, string message) => "PRIVMSG " + destination + " :" + message;

    public static string Notice(string destination, string message) => "NOTICE " + destination + " :" + message;

    public static string Join(string channel) => "JOIN " + channel;

    public static string Join(string[] channels) => "JOIN " + string.Join(",", channels);

    public static string Join(string channel, string key) => "JOIN " + channel + " " + key;

    public static string Join(string[] channels, string[] keys) => "JOIN " + string.Join(",", channels) + " " + string.Join(",", keys);

    public static string Part(string channel) => "PART " + channel;

    public static string Part(string[] channels) => "PART " + string.Join(",", channels);

    public static string Part(string channel, string partmessage) => "PART " + channel + " :" + partmessage;

    public static string Part(string[] channels, string partmessage) => "PART " + string.Join(",", channels) + " :" + partmessage;

    public static string Kick(string channel, string nickname) => "KICK " + channel + " " + nickname;

    public static string Kick(string channel, string nickname, string comment) => "KICK " + channel + " " + nickname + " :" + comment;

    public static string Kick(string[] channels, string nickname) => "KICK " + string.Join(",", channels) + " " + nickname;

    public static string Kick(string[] channels, string nickname, string comment) => "KICK " + string.Join(",", channels) + " " + nickname + " :" + comment;

    public static string Kick(string channel, string[] nicknames)
    {
      string str = string.Join(",", nicknames);
      return "KICK " + channel + " " + str;
    }

    public static string Kick(string channel, string[] nicknames, string comment)
    {
      string str = string.Join(",", nicknames);
      return "KICK " + channel + " " + str + " :" + comment;
    }

    public static string Kick(string[] channels, string[] nicknames) => "KICK " + string.Join(",", channels) + " " + string.Join(",", nicknames);

    public static string Kick(string[] channels, string[] nicknames, string comment) => "KICK " + string.Join(",", channels) + " " + string.Join(",", nicknames) + " :" + comment;

    public static string Motd() => "MOTD";

    public static string Motd(string target) => "MOTD " + target;

    [Obsolete("use Lusers() method instead")]
    public static string Luser() => Rfc2812.Lusers();

    public static string Lusers() => "LUSERS";

    [Obsolete("use Lusers(string) method instead")]
    public static string Luser(string mask) => Rfc2812.Lusers(mask);

    public static string Lusers(string mask) => "LUSER " + mask;

    [Obsolete("use Lusers(string, string) method instead")]
    public static string Luser(string mask, string target) => Rfc2812.Lusers(mask, target);

    public static string Lusers(string mask, string target) => "LUSER " + mask + " " + target;

    public static string Version() => "VERSION";

    public static string Version(string target) => "VERSION " + target;

    public static string Stats() => "STATS";

    public static string Stats(string query) => "STATS " + query;

    public static string Stats(string query, string target) => "STATS " + query + " " + target;

    public static string Links() => "LINKS";

    public static string Links(string servermask) => "LINKS " + servermask;

    public static string Links(string remoteserver, string servermask) => "LINKS " + remoteserver + " " + servermask;

    public static string Time() => "TIME";

    public static string Time(string target) => "TIME " + target;

    public static string Connect(string targetserver, string port) => "CONNECT " + targetserver + " " + port;

    public static string Connect(string targetserver, string port, string remoteserver) => "CONNECT " + targetserver + " " + port + " " + remoteserver;

    public static string Trace() => "TRACE";

    public static string Trace(string target) => "TRACE " + target;

    public static string Admin() => "ADMIN";

    public static string Admin(string target) => "ADMIN " + target;

    public static string Info() => "INFO";

    public static string Info(string target) => "INFO " + target;

    public static string Servlist() => "SERVLIST";

    public static string Servlist(string mask) => "SERVLIST " + mask;

    public static string Servlist(string mask, string type) => "SERVLIST " + mask + " " + type;

    public static string Squery(string servicename, string servicetext) => "SQUERY " + servicename + " :" + servicetext;

    public static string List() => "LIST";

    public static string List(string channel) => "LIST " + channel;

    public static string List(string[] channels) => "LIST " + string.Join(",", channels);

    public static string List(string channel, string target) => "LIST " + channel + " " + target;

    public static string List(string[] channels, string target) => "LIST " + string.Join(",", channels) + " " + target;

    public static string Names() => "NAMES";

    public static string Names(string channel) => "NAMES " + channel;

    public static string Names(string[] channels) => "NAMES " + string.Join(",", channels);

    public static string Names(string channel, string target) => "NAMES " + channel + " " + target;

    public static string Names(string[] channels, string target) => "NAMES " + string.Join(",", channels) + " " + target;

    public static string Topic(string channel) => "TOPIC " + channel;

    public static string Topic(string channel, string newtopic) => "TOPIC " + channel + " :" + newtopic;

    public static string Mode(string target) => "MODE " + target;

    public static string Mode(string target, string newmode) => "MODE " + target + " " + newmode;

    public static string Mode(string target, string[] newModes, string[] newModeParameters)
    {
      if (newModes == null)
        throw new ArgumentNullException(nameof (newModes));
      if (newModeParameters == null)
        throw new ArgumentNullException(nameof (newModeParameters));
      if (newModes.Length != newModeParameters.Length)
        throw new ArgumentException("newModes and newModeParameters must have the same size.");
      StringBuilder stringBuilder1 = new StringBuilder(newModes.Length);
      StringBuilder stringBuilder2 = new StringBuilder();
      int num = 3;
      if (newModes.Length > num)
        throw new ArgumentOutOfRangeException("newModes.Length", (object) newModes.Length, string.Format("Mode change list is too large (> {0}).", (object) num));
      for (int index1 = 0; index1 <= newModes.Length; index1 += num)
      {
        for (int index2 = 0; index2 < num && index1 + index2 < newModes.Length; ++index2)
          stringBuilder1.Append(newModes[index1 + index2]);
        for (int index3 = 0; index3 < num && index1 + index3 < newModeParameters.Length; ++index3)
        {
          stringBuilder2.Append(newModeParameters[index1 + index3]);
          stringBuilder2.Append(" ");
        }
      }
      if (stringBuilder2.Length > 0)
      {
        --stringBuilder2.Length;
        stringBuilder1.Append(" ");
        stringBuilder1.Append(stringBuilder2.ToString());
      }
      return Rfc2812.Mode(target, stringBuilder1.ToString());
    }

    public static string Service(string nickname, string distribution, string info) => "SERVICE " + nickname + " * " + distribution + " * * :" + info;

    public static string Invite(string nickname, string channel) => "INVITE " + nickname + " " + channel;

    public static string Who() => "WHO";

    public static string Who(string mask) => "WHO " + mask;

    public static string Who(string mask, bool ircop) => ircop ? "WHO " + mask + " o" : "WHO " + mask;

    public static string Whois(string mask) => "WHOIS " + mask;

    public static string Whois(string[] masks) => "WHOIS " + string.Join(",", masks);

    public static string Whois(string target, string mask) => "WHOIS " + target + " " + mask;

    public static string Whois(string target, string[] masks)
    {
      string str = string.Join(",", masks);
      return "WHOIS " + target + " " + str;
    }

    public static string Whowas(string nickname) => "WHOWAS " + nickname;

    public static string Whowas(string[] nicknames) => "WHOWAS " + string.Join(",", nicknames);

    public static string Whowas(string nickname, string count) => "WHOWAS " + nickname + " " + count + " ";

    public static string Whowas(string[] nicknames, string count) => "WHOWAS " + string.Join(",", nicknames) + " " + count + " ";

    public static string Whowas(string nickname, string count, string target) => "WHOWAS " + nickname + " " + count + " " + target;

    public static string Whowas(string[] nicknames, string count, string target) => "WHOWAS " + string.Join(",", nicknames) + " " + count + " " + target;

    public static string Kill(string nickname, string comment) => "KILL " + nickname + " :" + comment;

    public static string Ping(string server) => "PING " + server;

    public static string Ping(string server, string server2) => "PING " + server + " " + server2;

    public static string Pong(string server) => "PONG " + server;

    public static string Pong(string server, string server2) => "PONG " + server + " " + server2;

    public static string Error(string errormessage) => "ERROR :" + errormessage;

    public static string Away() => "AWAY";

    public static string Away(string awaytext) => "AWAY :" + awaytext;

    public static string Rehash() => "REHASH";

    public static string Die() => "DIE";

    public static string Restart() => "RESTART";

    public static string Summon(string user) => "SUMMON " + user;

    public static string Summon(string user, string target) => "SUMMON " + user + " " + target;

    public static string Summon(string user, string target, string channel) => "SUMMON " + user + " " + target + " " + channel;

    public static string Users() => "USERS";

    public static string Users(string target) => "USERS " + target;

    public static string Wallops(string wallopstext) => "WALLOPS :" + wallopstext;

    public static string Userhost(string nickname) => "USERHOST " + nickname;

    public static string Userhost(string[] nicknames) => "USERHOST " + string.Join(" ", nicknames);

    public static string Ison(string nickname) => "ISON " + nickname;

    public static string Ison(string[] nicknames) => "ISON " + string.Join(" ", nicknames);

    public static string Quit() => "QUIT";

    public static string Quit(string quitmessage) => "QUIT :" + quitmessage;

    public static string Squit(string server, string comment) => "SQUIT " + server + " :" + comment;
  }
}
