1234567891011121314151617181920212223242526272829303132333435363738 |
- using InABox.Core;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace InABox.Rpc
- {
- public class RpcNotification : ISerializeBinary
- {
- public Type Type { get; set; }
- public BaseObject Object { get; set; }
- public void SerializeBinary(CoreBinaryWriter writer)
- {
- writer.Write(Type.EntityName());
- writer.WriteObject(Object, Type);
- }
- public void DeserializeBinary(CoreBinaryReader reader)
- {
- Type = CoreUtils.GetEntity(reader.ReadString());
- Object = reader.ReadObject<BaseObject>(Type);
- }
- public static RpcNotification Create<TNotification>(TNotification notification)
- where TNotification : BaseObject
- {
- return new RpcNotification
- {
- Type = typeof(TNotification),
- Object = notification
- };
- }
- }
- }
|