Beispiel #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="first"></param>
        /// <param name="second"></param>
        /// <returns></returns>
        public static ClientModeString operator +(ClientModeString first, ClientModeString second)
        {
            ClientModeString retVal = first ?? second;

            if (first != null && second != null)
            {
                Mode[] newModeArray = new Mode[first.Length + second.Length];
                first._modes.CopyTo(newModeArray, 0);
                second._modes.CopyTo(newModeArray, first.Length);

                retVal = new ClientModeString(newModeArray);
            }

            return(retVal);
        }
Beispiel #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="modeString"></param>
        /// <param name="mode"></param>
        /// <returns></returns>
        public static ClientModeString operator +(ClientModeString modeString, Mode mode)
        {
            ClientModeString retVal = null;

            if (modeString == null)
            {
                retVal = new ClientModeString(mode);
            }
            else
            {
                Mode[] newModeArray = new Mode[modeString.Length + 1];
                modeString._modes.CopyTo(newModeArray, 0);
                newModeArray[newModeArray.Length - 1] = mode;

                retVal = new ClientModeString(newModeArray);
            }

            return(retVal);
        }
Beispiel #3
0
        /// <summary>
        /// Deletes the specified number of <see cref="Irc.Mode">Irc.Modes</see> from this
        /// <see cref="Irc.ChannelModeString"/> starting from the specified index.
        /// </summary>
        /// <param name="startIndex">The zero-based index from which
        /// to start deleting <see cref="Irc.Mode">Irc.Modes</see>.</param>
        /// <param name="count">The number of <see cref="Irc.Mode">Irc.Modes</see> to delete.</param>
        /// <returns>A new <see cref="Irc.ChannelModeString"/> with the specified number of modes removed.</returns>
        /// <exception cref="System.ArgumentOutOfRangeException">Thrown if startIndex or count is not in the bounds of the array.</exception>
        public ClientModeString Remove(int startIndex, int count)
        {
            if (startIndex < 0 || startIndex >= Length)
            {
                throw new ArgumentOutOfRangeException(nameof(startIndex));
            }
            if (count < 0 || count > Length - startIndex)
            {
                throw new ArgumentOutOfRangeException(nameof(count));
            }

            ClientModeString retVal = null;

            if (startIndex > 0)
            {
                Mode[] newModeArray = new Mode[Length - count];
                Array.Copy(_modes, 0, newModeArray, 0, startIndex);
                Array.Copy(_modes, startIndex + count, newModeArray, startIndex, Length - startIndex - count);

                retVal = new ClientModeString(newModeArray);
            }

            return(retVal);
        }
Beispiel #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Irc.ClientModeEventArgs"/> class.
 /// </summary>
 /// <param name="modeChanger">The nickname of the user changing the mode.</param>
 /// <param name="modeString">The mode string.</param>
 public ClientModeEventArgs(IrcNickname modeChanger, ClientModeString modeString)
     : base(modeChanger)
 {
     ModeString = modeString;
 }