Пример #1
0
    /// <summary>Initializes a new CDDB server connection</summary>
    /// <param name="protocol">Protocol by which the CDDB server can be reached</param>
    /// <param name="hostname">Host name of the connected CDDB server</param>
    /// <param name="version">Version of the CDDB software running on the server</param>
    /// <param name="readOnly">Whether the server has restricted us to read access</param>
    internal CddbConnection(
      CddbProtocol protocol, string hostname, string version, bool readOnly
    ) {
      this.protocol = protocol;
      this.hostname = hostname;
      this.version = version;
      this.readOnly = readOnly;

      // This is not documented in the CDDB protocol specification, but all servers
      // I tested it with begin a new connection with protocol level 1. This also
      // is the only valid choice if the server wants to keep backward compatibility.
      this.activeProtocolLevel = 1;
    }
Пример #2
0
        /// <summary>Initializes a new CDDB server connection</summary>
        /// <param name="protocol">Protocol by which the CDDB server can be reached</param>
        /// <param name="hostname">Host name of the connected CDDB server</param>
        /// <param name="version">Version of the CDDB software running on the server</param>
        /// <param name="readOnly">Whether the server has restricted us to read access</param>
        internal CddbConnection(
            CddbProtocol protocol, string hostname, string version, bool readOnly
            )
        {
            this.protocol = protocol;
            this.hostname = hostname;
            this.version  = version;
            this.readOnly = readOnly;

            // This is not documented in the CDDB protocol specification, but all servers
            // I tested it with begin a new connection with protocol level 1. This also
            // is the only valid choice if the server wants to keep backward compatibility.
            this.activeProtocolLevel = 1;
        }
 public void TestThrowOnStatusCodeFromTooShortLine()
 {
     Assert.Throws <BadResponseException>(
         delegate() { CddbProtocol.GetStatusCode("12"); }
         );
 }
 public void TestThrowOnInvalidCharactersInStatusCode()
 {
     Assert.Throws <BadResponseException>(
         delegate() { CddbProtocol.GetStatusCode("12b This is not valid"); }
         );
 }
 public void TestStatusCodeRetrieval()
 {
     Assert.AreEqual(
         123, CddbProtocol.GetStatusCode("123 One two three")
         );
 }