Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        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;
        }
Ejemplo n.º 3
0
 public static T ReadMessage <T>(Il2CppStructArray <byte> serializedMessage)
 {
     return(SerialisationUtil.Deserialise <T>(serializedMessage));
 }
Ejemplo n.º 4
0
        public T Deserialize <T> (Il2CppStructArray <byte> messageBytes)
        {
            string modMessage = SerialisationUtil.Deserialise <string>(messageBytes);

            return(JsonConvert.DeserializeObject <T>(modMessage));
        }