diff --git a/src/SharpCompress/Compressors/LZMA/ICoder.cs b/src/SharpCompress/Compressors/LZMA/ICoder.cs index f5049dd7..3ae84f48 100644 --- a/src/SharpCompress/Compressors/LZMA/ICoder.cs +++ b/src/SharpCompress/Compressors/LZMA/ICoder.cs @@ -25,7 +25,7 @@ public InvalidParamException() } } - internal interface ICodeProgress + public interface ICodeProgress { /// /// Callback progress. @@ -169,4 +169,4 @@ internal interface ISetDecoderProperties { void SetDecoderProperties(byte[] properties); } -} \ No newline at end of file +} diff --git a/src/SharpCompress/Compressors/LZMA/LzmaDecoder.cs b/src/SharpCompress/Compressors/LZMA/LzmaDecoder.cs index ee595e68..f54c2bf7 100644 --- a/src/SharpCompress/Compressors/LZMA/LzmaDecoder.cs +++ b/src/SharpCompress/Compressors/LZMA/LzmaDecoder.cs @@ -7,7 +7,7 @@ namespace SharpCompress.Compressors.LZMA { - internal class Decoder : ICoder, ISetDecoderProperties // ,System.IO.Stream + public class Decoder : ICoder, ISetDecoderProperties // ,System.IO.Stream { private class LenDecoder { diff --git a/src/SharpCompress/IO/SourceStream.cs b/src/SharpCompress/IO/SourceStream.cs index 71918c81..e23f7eb7 100644 --- a/src/SharpCompress/IO/SourceStream.cs +++ b/src/SharpCompress/IO/SourceStream.cs @@ -143,9 +143,17 @@ public override int Read(byte[] buffer, int offset, int count) if (!IsVolumes && count != 0 && Current.Position == Current.Length) { - _prevSize += Current.Length; - if (!SetStream(_stream + 1)) //will load next file if present + var length = Current.Length; + + // Load next file if present + if (!SetStream(_stream + 1)) + { break; + } + + // Current stream switched + // Add length of previous stream + _prevSize += length; Current.Seek(0, SeekOrigin.Begin); } } diff --git a/src/SharpCompress/Utility.cs b/src/SharpCompress/Utility.cs index 28979d9d..cbdb1ecb 100644 --- a/src/SharpCompress/Utility.cs +++ b/src/SharpCompress/Utility.cs @@ -170,10 +170,8 @@ public static bool Find(this Stream source, byte[] array) byte[] buffer = GetTransferByteArray(); try { - var pos = source.Position; int count = 0; var len = source.Read(buffer, 0, buffer.Length); - source.Position = pos + len; do {