From 86b5245261aee28a84f9fb27377c6490530d3640 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sun, 19 Apr 2026 13:34:50 +0100 Subject: [PATCH] Add constructor to ForcedSeekStream for initializing with a pre-created stream --- Aaru.Helpers/IO/ForcedSeekStream.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Aaru.Helpers/IO/ForcedSeekStream.cs b/Aaru.Helpers/IO/ForcedSeekStream.cs index 79eed470e..377e236b0 100644 --- a/Aaru.Helpers/IO/ForcedSeekStream.cs +++ b/Aaru.Helpers/IO/ForcedSeekStream.cs @@ -59,6 +59,19 @@ public sealed class ForcedSeekStream : Stream where T : Stream CalculateLength(); } + /// Initializes a new instance of the class. + /// A pre-created stream instance. + /// + public ForcedSeekStream(long length, T stream) + { + _streamLength = length; + _baseStream = stream; + _backFile = Path.GetTempFileName(); + _backStream = new FileStream(_backFile, FileMode.Open, FileAccess.ReadWrite, FileShare.None); + + if(length == 0) CalculateLength(); + } + /// Initializes a new instance of the class. /// The real (uncompressed) length of the stream. /// Parameters that are used to create the base stream.