Mode() public static method

public static Mode ( string target ) : string
target string
return string
示例#1
0
        public void Mode(string target, string[] newModes, string[] newModeParameters)
        {
            if (target == null)
            {
                throw new ArgumentNullException(nameof(target));
            }
            if (newModes == null)
            {
                throw new ArgumentNullException(nameof(newModes));
            }
            if (newModeParameters == null)
            {
                throw new ArgumentNullException(nameof(newModeParameters));
            }
            if (newModes.Length == 0)
            {
                throw new ArgumentException("newModes must not be empty.", nameof(newModes));
            }
            if (newModeParameters.Length == 0)
            {
                throw new ArgumentException("newModeParameters must not be empty.", nameof(newModeParameters));
            }
            if (newModes.Length != newModeParameters.Length)
            {
                throw new ArgumentException("newModes and newModeParameters must have the same size.", nameof(newModes));
            }

            int maxModeChanges = MaxModeChanges;

            for (int i = 0; i < newModes.Length; i += maxModeChanges)
            {
                var newModeChunks          = new List <string>(maxModeChanges);
                var newModeParameterChunks = new List <string>(maxModeChanges);
                for (int j = 0; j < maxModeChanges; j++)
                {
                    if (i + j >= newModes.Length)
                    {
                        break;
                    }
                    newModeChunks.Add(newModes[i + j]);
                    newModeParameterChunks.Add(newModeParameters[i + j]);
                }
                WriteLine(Rfc2812.Mode(target, newModeChunks.ToArray(), newModeParameterChunks.ToArray()));
            }
        }
示例#2
0
 public void RfcMode(string target) => WriteLine(Rfc2812.Mode(target));
示例#3
0
 public void RfcMode(string target, Priority priority) => WriteLine(Rfc2812.Mode(target), priority);
示例#4
0
 /// <summary>
 /// Fetch a list of entries of a mask-format channel mode.
 /// </summary>
 /// <param name="modetype">The type of the mask-format mode (e.g. +b) to fetch.</param>
 /// <param name="channel">The channel whose mode to fetch.</param>
 /// <param name="priority">The priority with which the mode-setting message should be sent.</param>
 public void ListChannelMasks(string modetype, string channel, Priority priority) => WriteLine(Rfc2812.Mode(channel, modetype), priority);
示例#5
0
 /// <summary>
 /// Add or remove an entry to/from a mask-format channel mode.
 /// </summary>
 /// <param name="modetype">The type of the mask-format mode (e.g. +b) whose entries to modify.</param>
 /// <param name="channel">The channel whose mode to edit.</param>
 /// <param name="hostmask">The hostmask of the entry to add/remove.</param>
 public void ModifyChannelMasks(string modetype, string channel, string hostmask) => WriteLine(Rfc2812.Mode(channel, modetype + " " + hostmask));
示例#6
0
 public void Voice(string channel, string nickname)
 {
     this.WriteLine(Rfc2812.Mode(channel, "+v " + nickname));
 }
示例#7
0
 /// <summary>
 /// Fetch a list of entries of a mask-format channel mode.
 /// </summary>
 /// <param name="modetype">The type of the mask-format mode (e.g. +b) to fetch.</param>
 /// <param name="channel">The channel whose mode to fetch.</param>
 public void ListChannelMasks(string modetype, string channel) => WriteLine(Rfc2812.Mode(channel, modetype));
示例#8
0
 public void Deop(string channel, string nickname, Priority priority)
 {
     this.WriteLine(Rfc2812.Mode(channel, "-o " + nickname), priority);
 }
示例#9
0
 public void Deop(string channel, string nickname)
 {
     this.WriteLine(Rfc2812.Mode(channel, "-o " + nickname));
 }
示例#10
0
 public void Unban(string channel, string hostmask)
 {
     this.WriteLine(Rfc2812.Mode(channel, "-b " + hostmask));
 }
示例#11
0
 public void RfcMode(string target)
 {
     this.WriteLine(Rfc2812.Mode(target));
 }
示例#12
0
 public void Unban(string channel, string hostmask, Priority priority)
 {
     this.WriteLine(Rfc2812.Mode(channel, "-b " + hostmask), priority);
 }
示例#13
0
 public void Ban(string channel)
 {
     this.WriteLine(Rfc2812.Mode(channel, "+b"));
 }
示例#14
0
 public void Ban(string channel, Priority priority)
 {
     this.WriteLine(Rfc2812.Mode(channel, "+b"), priority);
 }
示例#15
0
 public void RfcMode(string target, string newmode, Priority priority) => WriteLine(Rfc2812.Mode(target, newmode), priority);
示例#16
0
 /// <summary>
 /// Give or take a user's privilege in a channel.
 /// </summary>
 /// <param name="modechg">The mode change (e.g. +o) to perform on the user.</param>
 /// <param name="channel">The channel in which to perform the privilege change.</param>
 /// <param name="nickname">The nickname of the user whose privilege is being changed.</param>
 public void ChangeChannelPrivilege(string modechg, string channel, string nickname) => WriteLine(Rfc2812.Mode(channel, modechg + " " + nickname));
示例#17
0
 public void RfcMode(string target, string newmode) => WriteLine(Rfc2812.Mode(target, newmode));
示例#18
0
 public void Voice(string channel, string nickname, Priority priority)
 {
     this.WriteLine(Rfc2812.Mode(channel, "+v " + nickname), priority);
 }