public string ExtractString()
        {
            ushort num  = this.ExtractUInt16();
            int    num2 = this.Length - this.Position;

            if ((int)num > num2)
            {
                NetworkChannel.StaticTraceError("ExtractString: {0} exceeds max string len: {1}", new object[]
                {
                    num,
                    num2
                });
                throw new NetworkCorruptDataGenericException();
            }
            string result;

            if (num > 0)
            {
                result           = NetworkChannelPacket.DecodeString(this.m_buf, this.Position, (int)num);
                this.m_position += (int)num;
            }
            else
            {
                result = string.Empty;
            }
            return(result);
        }
        // Token: 0x0600228E RID: 8846 RVA: 0x000A0EC8 File Offset: 0x0009F0C8
        public static byte[] SerializeToBytes(PassiveStatusMsg.Flags msgFlags, long ackCounter, uint genInNetworkBuffer, uint genWrittenToInspector, uint lastGenInspected, uint lastGenReplayed, bool isCrossSite)
        {
            NetworkChannelPacket networkChannelPacket = new NetworkChannelPacket(54);

            networkChannelPacket.GrowthDisabled = true;
            networkChannelPacket.Append(1);
            int val = 49;

            networkChannelPacket.Append(val);
            val = 1096045392;
            networkChannelPacket.Append(val);
            val = 49;
            networkChannelPacket.Append(val);
            DateTime utcNow = DateTime.UtcNow;

            networkChannelPacket.Append(utcNow);
            networkChannelPacket.Append((long)msgFlags);
            networkChannelPacket.Append(ackCounter);
            networkChannelPacket.Append(genInNetworkBuffer);
            networkChannelPacket.Append(genWrittenToInspector);
            networkChannelPacket.Append(lastGenInspected);
            networkChannelPacket.Append(lastGenReplayed);
            networkChannelPacket.Append(isCrossSite);
            return(networkChannelPacket.Buffer);
        }
        public void AppendByteArray(byte[] bytes)
        {
            int num = bytes.Length;

            NetworkChannelPacket.CheckByteArrayLen(num);
            this.Append(num);
            this.Append(bytes, 0, num);
        }
예제 #4
0
        public static void SerializeHeaderToBuffer(NetworkChannelMessage.MessageType msgType, int totalSize, byte[] targetBuffer, int targetBufferOffsetToStart)
        {
            NetworkChannelPacket networkChannelPacket = new NetworkChannelPacket(targetBuffer, targetBufferOffsetToStart);

            networkChannelPacket.GrowthDisabled = true;
            networkChannelPacket.Append(1);
            int val = totalSize - 5;

            networkChannelPacket.Append(val);
            networkChannelPacket.Append((int)msgType);
            networkChannelPacket.Append(val);
            networkChannelPacket.Append(DateTime.UtcNow);
        }
        public void Append(string str)
        {
            ushort num = 0;

            if (str != null)
            {
                byte[] array       = NetworkChannelPacket.EncodeString(str);
                int    expectedLen = array.Length;
                num = NetworkChannelPacket.CheckStringLen(expectedLen);
                this.Append(num);
                this.Append(array, (int)num);
                return;
            }
            this.Append(num);
        }
예제 #6
0
        // Token: 0x06002276 RID: 8822 RVA: 0x000A0724 File Offset: 0x0009E924
        public static void SerializeToBuffer(int expectedTotalSize, GranularLogDataMsg.Flags msgFlags, JET_EMITDATACTX emitContext, byte[] logdata, int cblogdata, byte[] targetBuffer, int targetBufferOffsetToStart)
        {
            NetworkChannelPacket networkChannelPacket = new NetworkChannelPacket(targetBuffer, targetBufferOffsetToStart);

            networkChannelPacket.GrowthDisabled = true;
            networkChannelPacket.Append(1);
            int val = expectedTotalSize - 5;

            networkChannelPacket.Append(val);
            val = 1312903751;
            networkChannelPacket.Append(val);
            val = expectedTotalSize - 5;
            networkChannelPacket.Append(val);
            DateTime utcNow = DateTime.UtcNow;

            networkChannelPacket.Append(utcNow);
            networkChannelPacket.Append((long)msgFlags);
            long 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);
            if (cblogdata > 0)
            {
                networkChannelPacket.Append(logdata, 0, cblogdata);
            }
        }
예제 #7
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);
        }