public RangeDecoder(ReaderNode stream) { mStream = stream; mBuffer = new byte[1]; Range = 0xFFFFFFFF; for (int i = 0; i < 5; i++) Code = (Code << 8) | ReadByte(); }
public override void SetInputStream(int index, ReaderNode stream, long length) { if (index != 0) throw new ArgumentOutOfRangeException(nameof(index)); if (stream == null) throw new ArgumentNullException(nameof(stream)); mInput = stream; }
public RangeDecoder(ReaderNode stream) { mStream = stream; mBuffer = new byte[1]; Range = 0xFFFFFFFF; for (int i = 0; i < 5; i++) { Code = (Code << 8) | ReadByte(); } }
public override void SetInputStream(int index, ReaderNode stream, long length) { if (index != 0) { throw new ArgumentOutOfRangeException(nameof(index)); } if (stream == null) { throw new ArgumentNullException(nameof(stream)); } mInput = stream; }
public void SetInput(ReaderNode stream, long length) { if (stream == null) { throw new ArgumentNullException(nameof(stream)); } if (mInput != null) { throw new InvalidOperationException(); } mInput = stream; mInputLength = length; }
public override void SetInputStream(int index, ReaderNode stream, long length) { if (stream == null) { throw new ArgumentNullException(nameof(stream)); } switch (index) { case 0: mMainStream = stream; break; case 1: mCallStream = stream; break; case 2: mJumpStream = stream; break; case 3: mRangeDecoder = new RangeDecoder(stream); break; default: throw new ArgumentOutOfRangeException(nameof(index)); } }
private static void SelectStream( ArchiveMetadata archiveMetadata, ArchiveDecoderSection sectionMetadata, DecoderInputMetadata selector, ReaderNode[] streams, DecoderNode[] decoders, out ReaderNode result, out long length) { var decoderIndex = selector.DecoderIndex; if (decoderIndex.HasValue) { length = sectionMetadata.Decoders[decoderIndex.Value].OutputStreams[selector.StreamIndex].Length; result = decoders[decoderIndex.Value].GetOutputStream(selector.StreamIndex); } else { length = archiveMetadata.FileSections[selector.StreamIndex].Length; result = streams[selector.StreamIndex]; } }
public override void SetInputStream(int index, ReaderNode stream, long length) { if (stream == null) throw new ArgumentNullException(nameof(stream)); switch (index) { case 0: mMainStream = stream; break; case 1: mCallStream = stream; break; case 2: mJumpStream = stream; break; case 3: mRangeDecoder = new RangeDecoder(stream); break; default: throw new ArgumentOutOfRangeException(nameof(index)); } }
public LzmaArchiveDecoder(ImmutableArray<byte> settings, long length) { mDecoder = new LZMA.Decoder(LZMA.DecoderSettings.CreateFrom(settings)); mOutput = new OutputStream(this); mOutputLength = length; }
public abstract void SetInputStream(int index, ReaderNode stream, long length);
public ArchiveSectionDecoder(Stream stream, ArchiveMetadata metadata, int index, PasswordStorage password) { if (stream == null) { throw new ArgumentNullException(nameof(stream)); } if (!stream.CanRead) { throw new ArgumentException("Stream must be readable.", nameof(stream)); } if (!stream.CanSeek) { throw new ArgumentException("Stream must be seekable.", nameof(stream)); } if (metadata == null) { throw new ArgumentNullException(nameof(metadata)); } if (index < 0 || index >= metadata.DecoderSections.Length) { throw new ArgumentOutOfRangeException(nameof(index)); } var inputCoordinator = new StreamCoordinator(stream); var inputStreams = new ReaderNode[metadata.FileSections.Length]; for (int i = 0; i < inputStreams.Length; i++) { inputStreams[i] = new CoordinatedStream(inputCoordinator, metadata.FileSections[i].Offset, metadata.FileSections[i].Length); } var decoderSection = metadata.DecoderSections[index]; var decoderDefinitions = decoderSection.Decoders; var decoders = new DecoderNode[decoderDefinitions.Length]; for (int i = 0; i < decoders.Length; i++) { var decoderDefinition = decoderDefinitions[i]; decoders[i] = decoderDefinition.DecoderType.CreateDecoder(decoderDefinition.Settings, decoderDefinition.OutputStreams, password); } for (int i = 0; i < decoders.Length; i++) { var decoder = decoders[i]; var decoderDefinition = decoderDefinitions[i]; var decoderInputDefinitions = decoderDefinition.InputStreams; for (int j = 0; j < decoderInputDefinitions.Length; j++) { ReaderNode inputStream; long inputLength; SelectStream(metadata, decoderSection, decoderInputDefinitions[j], inputStreams, decoders, out inputStream, out inputLength); decoder.SetInputStream(j, inputStream, inputLength); } } ReaderNode outputStream; long outputLength; SelectStream(metadata, decoderSection, decoderSection.DecodedStream, inputStreams, decoders, out outputStream, out outputLength); mCoordinator = inputCoordinator; mInputStreams = inputStreams; mDecoders = decoders; mOutputStream = outputStream; }
public ArchiveSectionDecoder(Stream stream, ArchiveMetadata metadata, int index, PasswordStorage password) { if (stream == null) throw new ArgumentNullException(nameof(stream)); if (!stream.CanRead) throw new ArgumentException("Stream must be readable.", nameof(stream)); if (!stream.CanSeek) throw new ArgumentException("Stream must be seekable.", nameof(stream)); if (metadata == null) throw new ArgumentNullException(nameof(metadata)); if (index < 0 || index >= metadata.DecoderSections.Length) throw new ArgumentOutOfRangeException(nameof(index)); var inputCoordinator = new StreamCoordinator(stream); var inputStreams = new ReaderNode[metadata.FileSections.Length]; for (int i = 0; i < inputStreams.Length; i++) inputStreams[i] = new CoordinatedStream(inputCoordinator, metadata.FileSections[i].Offset, metadata.FileSections[i].Length); var decoderSection = metadata.DecoderSections[index]; var decoderDefinitions = decoderSection.Decoders; var decoders = new DecoderNode[decoderDefinitions.Length]; for (int i = 0; i < decoders.Length; i++) { var decoderDefinition = decoderDefinitions[i]; decoders[i] = decoderDefinition.DecoderType.CreateDecoder(decoderDefinition.Settings, decoderDefinition.OutputStreams, password); } for (int i = 0; i < decoders.Length; i++) { var decoder = decoders[i]; var decoderDefinition = decoderDefinitions[i]; var decoderInputDefinitions = decoderDefinition.InputStreams; for (int j = 0; j < decoderInputDefinitions.Length; j++) { ReaderNode inputStream; long inputLength; SelectStream(metadata, decoderSection, decoderInputDefinitions[j], inputStreams, decoders, out inputStream, out inputLength); decoder.SetInputStream(j, inputStream, inputLength); } } ReaderNode outputStream; long outputLength; SelectStream(metadata, decoderSection, decoderSection.DecodedStream, inputStreams, decoders, out outputStream, out outputLength); mCoordinator = inputCoordinator; mInputStreams = inputStreams; mDecoders = decoders; mOutputStream = outputStream; }
public LzmaArchiveDecoder(ImmutableArray <byte> settings, long length) { mDecoder = new LZMA.Decoder(LZMA.DecoderSettings.CreateFrom(settings)); mOutput = new OutputStream(this); mOutputLength = length; }
public void SetInput(ReaderNode stream, long length) { if (stream == null) throw new ArgumentNullException(nameof(stream)); if (mInput != null) throw new InvalidOperationException(); mInput = stream; mInputLength = length; }