예제 #1
0
        public void DeserializeLocal(BinaryReader reader)
        {
            isUserMsg = true;
            reader.BaseStream.Position = 0;
            byte      flags  = reader.ReadByte();
            FlagsByte bFlags = new FlagsByte();

            bFlags.DataByte = flags;
            //Headers are in sequence 1. COR  2. TOTAL 3. TCP
            headers = new Hashtable();
            if (bFlags.AnyOn(FlagsByte.Flag.COR))
            {
                RequestCorrelator.HDR corHdr = new RequestCorrelator.HDR();
                corHdr.DeserializeLocal(reader);
                headers.Add(HeaderType.REQUEST_COORELATOR, corHdr);
            }

            if (bFlags.AnyOn(FlagsByte.Flag.TOTAL))
            {
                TOTAL.HDR totalHdr = new TOTAL.HDR();
                totalHdr.DeserializeLocal(reader);
                headers.Add(HeaderType.TOTAL, totalHdr);
            }

            if (bFlags.AnyOn(FlagsByte.Flag.TCP))
            {
                TcpHeader tcpHdr = new TcpHeader();
                tcpHdr.DeserializeLocal(reader);
                headers.Add(HeaderType.TCP, tcpHdr);
            }

            prio = (Priority)Enum.ToObject(typeof(Priority), reader.ReadInt16());
            handledAsynchronously = reader.ReadBoolean();
            long ticks = reader.ReadInt64();

            arrivalTime      = new DateTime(ticks);
            ticks            = reader.ReadInt64();
            sendTime         = new DateTime(ticks);
            responseExpected = reader.ReadBoolean();
            _type            = reader.ReadByte();

            length = reader.ReadInt32();
            buf    = (byte[])reader.ReadBytes(length);
        }
예제 #2
0
        public void DeserializeLocal(BinaryReader reader)
        {
            isUserMsg = true;
            reader.BaseStream.Position -= 1;
            byte      flags  = reader.ReadByte();
            FlagsByte bFlags = new FlagsByte();

            bFlags.DataByte = flags;
            //Headers are in sequence 1. COR  2. TOTAL 3. TCP
            headers = new Hashtable();
            if (bFlags.AnyOn(FlagsByte.Flag.COR))
            {
                RequestCorrelatorHDR corHdr = new RequestCorrelatorHDR();
                corHdr.DeserializeLocal(reader);
                headers.Add(HeaderType.REQUEST_COORELATOR, corHdr);
            }

            if (bFlags.AnyOn(FlagsByte.Flag.TOTAL))
            {
                HDR totalHdr = new HDR();
                totalHdr.DeserializeLocal(reader);
                headers.Add(HeaderType.TOTAL, totalHdr);
            }

            if (bFlags.AnyOn(FlagsByte.Flag.TCP))
            {
                TcpHeader tcpHdr = new TcpHeader();
                tcpHdr.DeserializeLocal(reader);
                headers.Add(HeaderType.TCP, tcpHdr);
            }

            prio = (Priority)Enum.ToObject(typeof(Priority), reader.ReadInt16());
            handledAsynchronously = reader.ReadBoolean();
            long ticks = reader.ReadInt64();

            arrivalTime      = new DateTime(ticks);
            ticks            = reader.ReadInt64();
            sendTime         = new DateTime(ticks);
            responseExpected = reader.ReadBoolean();
            _type            = reader.ReadByte();
            //bool st = reader.ReadBoolean();
            //if(st)
            //    _stackTrace = CompactBinaryFormatter.Deserialize(reader.BaseStream,  null,false) as Hashtable;

            //st = reader.ReadBoolean();
            //if (st)
            //    _stackTrace2 = CompactBinaryFormatter.Deserialize(reader.BaseStream, null, false) as Hashtable;

            //Console.WriteLine("4:                                                   " + TimeStats.FormatNOW());

            bool bufferNotNull = reader.ReadBoolean();

            length = reader.ReadInt32();
            if (bufferNotNull)
            {
                buf = (byte[])reader.ReadBytes(length);
            }

            bool bufferListNotNull = reader.ReadBoolean();
            int  bufferCount       = reader.ReadInt32();

            if (bufferListNotNull)
            {
                buffers = new ClusteredArrayList(bufferCount);

                for (int i = 0; i < bufferCount; i++)
                {
                    buffers.Add(reader.ReadBytes(reader.ReadInt32()));
                }
            }


            //Console.WriteLine("5:                                                   " + TimeStats.FormatNOW());
            //length = (buf != null) ? buf.Length : 0;
        }