public Frame EncodeMessage <TIn>(SocketRequestMessage <TIn> message) { var type = message.GetType(); var protoAttribute = Attribute.GetCustomAttribute(type, typeof(ProtoAttribute), false) as ProtoAttribute; Debug.Log($"SocketRequest Request: MessageID: {protoAttribute.value} {protoAttribute.description}, MessageData: {message.Data.ToString()}"); byte[] data = Serialize.Serialize(message.Data); Frame f = new Frame32(512); f.PutInt(MessageQueueHandler.GetProtocolCMD(message.GetType())); byte[] encryptedData = Crypto.Encryption(data); f.PutBytes(encryptedData); f.End(); return(f); }
public Frame EncodeMessage <TIn>(SocketRequestMessage <TIn> message) { byte[] data = Serialize.Serialize(message.Data); Debug.Log("SocketRequest Request: " + message.Data); Frame f = new Frame(512); f.PutShort(MessageQueueHandler.GetProtocolCMD(message.GetType())); byte[] encryptedData = Crypto.Encryption(data); f.PutBytes(encryptedData); f.End(); return(f); }