internal static GranularLogDataMsg ReadFromNet(NetworkChannel ch, byte[] workingBuf, int startOffset) { int len = 52; ch.Read(workingBuf, startOffset, len); GranularLogDataMsg granularLogDataMsg = new GranularLogDataMsg(); BufDeserializer bufDeserializer = new BufDeserializer(workingBuf, startOffset); granularLogDataMsg.FlagsUsed = (GranularLogDataMsg.Flags)bufDeserializer.ExtractInt64(); granularLogDataMsg.RequestAckCounter = bufDeserializer.ExtractInt64(); granularLogDataMsg.LogDataLength = bufDeserializer.ExtractInt32(); if (granularLogDataMsg.LogDataLength > 1048576) { throw new NetworkCorruptDataException(ch.PartnerNodeName); } granularLogDataMsg.EmitContext = new JET_EMITDATACTX(); granularLogDataMsg.EmitContext.cbLogData = (long)granularLogDataMsg.LogDataLength; granularLogDataMsg.EmitContext.dwVersion = bufDeserializer.ExtractInt32(); granularLogDataMsg.EmitContext.qwSequenceNum = bufDeserializer.ExtractUInt64(); granularLogDataMsg.EmitContext.grbitOperationalFlags = (ShadowLogEmitGrbit)bufDeserializer.ExtractUInt32(); granularLogDataMsg.EmitContext.logtimeEmit = bufDeserializer.ExtractDateTime(); JET_LGPOS lgposLogData = default(JET_LGPOS); lgposLogData.lGeneration = bufDeserializer.ExtractInt32(); lgposLogData.isec = (int)bufDeserializer.ExtractUInt16(); lgposLogData.ib = (int)bufDeserializer.ExtractUInt16(); granularLogDataMsg.EmitContext.lgposLogData = lgposLogData; return(granularLogDataMsg); }
public void VerifyLgposCanBeSerialized() { var expected = new JET_LGPOS { lGeneration = 13 }; SerializeAndCompare(expected); }
public void JetLgposToString() { var lgpos = new JET_LGPOS { lGeneration = 1, isec = 0x1F, ib = 3 }; Assert.AreEqual("JET_LGPOS(0x1,1F,3)", lgpos.ToString()); }
public void JetBkinfoToString() { var bklogtime = new JET_BKLOGTIME(new DateTime(2010, 5, 31, 4, 44, 17, 678, DateTimeKind.Utc), true); var lgpos = new JET_LGPOS { lGeneration = 1, isec = 2, ib = 3 }; var bkinfo = new JET_BKINFO { bklogtimeMark = bklogtime, genHigh = 57, genLow = 36, lgposMark = lgpos }; Assert.AreEqual("JET_BKINFO(36-57:JET_LGPOS(0x1,2,3):JET_BKLOGTIME(17:44:4:31:5:110:0x4d:0xb))", bkinfo.ToString()); }
internal static BlockModeCompressedDataMsg ReadFromNet(NetworkChannel ch, byte[] workingBuf, int startOffset) { int len = 52; ch.Read(workingBuf, startOffset, len); BlockModeCompressedDataMsg blockModeCompressedDataMsg = new BlockModeCompressedDataMsg(); BufDeserializer bufDeserializer = new BufDeserializer(workingBuf, startOffset); blockModeCompressedDataMsg.FlagsUsed = (BlockModeCompressedDataMsg.Flags)bufDeserializer.ExtractInt64(); blockModeCompressedDataMsg.RequestAckCounter = bufDeserializer.ExtractInt64(); blockModeCompressedDataMsg.LogDataLength = bufDeserializer.ExtractInt32(); if (blockModeCompressedDataMsg.LogDataLength > 1048576) { throw new NetworkCorruptDataException(ch.PartnerNodeName); } blockModeCompressedDataMsg.EmitContext = new JET_EMITDATACTX(); blockModeCompressedDataMsg.EmitContext.cbLogData = (long)blockModeCompressedDataMsg.LogDataLength; blockModeCompressedDataMsg.EmitContext.dwVersion = bufDeserializer.ExtractInt32(); blockModeCompressedDataMsg.EmitContext.qwSequenceNum = bufDeserializer.ExtractUInt64(); blockModeCompressedDataMsg.EmitContext.grbitOperationalFlags = (ShadowLogEmitGrbit)bufDeserializer.ExtractUInt32(); blockModeCompressedDataMsg.EmitContext.logtimeEmit = bufDeserializer.ExtractDateTime(); JET_LGPOS lgposLogData = default(JET_LGPOS); lgposLogData.lGeneration = bufDeserializer.ExtractInt32(); lgposLogData.isec = (int)bufDeserializer.ExtractUInt16(); lgposLogData.ib = (int)bufDeserializer.ExtractUInt16(); blockModeCompressedDataMsg.EmitContext.lgposLogData = lgposLogData; if (blockModeCompressedDataMsg.LogDataLength > 0) { int num = BlockModeCompressedDataMsg.CalculateBlockCount(blockModeCompressedDataMsg.LogDataLength); blockModeCompressedDataMsg.CompressedLengths = new int[num]; len = num * 4; ch.Read(workingBuf, startOffset, len); bufDeserializer.Reset(workingBuf, startOffset); for (int i = 0; i < num; i++) { int num2 = bufDeserializer.ExtractInt32(); if (num2 <= 0 || num2 > 65536) { throw new NetworkCorruptDataException(ch.PartnerNodeName); } blockModeCompressedDataMsg.CompressedLengths[i] = num2; } } return(blockModeCompressedDataMsg); }
internal BlockModeCompressedDataMsg(NetworkChannel channel, byte[] packetContent) : base(channel, NetworkChannelMessage.MessageType.BlockModeCompressedData, packetContent) { this.FlagsUsed = (BlockModeCompressedDataMsg.Flags)base.Packet.ExtractInt64(); this.RequestAckCounter = base.Packet.ExtractInt64(); this.LogDataLength = base.Packet.ExtractInt32(); if (this.LogDataLength > 1048576) { throw new NetworkCorruptDataException(channel.PartnerNodeName); } this.EmitContext = new JET_EMITDATACTX(); this.EmitContext.cbLogData = (long)this.LogDataLength; this.EmitContext.dwVersion = base.Packet.ExtractInt32(); this.EmitContext.qwSequenceNum = base.Packet.ExtractUInt64(); this.EmitContext.grbitOperationalFlags = (ShadowLogEmitGrbit)base.Packet.ExtractUInt32(); this.EmitContext.logtimeEmit = base.Packet.ExtractDateTime(); JET_LGPOS lgposLogData = default(JET_LGPOS); lgposLogData.lGeneration = base.Packet.ExtractInt32(); lgposLogData.isec = (int)base.Packet.ExtractUInt16(); lgposLogData.ib = (int)base.Packet.ExtractUInt16(); this.EmitContext.lgposLogData = lgposLogData; if (this.LogDataLength > 0) { int num = BlockModeCompressedDataMsg.CalculateBlockCount(this.LogDataLength); this.CompressedLengths = new int[num]; for (int i = 0; i < num; i++) { int num2 = base.Packet.ExtractInt32(); if (num2 <= 0 || num2 > 65536) { throw new NetworkCorruptDataException(channel.PartnerNodeName); } this.CompressedLengths[i] = num2; } } }
public void JetBkinfoToString() { var bklogtime = new JET_BKLOGTIME(new DateTime(2010, 5, 31, 4, 44, 17, DateTimeKind.Utc), true); var lgpos = new JET_LGPOS { lGeneration = 1, isec = 2, ib = 3 }; var bkinfo = new JET_BKINFO { bklogtimeMark = bklogtime, genHigh = 57, genLow = 36, lgposMark = lgpos }; Assert.AreEqual("JET_BKINFO(36-57:JET_LGPOS(0x1,2,3):JET_BKLOGTIME(17:44:4:31:5:110:0x80:0x80))", bkinfo.ToString()); }
public void JetLgposToString() { var lgpos = new JET_LGPOS { lGeneration = 1, isec = 0x1F, ib = 3 }; Assert.AreEqual("JET_LGPOS(0x1,1F,3)", lgpos.ToString()); }