Ejemplo n.º 1
0
        /// <summary>
        /// Flushes the currently connected encoder and selects the given encoder as current.
        /// The connected encoder can write directly to the archive file with reduced buffering.
        /// </summary>
        public void ConnectEncoder(Encoder encoder)
        {
            if (encoder == null)
                throw new ArgumentNullException("encoder");

            if (mEncoder == encoder)
            {
                mEncoder.Flush();
            }
            else
            {
                if (encoder.IsConnected)
                    throw new InvalidOperationException("The given encoder is already connected to another ArchiveWriter.");

                if (mEncoder != null)
                    mEncoder.Disconnect();

                mEncoder = encoder;
                mEncoder.Connect(this);
            }
        }