public byte[] Compress(byte[] Source) { byte[] array = new byte[Source.Length + 400]; uint num = (uint)((int)QuickLZ.qlz_compress(Source, array, (IntPtr)Source.Length, this.state_compress)); byte[] array2 = new byte[num]; Array.Copy(array, array2, (long)((ulong)num)); return(array2); }
public QuickLZ() { this.state_compress = new byte[QuickLZ.qlz_get_setting(1)]; if (this.QLZ_STREAMING_BUFFER == 0u) { this.state_decompress = this.state_compress; return; } this.state_decompress = new byte[QuickLZ.qlz_get_setting(2)]; }
internal byte[] ReadObjectData() { byte[] array = new byte[this.objLength]; this.file.ReadBuffer(array, this.position + (long)this.keyLength, this.objLength); if (this.compressionLevel == 0) { return(array); } QuickLZ quickLZ = new QuickLZ(); return(quickLZ.Decompress(array)); }
internal byte[] WriteObjectData() { MemoryStream memoryStream = new MemoryStream(); BinaryWriter writer = new BinaryWriter(memoryStream); ObjectStreamer objectStreamer = this.file.streamerManager.streamerByType[this.obj.GetType()]; objectStreamer.Write(writer, this.obj); byte[] array = memoryStream.ToArray(); if (this.compressionLevel == 0) { return(array); } QuickLZ quickLZ = new QuickLZ(); return(quickLZ.Compress(array)); }
internal override void Write(BinaryWriter writer) { MemoryStream memoryStream = new MemoryStream(); BinaryWriter writer2 = new BinaryWriter(memoryStream); for (int i = 0; i < this.count; i++) { this.file.streamerManager.Serialize(writer2, this.objects[i]); } byte[] array = memoryStream.ToArray(); if (this.compressionLevel != 0) { QuickLZ quickLZ = new QuickLZ(); array = quickLZ.Compress(array); } this.keyLength = 77; this.objLength = array.Length; if (this.recLength == -1) { this.recLength = this.keyLength + this.objLength; } writer.Write(this.label); writer.Write(this.deleted); writer.Write(this.dateTime.Ticks); writer.Write(this.position); writer.Write(this.keyLength); writer.Write(this.objLength); writer.Write(this.recLength); writer.Write(this.compressionMethod); writer.Write(this.compressionLevel); writer.Write(this.typeId); writer.Write(this.size); writer.Write(this.count); writer.Write(this.dateTime1.Ticks); writer.Write(this.dateTime2.Ticks); writer.Write(this.prev); writer.Write(this.next); writer.Write(array, 0, array.Length); }
public uint SizeDecompressed(byte[] Source) { return((uint)((int)QuickLZ.qlz_size_decompressed(Source))); }
public byte[] Decompress(byte[] Source) { byte[] array = new byte[(int)QuickLZ.qlz_size_decompressed(Source)]; qlz_decompress(Source, array, state_decompress); return(array); }