void PacketInterface.encode() { PacketUtil.encodeHeader(packet_, this.type()); PacketUtil.encode(packet_, clientId_); PacketUtil.encode(packet_, id_); PacketUtil.encode(packet_, password_); }
void PacketInterface.encode() { PacketUtil.encodeHeader(packet_, this.type()); PacketUtil.encode(packet_, clientId_); PacketUtil.encode(packet_, name_); PacketUtil.encode(packet_, result_); }
public void receive() { if (stream_.DataAvailable) { Byte[] packetByte = new Byte[client_.ReceiveBufferSize]; Int32 offset = 0; Int32 readLen = stream_.Read(packetByte, offset, packetByte.Length); PacketObfuscation.decodingHeader(ref packetByte, sizeof(Int32)); Int32 packetLen = PacketUtil.decodePacketLen(packetByte, ref offset); while (readLen < packetLen) { Byte[] remainPacket = new Byte[client_.ReceiveBufferSize]; Int32 remainLen = 0; remainLen = stream_.Read(remainPacket, 0, remainPacket.Length); Buffer.BlockCopy(remainPacket, 0, packetByte, readLen, remainLen); readLen += remainLen; } Byte[] packetData = new Byte[client_.ReceiveBufferSize]; Buffer.BlockCopy(packetByte, offset, packetData, 0, readLen - offset); PacketObfuscation.decodingData(ref packetData, packetData.Length); Packetinterface rowPacket = PacketUtil.packetAnalyzer(packetData); if (rowPacket == null && this.isConnected()) { Debug.Log("잘못된 패킷이 수신되었습니다."); } ContentsProcee_.run(rowPacket); } }
void Packetinterface.encode() { PacketUtil.encodeHeader(stream, type); PacketUtil.encode(stream, accountId); PacketUtil.encode(stream, roomNumber); PacketUtil.encode(stream, userNumber); }
public void Encode() { PacketUtil.EncodeHeader(_Packet, this.GetPacketType()); PacketUtil.Encode(_Packet, ClientId); PacketUtil.Encode(_Packet, Name); PacketUtil.Encode(_Packet, Result); }
void Packetinterface.encode() { PacketUtil.encodeHeader(stream, type); PacketUtil.encode(stream, userNumber); PacketUtil.encode(stream, pos_X); PacketUtil.encode(stream, pos_Y); }
void Packetinterface.decode(byte[] packet, ref int offset) { oidAccountId_ = PacketUtil.decodeUInt64(packet, ref offset); name_ = PacketUtil.decodestring(packet, ref offset); pos_X = PacketUtil.decodefloat(packet, ref offset); pos_Y = PacketUtil.decodefloat(packet, ref offset); }
void Packetinterface.encode() { PacketUtil.encodeHeader(packet_, this.type()); PacketUtil.encode(packet_, name_); PacketUtil.encode(packet_, pointX_); PacketUtil.encode(packet_, pointY_); }
void Packetinterface.encode() { PacketUtil.encodeHeader(packet_, this.type()); PacketUtil.encode(packet_, clientId_); PacketUtil.encode(packet_, oidAccountId_); PacketUtil.encode(packet_, result_); }
public void Encode() { PacketUtil.EncodeHeader(_Packet, this.GetPacketType()); PacketUtil.Encode(_Packet, Ip); PacketUtil.Encode(_Packet, Port); PacketUtil.Encode(_Packet, Name); }
void PacketInterface.encode() { PacketUtil.encodeHeader(packet_, this.type()); PacketUtil.encode(packet_, ip_); PacketUtil.encode(packet_, port_); PacketUtil.encode(packet_, name_); }
public void Encode() { PacketUtil.EncodeHeader(_Packet, this.GetPacketType()); PacketUtil.Encode(_Packet, ClientId); PacketUtil.Encode(_Packet, Id); PacketUtil.Encode(_Packet, Password); }
public static string DecodeString(Byte[] data, ref Int32 offset) { var stringLength = PacketUtil.DecodeInt32(data, ref offset); string value = Encoding.ASCII.GetString(data, offset, stringLength); offset += stringLength; return(value); }
void Packetinterface.decode(byte[] packet, ref int offset) { clientId_ = PacketUtil.decodeUInt64(packet, ref offset); name_ = PacketUtil.decodestring(packet, ref offset); pointX_ = PacketUtil.decodefloat(packet, ref offset); pointY_ = PacketUtil.decodefloat(packet, ref offset); result_ = PacketUtil.decodeByte(packet, ref offset); }
void Packetinterface.decode(byte[] packet, ref int offset) { ip_ = PacketUtil.decodestring(packet, ref offset); port_ = PacketUtil.decodeUInt32(packet, ref offset); name_ = PacketUtil.decodestring(packet, ref offset); pointX_ = PacketUtil.decodefloat(packet, ref offset); pointY_ = PacketUtil.decodefloat(packet, ref offset); }
void Packetinterface.encode() { PacketUtil.encodeHeader(packet_, this.type()); PacketUtil.encode(packet_, oidAccountId_); PacketUtil.encode(packet_, name_); PacketUtil.encode(packet_, pos_X); PacketUtil.encode(packet_, pos_Y); }
public static string decodestring(Byte[] data, ref Int32 offset) { Int32 strLen = PacketUtil.decodeInt32(data, ref offset); string str = System.Text.Encoding.ASCII.GetString(data, offset, strLen); offset += strLen; return(str); }
void Packetinterface.decode(byte[] packet, ref int offset) { userNumber = PacketUtil.decodeInt32(packet, ref offset); steering = PacketUtil.decodefloat(packet, ref offset); accel = PacketUtil.decodefloat(packet, ref offset); footbrake = PacketUtil.decodefloat(packet, ref offset); handbrake = PacketUtil.decodefloat(packet, ref offset); }
void Packetinterface.encode() { PacketUtil.encodeHeader(stream, type); PacketUtil.encode(stream, userNumber); PacketUtil.encode(stream, steering); PacketUtil.encode(stream, accel); PacketUtil.encode(stream, footbrake); PacketUtil.encode(stream, handbrake); }
public static void encode(MemoryStream packet, Char[] value) { int len = (int)value.Length; PacketUtil.encode(packet, len); for (int i = 0; i < len; i++) { PacketUtil.encode(packet, value[i]); } }
public static Char[] decodeCharArray(Byte[] data, ref Int32 offset) { Int32 strLen = PacketUtil.decodeInt32(data, ref offset); Char[] val = new char[strLen]; for (int i = 0; i < strLen; i++) { val[i] = (char)PacketUtil.decodeByte(data, ref offset); } return(val); }
public static IPacket PacketAnalyzer(Byte[] packetByte) { Int32 offset = 0; Int64 packetType = PacketUtil.DecodePacketType(packetByte, ref offset); IPacket packet = PacketFactory.GetPacket(packetType); if (packet == null) { return(null); } if (offset < packetByte.Length) { packet.Decode(packetByte, ref offset); } return(packet); }
public void receive() { try { while (this.isConnected()) { Byte[] packetByte = new Byte[client_.ReceiveBufferSize]; Int32 offset = 0; Int32 readLen = stream_.Read(packetByte, offset, packetByte.Length); // 패킷 난독화 PacketObfuscation.decodingHeader(ref packetByte, sizeof(Int32)); Int32 packetLen = PacketUtil.decodePacketLen(packetByte, ref offset); while (readLen < packetLen) { Byte[] remainPacket = new Byte[client_.ReceiveBufferSize]; Int32 remainLen = 0; remainLen = stream_.Read(remainPacket, 0, remainPacket.Length); Buffer.BlockCopy(remainPacket, 0, packetByte, readLen, remainLen); readLen += remainLen; } Byte[] packetData = new Byte[client_.ReceiveBufferSize]; Buffer.BlockCopy(packetByte, offset, packetData, 0, readLen - offset); PacketObfuscation.decodingData(ref packetData, packetData.Length); PacketInterface rowPacket = PacketUtil.packetAnalyzer(packetData); if (rowPacket == null && this.isConnected()) { //MessageBox.Show("잘못된 패킷이 수신되었습니다", "error", MessageBoxButtons.OK); //Application.Exit(); } packetProcee_.run(rowPacket); } this.close(); } catch (Exception e) { if (this.isConnected()) { //MessageBox.Show("잘못된 처리 : " + e.ToString(), "error", MessageBoxButtons.OK); //Application.Exit(); } } }
public static PacketInterface packetAnalyzer(Byte[] packetByte) { Int32 offset = 0; Int64 packetType = PacketUtil.decodePacketType(packetByte, ref offset); PacketInterface packet = PacketFactory.getPacket(packetType); if (packet == null) { return(null); } // 데이터가 있으면 decoding 해서 넘기기 if (offset < packetByte.Length) { packet.decode(packetByte, ref offset); } return(packet); }
public void Receive() { try { while (IsConnected()) { byte[] packetByte = new byte[_Client.ReceiveBufferSize]; Int32 offset = 0; Int32 readLen = _Stream.Read(packetByte, 0, packetByte.Length); PacketObfuscation.DecodeHeader(ref packetByte, sizeof(Int32)); Int32 packetLen = PacketUtil.DecodePacketLen(packetByte, ref offset); while (readLen < packetLen) { byte[] remainPacket = new byte[_Client.ReceiveBufferSize]; Int32 remainLen = 0; remainLen = _Stream.Read(remainPacket, 0, remainPacket.Length); Buffer.BlockCopy(remainPacket, 0, packetByte, readLen, remainLen); readLen += remainLen; } Byte[] packetData = new Byte[_Client.ReceiveBufferSize]; Buffer.BlockCopy(packetByte, offset, packetData, 0, readLen - offset); PacketObfuscation.DecodeData(ref packetData, packetData.Length); IPacket rowPacket = PacketUtil.PacketAnalyzer(packetData); //IPacket rowPacket = PacketUtil.PacketAnalyzer(packetByte, ref offset, readLen); if (rowPacket == null && IsConnected()) { MessageBox.Show("잘못된 패킷이 수신됐습니다", "error", MessageBoxButtons.OK); Application.Exit(); } _PacketProcess.Run(rowPacket); } Close(); } catch (Exception e) { if (IsConnected()) { MessageBox.Show("잘못된 처리:" + e.ToString(), "error", MessageBoxButtons.OK); Application.Exit(); } } }
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); }
public void Encode() { PacketUtil.EncodeHeader(_Packet, this.GetPacketType()); }
public void Decode(byte[] packet, ref int offset) { ClientId = PacketUtil.DecodeUInt64(packet, ref offset); Name = PacketUtil.DecodeString(packet, ref offset); Result = PacketUtil.DecodeByte(packet, ref offset); }
public void Decode(byte[] packet, ref int offset) { Name = PacketUtil.DecodeString(packet, ref offset); Text = PacketUtil.DecodeString(packet, ref offset); }
public void Decode(byte[] packet, ref int offset) { ClientId = PacketUtil.DecodeUInt64(packet, ref offset); OidAccountId = PacketUtil.DecodeUInt64(packet, ref offset); }