123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- using System.IO;
- using System;
- namespace SevenZip
- {
-
-
-
- internal class ArchiveEmulationStreamProxy : Stream, IDisposable
- {
-
-
-
- public int Offset { get; private set; }
-
-
-
- public Stream Source { get; private set; }
-
-
-
-
-
- public ArchiveEmulationStreamProxy(Stream stream, int offset)
- {
- Source = stream;
- Offset = offset;
- Source.Position = offset;
- }
- public override bool CanRead
- {
- get { return Source.CanRead; }
- }
- public override bool CanSeek
- {
- get { return Source.CanSeek; }
- }
- public override bool CanWrite
- {
- get { return Source.CanWrite; }
- }
- public override void Flush()
- {
- Source.Flush();
- }
- public override long Length
- {
- get { return Source.Length - Offset; }
- }
- public override long Position
- {
- get
- {
- return Source.Position - Offset;
- }
- set
- {
- Source.Position = value;
- }
- }
- public override int Read(byte[] buffer, int offset, int count)
- {
- return Source.Read(buffer, offset, count);
- }
- public override long Seek(long offset, SeekOrigin origin)
- {
- return Source.Seek(origin == SeekOrigin.Begin ? offset + Offset : offset,
- origin) - Offset;
- }
- public override void SetLength(long value)
- {
- Source.SetLength(value);
- }
- public override void Write(byte[] buffer, int offset, int count)
- {
- Source.Write(buffer, offset, count);
- }
- public new void Dispose()
- {
- Source.Dispose();
- }
- public override void Close()
- {
- Source.Close();
- }
- }
- }
|