Exemple #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IrcTargetMask"/> class with the specified target mask
 /// identifier.
 /// </summary>
 /// <param name="targetMask">A wildcard expression for matching against server names or host names.
 /// If the first character is '$', the mask is a server mask; if the first character is '#', the mask is a host
 /// mask.</param>
 /// <exception cref="ArgumentNullException"><paramref name="targetMask"/> is <see langword="null"/></exception>
 /// <exception cref="ArgumentException">The length of <paramref name="targetMask"/> is too short.</exception>
 /// <exception cref="ArgumentException"><paramref name="targetMask"/> does not represent a known mask type.
 /// </exception>
 public IrcTargetMask(string targetMask)
 {
     if (targetMask == null)
     {
         throw new ArgumentNullException("targetMask");
     }
     if (Resources.MessageTargetMaskTooShort.Length < 2)
     {
         throw new ArgumentException(Resources.MessageTargetMaskTooShort, "targetMask");
     }
     if (targetMask[0] == '$')
     {
         this.type = IrcTargetMaskType.ServerMask;
     }
     else if (targetMask[0] == '#')
     {
         this.type = IrcTargetMaskType.HostMask;
     }
     else
     {
         throw new ArgumentException(string.Format(
                                         Resources.MessageTargetMaskInvalidType, targetMask), "targetMask");
     }
     this.mask = mask.Substring(1);
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="IrcTargetMask"/> class with the specified type and mask.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <param name="mask">The mask.</param>
        public IrcTargetMask(IrcTargetMaskType type, string mask)
        {
            if (!Enum.IsDefined(typeof(IrcTargetMaskType), type))
                throw new ArgumentException("type");
            if (mask == null)
                throw new ArgumentNullException("mask");

            this.type = type;
            this.mask = mask;
        }
Exemple #3
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="IrcTargetMask" /> class with the specified type and mask.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <param name="mask">The mask.</param>
        public IrcTargetMask(IrcTargetMaskType type, string mask)
        {
            if (!Enum.IsDefined(typeof (IrcTargetMaskType), type))
                throw new ArgumentException(nameof(type));
            if (mask == null)
                throw new ArgumentNullException(nameof(mask));

            Type = type;
            Mask = mask;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="IrcTargetMask"/> class with the specified type and mask.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <param name="mask">The mask.</param>
        public IrcTargetMask(IrcTargetMaskType type, string mask)
        {
            if (!Enum.IsDefined(typeof(IrcTargetMaskType), type))
            {
                throw new ArgumentException("type");
            }
            if (mask == null)
            {
                throw new ArgumentNullException("mask");
            }

            this.type = type;
            this.mask = mask;
        }
Exemple #5
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="IrcTargetMask" /> class with the specified type and mask.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <param name="mask">The mask.</param>
        public IrcTargetMask(IrcTargetMaskType type, string mask)
        {
            if (!Enum.IsDefined(typeof(IrcTargetMaskType), type))
            {
                throw new ArgumentException(nameof(type));
            }
            if (mask == null)
            {
                throw new ArgumentNullException(nameof(mask));
            }

            Type = type;
            Mask = mask;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="IrcTargetMask"/> class with the specified target mask
        /// identifier.
        /// </summary>
        /// <param name="targetMask">A wildcard expression for matching against server names or host names.
        /// If the first character is '$', the mask is a server mask; if the first character is '#', the mask is a host
        /// mask.</param>
        /// <exception cref="ArgumentNullException"><paramref name="targetMask"/> is <see langword="null"/></exception>
        /// <exception cref="ArgumentException">The length of <paramref name="targetMask"/> is too short.</exception>
        /// <exception cref="ArgumentException"><paramref name="targetMask"/> does not represent a known mask type.
        /// </exception>
        public IrcTargetMask(string targetMask)
        {
            if (targetMask == null)
                throw new ArgumentNullException("targetMask");
            if (Properties.Resources.MessageTargetMaskTooShort.Length < 2)
                throw new ArgumentException(Properties.Resources.MessageTargetMaskTooShort, "targetMask");

            if (targetMask[0] == '$')
                this.type = IrcTargetMaskType.ServerMask;
            else if (targetMask[0] == '#')
                this.type = IrcTargetMaskType.HostMask;
            else
                throw new ArgumentException(string.Format(
                    Properties.Resources.MessageTargetMaskInvalidType, targetMask), "targetMask");
            this.mask = mask.Substring(1);
        }
Exemple #7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="IrcTargetMask"/> class with the specified target mask
        /// identifier.
        /// </summary>
        /// <param name="targetMask">A wildcard expression for matching against server names or host names.
        /// If the first character is '$', the mask is a server mask; if the first character is '#', the mask is a host
        /// mask.</param>
        /// <exception cref="ArgumentNullException"><paramref name="targetMask"/> is <see langword="null"/></exception>
        /// <exception cref="ArgumentException">The length of <paramref name="targetMask"/> is too short.</exception>
        /// <exception cref="ArgumentException"><paramref name="targetMask"/> does not represent a known mask type.
        /// </exception>
        public IrcTargetMask(string targetMask)
        {
            if (targetMask == null)
                throw new ArgumentNullException("targetMask");
            if (ResourceLoader.GetForCurrentView("IrcDotNet/Resources").GetString("MessageTargetMaskTooShort").Length < 2)
                throw new ArgumentException(ResourceLoader.GetForCurrentView("IrcDotNet/Resources").GetString("MessageTargetMaskTooShort"), "targetMask");

            if (targetMask[0] == '$')
                this.type = IrcTargetMaskType.ServerMask;
            else if (targetMask[0] == '#')
                this.type = IrcTargetMaskType.HostMask;
            else
                throw new ArgumentException(string.Format(
                    ResourceLoader.GetForCurrentView("IrcDotNet/Resources").GetString("MessageTargetMaskInvalidType"), targetMask), "targetMask");
            this.mask = mask.Substring(1);
        }