WriteFinish() public method

public WriteFinish ( ) : byte[]
return byte[]
示例#1
0
 public override byte[] Encode(G2Protocol protocol)
 {
     lock (protocol.WriteSection)
     {
         protocol.WritePacket(null, PacketType.Padding, Filler);
         return protocol.WriteFinish();
     }
 }
示例#2
0
 public override byte[] Encode(G2Protocol protocol)
 {
     lock (protocol.WriteSection)
     {
         protocol.WritePacket(null, PacketType.Padding, Filler);
         return(protocol.WriteFinish());
     }
 }
示例#3
0
        public override byte[] Encode(G2Protocol protocol)
        {
            lock (protocol.WriteSection)
            {
                var dat = protocol.WritePacket(null, PacketType.Dat, null);

                protocol.WritePacket(dat, Packet_Pos, BitConverter.GetBytes(Pos));
                protocol.WritePacket(dat, Packet_Data, Data);

                return(protocol.WriteFinish());
            }
        }
示例#4
0
        public override byte[] Encode(G2Protocol protocol)
        {
            lock (protocol.WriteSection)
            {
                var sync = protocol.WritePacket(null, PacketType.Sync, null);

                AddSet(protocol, sync, Packet_FunctionHit, FunctionHits);
                AddSet(protocol, sync, Packet_ExceptionHit, ExceptionHits);
                AddSet(protocol, sync, Packet_ConstructedHit, ConstructedHits);
                AddSet(protocol, sync, Packet_DisposedHit, DisposeHits);

                AddPairs(protocol, sync, Packet_NewCalls, NewCalls);
                AddSet(protocol, sync, Packet_CallHits, CallHits);

                if (CallStats != null)
                {
                    protocol.WritePacket(sync, Packet_CallStats, CallStats.ToBytes());
                }

                AddPairs(protocol, sync, Packet_Inits, Inits);

                if (NewThreads != null)
                {
                    foreach (var item in NewThreads)
                    {
                        var keyValuePair = protocol.WritePacket(sync, Packet_NewThreads, null);
                        protocol.WritePacket(keyValuePair, ChildPacket_ThreadID, BitConverter.GetBytes(item.Key));
                        protocol.WritePacket(keyValuePair, ChildPacket_ThreadName, UTF8Encoding.UTF8.GetBytes(item.Value.Item1));
                        protocol.WritePacket(keyValuePair, ChildPacket_ThreadAlive, BitConverter.GetBytes(item.Value.Item2));
                    }
                }

                if (ThreadChanges != null)
                {
                    foreach (var item in ThreadChanges)
                    {
                        var keyValuePair = protocol.WritePacket(sync, Packet_ThreadChanges, null);
                        protocol.WritePacket(keyValuePair, ChildPacket_ThreadID, BitConverter.GetBytes(item.Key));
                        protocol.WritePacket(keyValuePair, ChildPacket_ThreadAlive, BitConverter.GetBytes(item.Value));
                    }
                }

                AddPairs(protocol, sync, Packet_NodeThreads, NodeThreads);
                AddPairs(protocol, sync, Packet_CallThreads, CallThreads);

                AddPairMap(protocol, sync, Packet_Threadlines, Threadlines);
                AddPairMap(protocol, sync, Packet_ThreadStacks, ThreadStacks);

                return(protocol.WriteFinish());
            }
        }
示例#5
0
        public override byte[] Encode(G2Protocol protocol)
        {
            lock (protocol.WriteSection)
            {
                var packet = protocol.WritePacket(null, PacketType.Generic, UTF8Encoding.UTF8.GetBytes(Name));

                if (Data != null)
                {
                    foreach (var item in Data)
                    {
                        var keyValuePair = protocol.WritePacket(packet, Packet_Item, null);
                        protocol.WritePacket(keyValuePair, Packet_Key, UTF8Encoding.UTF8.GetBytes(item.Key));
                        protocol.WritePacket(keyValuePair, Packet_Value, UTF8Encoding.UTF8.GetBytes(item.Value));
                    }
                }

                return(protocol.WriteFinish());
            }
        }
示例#6
0
        public override byte[] Encode(G2Protocol protocol)
        {
            lock (protocol.WriteSection)
            {
                var instance = protocol.WritePacket(null, PacketType.Instance, null);

                protocol.WritePacket(instance, Packet_Type, BitConverter.GetBytes((int)Type));
                protocol.WritePacket(instance, Packet_ThreadID, BitConverter.GetBytes(ThreadID));
                protocol.WritePacket(instance, Packet_FieldID, BitConverter.GetBytes(FieldID));

                if (Details != null)
                {
                    protocol.WritePacket(instance, Packet_Details, UTF8Encoding.UTF8.GetBytes(Details));
                }

                if (Columns != null)
                {
                    foreach (var column in Columns)
                    {
                        protocol.WritePacket(instance, Packet_Column, UTF8Encoding.UTF8.GetBytes(column));
                    }
                }

                if (Fields != null)
                {
                    foreach (var field in Fields)
                    {
                        var fieldPacket = protocol.WritePacket(instance, Packet_Field, null);

                        protocol.WritePacket(fieldPacket, Packet_SubNodesFlag, BitConverter.GetBytes(field.PossibleSubNodes));
                        protocol.WritePacket(fieldPacket, Packet_FieldID, BitConverter.GetBytes(field.ID));

                        foreach (var cell in field.Cells)
                        {
                            protocol.WritePacket(fieldPacket, Packet_Cell, UTF8Encoding.UTF8.GetBytes(cell));
                        }
                    }
                }

                return(protocol.WriteFinish());
            }
        }
示例#7
0
        public override byte[] Encode(G2Protocol protocol)
        {
            lock (protocol.WriteSection)
            {
                var sync = protocol.WritePacket(null, PacketType.Sync, null);

                AddSet(protocol, sync, Packet_FunctionHit, FunctionHits);
                AddSet(protocol, sync, Packet_ExceptionHit, ExceptionHits);
                AddSet(protocol, sync, Packet_ConstructedHit, ConstructedHits);
                AddSet(protocol, sync, Packet_DisposedHit, DisposeHits);

                AddPairs(protocol, sync, Packet_NewCalls, NewCalls);
                AddSet(protocol, sync, Packet_CallHits, CallHits);

                if (CallStats != null)
                    protocol.WritePacket(sync, Packet_CallStats, CallStats.ToBytes());

                AddPairs(protocol, sync, Packet_Inits, Inits);

                if (NewThreads != null)
                    foreach (var item in NewThreads)
                    {
                        var keyValuePair = protocol.WritePacket(sync, Packet_NewThreads, null);
                        protocol.WritePacket(keyValuePair, ChildPacket_ThreadID, BitConverter.GetBytes(item.Key));
                        protocol.WritePacket(keyValuePair, ChildPacket_ThreadName, UTF8Encoding.UTF8.GetBytes(item.Value.Item1));
                        protocol.WritePacket(keyValuePair, ChildPacket_ThreadAlive, BitConverter.GetBytes(item.Value.Item2));
                    }

                if (ThreadChanges != null)
                    foreach (var item in ThreadChanges)
                    {
                        var keyValuePair = protocol.WritePacket(sync, Packet_ThreadChanges, null);
                        protocol.WritePacket(keyValuePair, ChildPacket_ThreadID, BitConverter.GetBytes(item.Key));
                        protocol.WritePacket(keyValuePair, ChildPacket_ThreadAlive, BitConverter.GetBytes(item.Value));
                    }

                AddPairs(protocol, sync, Packet_NodeThreads, NodeThreads);
                AddPairs(protocol, sync, Packet_CallThreads, CallThreads);

                AddPairMap(protocol, sync, Packet_Threadlines, Threadlines);
                AddPairMap(protocol, sync, Packet_ThreadStacks, ThreadStacks);

                return protocol.WriteFinish();
            }
        }
示例#8
0
        public override byte[] Encode(G2Protocol protocol)
        {
            lock (protocol.WriteSection)
            {
                var instance = protocol.WritePacket(null, PacketType.Instance, null);

                protocol.WritePacket(instance, Packet_Type, BitConverter.GetBytes((int)Type));
                protocol.WritePacket(instance, Packet_ThreadID, BitConverter.GetBytes(ThreadID));
                protocol.WritePacket(instance, Packet_FieldID, BitConverter.GetBytes(FieldID));

                if(Details != null)
                    protocol.WritePacket(instance, Packet_Details, UTF8Encoding.UTF8.GetBytes(Details));

                if (Columns != null)
                    foreach(var column in Columns)
                        protocol.WritePacket(instance, Packet_Column, UTF8Encoding.UTF8.GetBytes(column));

                if (Fields != null)
                    foreach (var field in Fields)
                    {
                        var fieldPacket = protocol.WritePacket(instance, Packet_Field, null);

                        protocol.WritePacket(fieldPacket, Packet_SubNodesFlag, BitConverter.GetBytes(field.PossibleSubNodes));
                        protocol.WritePacket(fieldPacket, Packet_FieldID, BitConverter.GetBytes(field.ID));

                        foreach(var cell in field.Cells)
                            protocol.WritePacket(fieldPacket, Packet_Cell, UTF8Encoding.UTF8.GetBytes(cell));
                    }

                return protocol.WriteFinish();
            }
        }
示例#9
0
        public override byte[] Encode(G2Protocol protocol)
        {
            lock (protocol.WriteSection)
            {
                var packet = protocol.WritePacket(null, PacketType.Generic, UTF8Encoding.UTF8.GetBytes(Name));

                if(Data != null)
                    foreach (var item in Data)
                    {
                        var keyValuePair = protocol.WritePacket(packet, Packet_Item, null);
                        protocol.WritePacket(keyValuePair, Packet_Key, UTF8Encoding.UTF8.GetBytes(item.Key));
                        protocol.WritePacket(keyValuePair, Packet_Value, UTF8Encoding.UTF8.GetBytes(item.Value));
                    }

                return protocol.WriteFinish();
            }
        }
示例#10
0
        public override byte[] Encode(G2Protocol protocol)
        {
            lock (protocol.WriteSection)
            {
                var dat = protocol.WritePacket(null, PacketType.Dat, null);

                protocol.WritePacket(dat, Packet_Pos, BitConverter.GetBytes(Pos));
                protocol.WritePacket(dat, Packet_Data, Data);

                return protocol.WriteFinish();
            }
        }