コード例 #1
0
        /// <summary>
        /// Constructor for creating an echo or non-positional channel.
        /// </summary>
        /// <param name="issuer">The issuer that is responsible for authorizing access to this channel</param>
        /// <param name="name">The name of the channel</param>
        /// <param name="domain">The Vivox domain that hosts this channel</param>
        /// <param name="type">The channel type</param>
        /// /// <param name="properties">3D positional channel properties.</param>
        public ChannelId(string issuer, string name, string domain, ChannelType type = ChannelType.NonPositional, Channel3DProperties properties = null)
        {
            if (string.IsNullOrEmpty(issuer))
            {
                throw new ArgumentNullException(nameof(issuer));
            }
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException(nameof(name));
            }
            if (string.IsNullOrEmpty(domain))
            {
                throw new ArgumentNullException(nameof(domain));
            }
            if (!Enum.IsDefined(typeof(ChannelType), type))
            {
                throw new ArgumentOutOfRangeException(type.ToString());
            }
            if (properties == null)
            {
                _properties = new Channel3DProperties();
            }
            else if (type == ChannelType.Positional && !properties.IsValid())
            {
                throw new ArgumentException("", nameof(properties));
            }
            else
            {
                _properties = properties;
            }
            if (!IsValidName(name))
            {
                throw new ArgumentException($"{GetType().Name}: Argument contains one, or more, invalid characters, or the length of the name exceeds 200 characters.", nameof(name));
            }

            _issuer = issuer;
            _name   = name;
            _domain = domain;
            _type   = type;
        }
コード例 #2
0
 /// <summary>
 /// Ensures that _name, _domain, and _issuer are not empty, and further validates the _name field by checking it against an array of valid characters.
 /// If the channel is Positional, _properties is also validated.
 /// </summary>
 /// <returns>If the ChannelID is valid.</returns>
 internal bool IsValid()
 {
     return(!(IsEmpty &&
              IsValidName(_name) &&
              (_type == ChannelType.Positional && !_properties.IsValid())));
 }
コード例 #3
0
ファイル: ChannelId.cs プロジェクト: pyr53540/vivox
 /// <summary>
 /// Ensures that _name, _domain, and _issuer are not empty, and further validates the _name field by checking it against an array of valid characters.
 /// If the channel is Positional, _properties is also validated.
 /// </summary>
 /// <returns>If the ChannelID is valid.</returns>
 internal bool IsValid()
 {
     if (IsEmpty || !IsValidName(_name) || (_type == ChannelType.Positional && !_properties.IsValid()))
     {
         return(false);
     }
     return(true);
 }