/// <summary> /// Opens the content of the disk image file as a stream. /// </summary> /// <param name="parent">The parent file's content (if any).</param> /// <param name="ownsParent">Whether the created stream assumes ownership of parent stream.</param> /// <returns>The new content stream.</returns> public override SparseStream OpenContent(SparseStream parent, Ownership ownsParent) { if (parent != null && ownsParent == Ownership.Dispose) { // Not needed until differencing disks supported. parent.Dispose(); } DiskStream stream = new DiskStream(_stream, Ownership.None, _header); stream.WriteOccurred += OnWriteOccurred; return(stream); }
/// <summary> /// Disposes of underlying resources. /// </summary> /// <param name="disposing">Set to <c>true</c> if called within Dispose(), /// else <c>false</c>.</param> protected override void Dispose(bool disposing) { try { if (disposing) { if (_content != null) { _content.Dispose(); _content = null; } if (_diskImage != null) { _diskImage.Dispose(); } } } finally { base.Dispose(disposing); } }
/// <summary> /// Opens the content of the disk image file as a stream. /// </summary> /// <param name="parent">The parent file's content (if any)</param> /// <param name="ownsParent">Whether the created stream assumes ownership of parent stream</param> /// <returns>The new content stream</returns> public override SparseStream OpenContent(SparseStream parent, Ownership ownsParent) { if (parent != null && ownsParent == Ownership.Dispose) { // Not needed until differencing disks supported. parent.Dispose(); } DiskStream stream = new DiskStream(_stream, Ownership.None, _header); stream.WriteOccurred += OnWriteOccurred; return stream; }