public static Packetinterface packetAnalyzer(Byte[] packetByte) { Int32 offset = 0; Int64 packetType = PacketUtil.decodePacketType(packetByte, ref offset); Packetinterface packet = PacketFactory.getPacket(packetType); if (packet == null) { Console.Write("packet Analyzer failed"); return(null); } // 데이터가 있으면 decoding 해서 넘기기 if (offset < packetByte.Length) { packet.decode(packetByte, ref offset); } return(packet); }
public static Packetinterface packetAnalyzer(Byte[] packetByte, int totalOffset) { Int32 offset = 0; Int32 packetType = PacketUtil.decodeInt32(packetByte, ref offset); Packetinterface packet = PacketFactory.getPacket(packetType); if (packet == null) { Debug.Log("packet Analyzer failed"); return(null); } // 데이터가 있으면 decoding 해서 넘기기 if (offset < totalOffset) { packet.decode(packetByte, ref offset); } return(packet); }