public static Message CreateMessage <T>(T objectToSend, string code = "") where T : Il2CppSystem.Object { Il2CppStructArray <byte> serialize = SerialisationUtil.Serialise(objectToSend); code = string.IsNullOrEmpty(code) ? MelonMain.coopMessageCode : code; return(new Message(code, serialize)); }
public Chat_Message(Il2CppStructArray <byte> messageBytes) { string json = SerialisationUtil.Deserialise <string>(messageBytes); Chat_Message message = Read(json); PeerID = message.PeerID; Sender = message.Sender; Message = message.Message; IsPrivateMessage = message.IsPrivateMessage; }
public static T ReadMessage <T>(Il2CppStructArray <byte> serializedMessage) { return(SerialisationUtil.Deserialise <T>(serializedMessage)); }
public T Deserialize <T> (Il2CppStructArray <byte> messageBytes) { string modMessage = SerialisationUtil.Deserialise <string>(messageBytes); return(JsonConvert.DeserializeObject <T>(modMessage)); }