public static PacketBuilder <Packet> CreateDefault(PacketBaseInformation information) { var result = new PacketBuilder <Packet>(); result.Setup(information); result.Setup(Helpers.FastConstructor <Packet> .Create); return(result); }
public virtual void Register <T>(Func <T> constructor, PacketBaseInformation information) where T : IDataSerializer { if (constructor == null || information == null) { return; } var builder = new PacketBuilder <T>(); builder.Setup(information, constructor); Register(builder); }
public virtual void Register <T>(PacketBaseInformation information) where T : IDataSerializer { if (information == null) { return; } if (Helpers.FastConstructor <T> .Exists) { Register(Helpers.FastConstructor <T> .Create, information); } }
public void Setup(PacketBaseInformation information, Func <Packet> constructor) { Information = information; Constructor = constructor; }
public void Setup(PacketBaseInformation information) { Information = information; }
public static PacketContainer <T> Create <TNew>(PacketBaseInformation information) where TNew : T { return(new PacketContainer <T>(Helpers.FastConstructor <TNew> .Create(), information)); }
public PacketContainer(T packet, PacketBaseInformation information) { Information = information; Packet = packet; }