public void Send <T>(TakeServerCommand tcmd, T data) where T : class, new() { ProtocolLogger.WriteLog(data, MainCommand.TakeServer, (ushort)tcmd, LogerType.Info); if (socketConnected) { socket.Send((ushort)MainCommand.TakeServer, (ushort)tcmd, ProtocalSerialize.SerializeObject(data)); } }
/// <summary> /// 发送盘口统一方法 /// </summary> /// <typeparam name="TOriginal">Take实体对象类型</typeparam> /// <typeparam name="TDestination">发送所需传输对象类型</typeparam> /// <param name="market">盘口实体</param> /// <param name="cmd">发送盘口命令</param> private void SendMarket <TOriginal, TDestination>(MarketEntityBase market, TakeServerCommand cmd) where TOriginal : MarketEntityBase where TDestination : MarketBase, new() { TOriginal original = market as TOriginal; if (original == null) { return; } TDestination destination = (TDestination)original.ToTakeMarketDto(MatchID, takeType); destination.RowIndex = 1; Communicator.Send(cmd, destination); }