示例#1
0
        public Q3DemoStream(Stream baseStream, Q3Connection connection)
        {
            if (baseStream == null)
            {
                throw new ArgumentNullException("sock");
            }

            if (connection == null)
            {
                throw new ArgumentNullException("connection");
            }

            this.baseStream   = baseStream;
            this.connection   = connection;
            this.msReadBuffer = new MemoryStream(this.readBuffer, false);
        }
示例#2
0
        //
        // Summary:
        //     Initializes a new instance of the Q3Network.Q3NetworkStream class.
        //
        // Parameters:
        //   stream:
        //     The stream to compress or decompress.
        //
        // Exceptions:
        //   System.ArgumentNullException:
        //     stream is null.
        public Q3NetworkStreamOld(Socket sock, Q3Connection connection)
        {
            if (sock == null)
            {
                throw new ArgumentNullException("sock");
            }

            if (connection == null)
            {
                throw new ArgumentNullException("connection");
            }

            this.sock         = sock;
            this.connection   = connection;
            this.msReadBuffer = new MemoryStream(this.readBuffer, false);
        }
示例#3
0
        public Q3CryptStream(Q3DatagramStream stream, Q3Connection connection, FileAccess access)
        {
            #region Check Arguments
            if (stream == null)
            {
                throw new ArgumentNullException("stream");
            }
            if (connection == null)
            {
                throw new ArgumentNullException("connection");
            }
            #endregion Check Arguments

            this.underlying = stream;
            this.connection = connection;
            this.access     = access;
        }
示例#4
0
        public Q3NetworkStream(Socket socket, Q3Connection connection, FileAccess access)
        {
            #region Check Arguments
            if (socket == null)
            {
                throw new ArgumentNullException("socket");
            }
            if (connection == null)
            {
                throw new ArgumentNullException("connection");
            }
            #endregion Check Arguments

            this.underlying = socket;
            this.connection = connection;
            this.access     = access;

            Init();
        }
示例#5
0
        //
        // Summary:
        //     Initializes a new instance of the Q3Cypher.Q3CypherStream class
        //     using the specified stream and Q3Cypher.CypherMode value.
        //
        // Parameters:
        //   stream:
        //     The stream to compress or decompress.
        //
        //   mode:
        //     One of the Q3Cypher.CypherMode values that indicates the
        //     action to take.
        //
        // Exceptions:
        //   System.ArgumentNullException:
        //     stream is null.
        //
        //   System.ArgumentException:
        //     mode is not a valid Q3Cypher.CypherMode enumeration value.
        //      -or- Q3Cypher.CypherMode is Q3Cypher.CypherMode.Encode
        //     and System.IO.Stream.CanWrite is false.  -or- Q3Cypher.CypherMode
        //     is Q3Cypher.CypherMode.Decode and System.IO.Stream.CanRead
        //     is false.
        public Q3CryptStreamOld(Stream stream, CypherMode mode, Q3Connection connection)
        {
            if (stream == null)
            {
                throw new ArgumentNullException("stream");
            }

            if (mode == CypherMode.Encode && !stream.CanWrite)
            {
                throw new ArgumentException("A given stream cannot be written while mode was set to CypherMode.Encode");
            }

            if (mode == CypherMode.Decode && !stream.CanRead)
            {
                throw new ArgumentException("A given stream cannot be read while mode was set to CypherMode.Decode");
            }

            this.baseStream = stream;
            this.mode       = mode;
            this.connection = connection;
        }