Esempio n. 1
0
            /// <summary>
            /// Write flushed data to an ArchiveWriter without connecting to it.
            /// If the ArchiveWriter has a connected encoder it is flushed first.
            /// This does not flush this encoder, if that is required do it manually.
            /// </summary>
            public void WriteFlushedData(ArchiveWriter writer)
            {
                if (writer == null)
                    throw new ArgumentNullException("writer");

                // If the writer has a connected encoder we need to flush that one.
                if (writer.mEncoder != null)
                    writer.mEncoder.Flush();

                if (mFlushed != null && mFlushed.Count != 0)
                {
                    foreach (var item in mFlushed)
                        writer.Encoder_WriteFileSet(item);

                    mFlushed.Clear();
                }
            }
Esempio n. 2
0
            internal void Connect(ArchiveWriter writer)
            {
                Debug.Assert(writer != null && mWriter == null);

                mWriter = writer;
                mEncryption = writer.DefaultEncryptionProvider;

                if (mFlushed != null && mFlushed.Count != 0)
                {
                    foreach (var item in mFlushed)
                        mWriter.Encoder_WriteFileSet(item);

                    mFlushed.Clear();
                }

                if (mBuffer != null)
                {
                    mBuffer.FullCopyTo(writer.mFileStream);
                    mBuffer.SetLength(0);
                }
            }