public override Stream Open()
{
Archive.Reader.BaseStream.Position = Offset;
byte[] inputData = Archive.Reader.ReadBytes(CompressedSize);
byte[] outputData = new byte[UncompressedSize];
int output = 0, input = 0;
int outputLength = outputData.Length, inputLength = inputData.Length;
while (input < inputData.Length) {
int count = (sbyte)inputData[input++];
if (count < 0) {
count = -count;
byte value = inputData[input++];
for (int index = 0; index < count; index++)
outputData[output++] = value;
} else {
count++;
for (int index = 0; index < count; index++)
outputData[output++] = inputData[input++];
}
}
if (output != outputData.Length)
throw new InvalidDataException();
return new MemoryStream(outputData);
}