コード例 #1
0
        // 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));
        }
コード例 #2
0
        // Token: 0x06000D55 RID: 3413 RVA: 0x00038190 File Offset: 0x00036390
        public bool TryCompress(byte[] uncompressedData, out byte[] compressedData)
        {
            this.uncompressedBuffer.CopyIn(uncompressedData);
            int  num2;
            uint num  = LzxInterop.RawLzxCompressBuffer(this.uncompressedBuffer.Buffer, uncompressedData.Length, this.compressedBuffer.Buffer, this.compressedBuffer.Size, out num2);
            uint num3 = num;

            if (num3 == 0U)
            {
                DataCompression.Tracer.TraceDebug <int, int>((long)this.GetHashCode(), "DataCompression: compressed input of {0} bytes into {1} bytes", uncompressedData.Length, num2);
                compressedData = this.compressedBuffer.CopyOut(num2);
                return(true);
            }
            if (num3 != 122U)
            {
                DataCompression.Tracer.TraceError <int, uint>((long)this.GetHashCode(), "DataCompression: RawLzxCompressBuffer failed to compress {0} bytes, error: {0}", uncompressedData.Length, num);
                throw new Win32Exception((int)num, "RawLzxCompressBuffer");
            }
            DataCompression.Tracer.TraceDebug <int, int>((long)this.GetHashCode(), "DataCompression: unable to compressed input of {0} bytes into {1} bytes because output buffer is not large enough.", uncompressedData.Length, num2);
            compressedData = null;
            return(false);
        }
コード例 #3
0
        // Token: 0x06000D5B RID: 3419 RVA: 0x0003838C File Offset: 0x0003658C
        public bool TryGenerate(byte[] oldData, byte[] newData, out byte[] patchData)
        {
            this.oldBuffer.CopyIn(oldData);
            this.newBuffer.CopyIn(newData);
            int  num2;
            uint num  = LzxInterop.CreateRawLzxPatchDataFromBuffers(this.oldBuffer.Buffer, oldData.Length, this.newBuffer.Buffer, newData.Length, this.patchBuffer.Buffer, this.patchBuffer.Size, out num2);
            uint num3 = num;

            if (num3 == 0U)
            {
                DataPatching.Tracer.TraceDebug <int, int, int>((long)this.GetHashCode(), "DataPatching: generated patch of {0} bytes from old data of {1} bytes and new data of {2} bytes", num2, oldData.Length, newData.Length);
                patchData = this.patchBuffer.CopyOut(num2);
                return(true);
            }
            if (num3 != 122U)
            {
                DataPatching.Tracer.TraceError <int, int, uint>((long)this.GetHashCode(), "DataPatching: CreateRawLzxPatchDataFromBuffers failed to generate patch from old data of {0} bytes and new data of {1} bytes, error: {2}", oldData.Length, newData.Length, num);
                throw new Win32Exception((int)num, "CreateRawLzxPatchDataFromBuffers");
            }
            DataPatching.Tracer.TraceDebug <int, int>((long)this.GetHashCode(), "DataPatching: unable to generated patch from from old data of {0} bytes and new data of {1} bytes because patch buffer is not large enough.", oldData.Length, newData.Length);
            patchData = null;
            return(false);
        }
コード例 #4
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));
        }