예제 #1
0
        public static DisposableRealmPacketIn CreateFromOutPacket(byte[] outPacket, int offset, int totalLength)
        {
            int num = offset;
            RealmServerOpCode realmServerOpCode =
                (RealmServerOpCode)((int)outPacket[num + 2] | (int)outPacket[num + 3] << 8);
            BufferSegment segment = BufferManager.GetSegment(totalLength + 2);

            return(DisposableRealmPacketIn.Create((PacketId)realmServerOpCode, outPacket, offset + 4, totalLength - 4,
                                                  segment));
        }
예제 #2
0
        public static DisposableRealmPacketIn CreateFromOutPacket(BufferSegment oldSegment, BufferSegment newSegment,
                                                                  int offset, int totalLength)
        {
            int num = oldSegment.Offset + offset;

            return(DisposableRealmPacketIn.Create(
                       (PacketId)((RealmServerOpCode)((int)oldSegment.Buffer.Array[num + 2] |
                                                      (int)oldSegment.Buffer.Array[num + 3] << 8)), oldSegment.Buffer.Array,
                       oldSegment.Offset + offset + 4, totalLength - 4, newSegment));
        }
예제 #3
0
        public static DisposableRealmPacketIn Create(PacketId opCode, byte[] outPacketContent)
        {
            BufferSegment segment = BufferManager.GetSegment(outPacketContent.Length + 6);

            return(DisposableRealmPacketIn.Create(opCode, outPacketContent, 0, outPacketContent.Length, segment));
        }
예제 #4
0
 public static DisposableRealmPacketIn CreateFromOutPacket(BufferSegment segment, RealmPacketOut packet)
 {
     byte[] finalizedPacket = packet.GetFinalizedPacket();
     return(DisposableRealmPacketIn.Create(packet.PacketId, finalizedPacket, packet.HeaderSize,
                                           finalizedPacket.Length - packet.HeaderSize, segment));
 }