예제 #1
0
        /// <summary>
        /// Creates a new volume backed by an optional `IPageCache` implementation instance
        /// </summary>
        public DefaultVolume(ICryptoManager crypto, IPageCache cache, VolumeMetadataBuilder metadataBuilder, Stream stream, bool ownsStream = true)
        {
            m_Crypto = crypto.NonNull(nameof(crypto));
            m_Cache  = cache;
            m_Stream = stream.NonNull(nameof(stream));
            (m_Stream.Length == 0).IsTrue("stream.!Empty");
            metadataBuilder.Assigned.IsTrue("meta.!Assigned");

            m_Reader = new BixReader(m_Stream);
            m_Writer = new BixWriter(m_Stream);

            m_Metadata = metadataBuilder.Built;
            writeVolumeHeader();

            ctor();
        }
예제 #2
0
 /// <summary>
 /// Creates a new volume
 /// </summary>
 public DefaultVolume(ICryptoManager crypto, VolumeMetadataBuilder metadataBuilder, Stream stream, bool ownsStream = true)
     : this(crypto, null, metadataBuilder, stream, ownsStream)
 {
 }