/// <summary> /// Constructor /// </summary> /// <param name="owner">Owner of memory</param> /// <param name="fileOffset">File offset of data</param> /// <param name="baseAddr">Address of data</param> /// <param name="length">Length of data</param> public unsafe UnmanagedMemoryImageStream(UnmanagedMemoryStreamCreator owner, FileOffset fileOffset, long baseAddr, long length) { this.fileOffset = fileOffset; this.startAddr = baseAddr; this.endAddr = baseAddr + length; this.currentAddr = this.startAddr; this.owner = owner; }
/// <summary> /// Constructor /// </summary> /// <param name="owner">Owner of memory</param> /// <param name="fileOffset">File offset of data</param> /// <param name="baseAddr">Address of data</param> /// <param name="length">Length of data</param> public unsafe UnmanagedMemoryImageStream(UnmanagedMemoryStreamCreator owner, FileOffset fileOffset, long baseAddr, long length) { this.fileOffset = fileOffset; this.startAddr = baseAddr; this.endAddr = baseAddr + length; this.currentAddr = this.startAddr; this.owner = owner; }
/// <summary> /// Constructor /// </summary> /// <param name="owner">Owner of memory</param> /// <param name="fileOffset">File offset of data</param> /// <param name="baseAddr">Address of data</param> /// <param name="length">Length of data</param> public UnmanagedMemoryImageStream(UnmanagedMemoryStreamCreator owner, FileOffset fileOffset, long baseAddr, long length) { FileOffset = fileOffset; startAddr = baseAddr; endAddr = baseAddr + length; currentAddr = startAddr; this.owner = owner; }
/// <inheritdoc/> public void Dispose() { fileOffset = 0; startAddr = 0; endAddr = 0; currentAddr = 0; if (ownOwner && owner != null) { owner.Dispose(); } owner = null; }
/// <inheritdoc/> public void Dispose() { fileOffset = 0; startAddr = null; endAddr = null; currentAddr = null; if (creator != null) { creator.Dispose(); } creator = null; }
/// <summary> /// Saves <paramref name="creator"/> in this instance so it doesn't get garbage collected. /// </summary> /// <param name="creator">A <see cref="UnmanagedMemoryStreamCreator"/> instance</param> internal UnmanagedMemoryImageStream(UnmanagedMemoryStreamCreator creator) : this(creator, 0, 0, creator.Length) { this.ownOwner = true; }
/// <summary> /// Saves <paramref name="creator"/> in this instance so it doesn't get garbage collected. /// </summary> /// <param name="creator">A <see cref="UnmanagedMemoryStreamCreator"/> instance</param> internal UnmanagedMemoryImageStream(UnmanagedMemoryStreamCreator creator) : this(0, creator.Address, creator.Length) { this.creator = creator; }
/// <inheritdoc/> public void Dispose() { fileOffset = 0; startAddr = null; endAddr = null; currentAddr = null; if (creator != null) creator.Dispose(); creator = null; }
/// <summary> /// Saves <paramref name="creator"/> in this instance so it doesn't get garbage collected. /// </summary> /// <param name="creator">A <see cref="UnmanagedMemoryStreamCreator"/> instance</param> internal UnmanagedMemoryImageStream(UnmanagedMemoryStreamCreator creator) : this(0, creator.Address, creator.Length) { this.creator = creator; }
/// <summary> /// Saves <paramref name="creator"/> in this instance so it doesn't get garbage collected. /// </summary> /// <param name="creator">A <see cref="UnmanagedMemoryStreamCreator"/> instance</param> internal UnmanagedMemoryImageStream(UnmanagedMemoryStreamCreator creator) : this(creator, 0, 0, creator.Length) { this.ownOwner = true; }
/// <inheritdoc/> public void Dispose() { fileOffset = 0; startAddr = 0; endAddr = 0; currentAddr = 0; if (ownOwner && owner != null) owner.Dispose(); owner = null; }