// Token: 0x06000D56 RID: 3414 RVA: 0x00038250 File Offset: 0x00036450
        public byte[] Decompress(byte[] compressedData, int decompressedDataSize)
        {
            if (decompressedDataSize > this.uncompressedBuffer.Size)
            {
                throw new ArgumentException("decompressedDataSize > uncompressedBuffer.Size");
            }
            this.compressedBuffer.CopyIn(compressedData);
            uint num = LzxInterop.ApplyRawLzxPatchToBuffer(IntPtr.Zero, 0, this.compressedBuffer.Buffer, compressedData.Length, this.uncompressedBuffer.Buffer, decompressedDataSize);

            if (num != 0U)
            {
                DataCompression.Tracer.TraceError <int, uint>((long)this.GetHashCode(), "DataCompression: ApplyRawLzxPatchToBuffer failed to decompress {0} bytes, error: {1}", compressedData.Length, num);
                throw new Win32Exception((int)num, "ApplyRawLzxPatchToBuffer");
            }
            DataCompression.Tracer.TraceDebug <int, int>((long)this.GetHashCode(), "DataCompression: decompressed input of {0} bytes into {1} bytes", compressedData.Length, decompressedDataSize);
            return(this.uncompressedBuffer.CopyOut(decompressedDataSize));
        }
Example #2
0
        // Token: 0x06000D5C RID: 3420 RVA: 0x00038470 File Offset: 0x00036670
        public byte[] Apply(byte[] oldData, byte[] patchData, int newDataSize)
        {
            if (newDataSize > this.newBuffer.Size)
            {
                throw new ArgumentException("newDataSize > newBuffer.Size");
            }
            this.oldBuffer.CopyIn(oldData);
            this.patchBuffer.CopyIn(patchData);
            uint num = LzxInterop.ApplyRawLzxPatchToBuffer(this.oldBuffer.Buffer, oldData.Length, this.patchBuffer.Buffer, patchData.Length, this.newBuffer.Buffer, newDataSize);

            if (num != 0U)
            {
                DataPatching.Tracer.TraceError((long)this.GetHashCode(), "DataPatching: ApplyRawLzxPatchToBuffer failed to apply patch of {0} bytes to old data of {1} bytes and generate new data of {2} bytes, error: {3}", new object[]
                {
                    oldData.Length,
                    patchData.Length,
                    newDataSize,
                    num
                });
                throw new Win32Exception((int)num, "ApplyRawLzxPatchToBuffer");
            }
            DataPatching.Tracer.TraceDebug <int, int, int>((long)this.GetHashCode(), "DataPatching: applied patch of {0} bytes to old data of {1} bytes and generated new data of {2} bytes", patchData.Length, oldData.Length, newDataSize);
            return(this.newBuffer.CopyOut(newDataSize));
        }