// Token: 0x060017CF RID: 6095 RVA: 0x000624DC File Offset: 0x000606DC
        protected void WriteXpressBlock(byte[] buf, int offset, int length)
        {
            int num;

            Xpress.Compress(buf, offset, length, this.CompressBuf, 5, 65536, out num);
            this.CompressBuf[0] = 2;
            int    num2 = 1;
            ushort val  = (ushort)(num - 1);

            Serialization.SerializeUInt16(this.CompressBuf, ref num2, val);
            val = (ushort)(length - 1);
            Serialization.SerializeUInt16(this.CompressBuf, ref num2, val);
            this.m_tcpChannel.Write(this.CompressBuf, 0, 5 + num);
        }
Exemple #2
0
        public static int SerializeToBuffer(JET_EMITDATACTX emitContext, byte[] logdata, int cblogdata, byte[] targetBuffer, int targetBufferOffsetToStart, out int totalCompressedSize)
        {
            NetworkChannelPacket networkChannelPacket = new NetworkChannelPacket(targetBuffer, targetBufferOffsetToStart);

            networkChannelPacket.GrowthDisabled = true;
            int num = BlockModeCompressedDataMsg.CalculateBlockCount(cblogdata);

            int[] array = new int[num];
            int   num2  = 73 + 4 * num;
            int   num3  = num2 + targetBufferOffsetToStart;
            int   num4  = 0;

            totalCompressedSize = 0;
            int num5 = cblogdata;

            for (int i = 0; i < num; i++)
            {
                int num6 = Math.Min(num5, 65536);
                Xpress.Compress(logdata, num4, num6, targetBuffer, num3, num6, out array[i]);
                num4 += num6;
                num3 += array[i];
                totalCompressedSize += array[i];
                num5 -= num6;
            }
            networkChannelPacket.Append(1);
            int val = num2 - 5 + totalCompressedSize;

            networkChannelPacket.Append(val);
            val = 1145261378;
            networkChannelPacket.Append(val);
            val = num2 - 5;
            networkChannelPacket.Append(val);
            DateTime utcNow = DateTime.UtcNow;

            networkChannelPacket.Append(utcNow);
            long val2 = 0L;

            networkChannelPacket.Append(val2);
            val2 = Win32StopWatch.GetSystemPerformanceCounter();
            networkChannelPacket.Append(val2);
            networkChannelPacket.Append(cblogdata);
            val = emitContext.dwVersion;
            networkChannelPacket.Append(val);
            val2 = (long)emitContext.qwSequenceNum;
            networkChannelPacket.Append(val2);
            val = (int)emitContext.grbitOperationalFlags;
            networkChannelPacket.Append(val);
            DateTime time = DateTime.SpecifyKind(emitContext.logtimeEmit, DateTimeKind.Utc);

            networkChannelPacket.Append(time);
            val = emitContext.lgposLogData.lGeneration;
            networkChannelPacket.Append(val);
            ushort val3 = (ushort)emitContext.lgposLogData.isec;

            networkChannelPacket.Append(val3);
            val3 = (ushort)emitContext.lgposLogData.ib;
            networkChannelPacket.Append(val3);
            for (int j = 0; j < num; j++)
            {
                networkChannelPacket.Append(array[j]);
            }
            return(num2 + totalCompressedSize);
        }