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

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