/// <summary>
 /// Indicates vendor specific UPNP error code of 876.
 /// </summary>
 /// <param name="contentUri">The contentUri value of the MediaResource when the protocolInfo modification was attempted.</param>
 /// <param name="protocolInfo">The value of the intended protocolInfo string.</param>
 public Error_CannotSetProtocolInfo(string contentUri, ProtocolInfoString protocolInfo)
     : base(876, "Cannot set the protocolInfo string (" +protocolInfo.ToString()+ ") to something other than \"http-get\", if the contentUri value starts with (" +MediaResource.AUTOMAPFILE+").")
 {
     this.ContentUri = contentUri;
     this.ProtocolInfo = protocolInfo;
 }
 /// <summary>
 /// Indicates vendor specific UPNP error code of 877.
 /// </summary>
 public Error_CannotSetContentUri(ProtocolInfoString protocolInfo, string contentUri)
     : base(877, "Cannot set the contentUri ("+contentUri+") to a string beginning with ("+MediaResource.AUTOMAPFILE+") if the protocolInfo ("+protocolInfo.ToString()+") does not indicate a protocol of \"http-get\"")
 {
     this.ContentUri = contentUri;
     this.ProtocolInfo = protocolInfo;
 }
        /// <summary>
        /// Method ensures that the protocolInfo for a PrepareForConnection request
        /// matches up correctly with a supported protocol on the device.
        /// The check is a trivial check and nothing more.
        /// <see cref="MediaServerDevice.SinkCm_PrepareForConnection"/>
        /// will do additional checks to ensure that the entire request is correct.
        /// </summary>
        /// <param name="protInfo">protocolInfo string proposed in the request</param>
        /// <param name="dir">direction of the stream, relative to the server</param>
        private void ValidateConnectionRequest(ProtocolInfoString protInfo, DvConnectionManager.Enum_A_ARG_TYPE_Direction dir)
        {
            bool incompatibleProtocol = true;

            // Grab the correct protocolInfo set, depending on whether
            // the stream is supposed to be a source or a sink.
            ArrayList al;
            if (dir == DvConnectionManager.Enum_A_ARG_TYPE_Direction.INPUT)
            {
                al = this.m_SinkProtocolInfoSet;
            }
            else if (dir == DvConnectionManager.Enum_A_ARG_TYPE_Direction.OUTPUT)
            {
                al = this.m_SourceProtocolInfoSet;
            }
            else
            {
                throw new Error_InvalidDirection("");
            }

            // Compare the requested protocol info string against the
            // list of available ones.
            //
            foreach (ProtocolInfoString prot in al)
            {
                if (protInfo.Matches(prot))
                {
                    incompatibleProtocol = false;
                    break;
                }
            }

            if (incompatibleProtocol)
            {
                throw new Error_IncompatibleProtocolInfo("("+protInfo.ToString()+")");
            }
        }