Пример #1
0
 public void Send(TexasMessage msg)
 {
     var json =
         JsonConvert.SerializeObject(msg, Formatting.None,
             new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver() }) +
         delimiter;
     logger.Log(LogLevel.Trace, "Sending " + json);
     var bytes = Encoding.ASCII.GetBytes(json);
     socket.Send(bytes);
 }
Пример #2
0
        public void Send(TexasMessage msg)
        {
            var json =
                JsonConvert.SerializeObject(msg, Formatting.None,
                                            new JsonSerializerSettings {
                ContractResolver = new CamelCasePropertyNamesContractResolver()
            }) +
                delimiter;

            logger.Trace("Sending " + json);
            var bytes = Encoding.ASCII.GetBytes(json);

            socket.Send(bytes);
        }
Пример #3
0
 public void UpdateFrom(TexasMessage msg)
 {
     if (msg is PlayerBetBigBlindEvent)
         OnPlayerBetBigBlind(msg as PlayerBetBigBlindEvent);
     if (msg is PlayerBetSmallBlindEvent)
         OnPlayerBetSmallBlind(msg as PlayerBetSmallBlindEvent);
     if (msg is PlayerCalledEvent)
         OnPlayerCalled(msg as PlayerCalledEvent);
     if (msg is PlayerCheckedEvent)
         OnPlayerChecked(msg as PlayerCheckedEvent);
     if (msg is PlayerFoldedEvent)
         OnPlayerFolded(msg as PlayerFoldedEvent);
     if (msg is PlayerQuitEvent)
         OnPlayerQuit(msg as PlayerQuitEvent);
     if (msg is PlayerRaisedEvent)
         OnPlayerRaisedEvent(msg as PlayerRaisedEvent);
     if (msg is PlayerWentAllInEvent)
         OnPlayerWentAllIn(msg as PlayerWentAllInEvent);
     if (msg is ServerIsShuttingDownEvent)
         OnServerIsShuttingDown(msg as ServerIsShuttingDownEvent);
     if (msg is ShowDownEvent)
         OnShowDown(msg as ShowDownEvent);
     if (msg is TableChangedStateEvent)
         OnTableStateChanged(msg as TableChangedStateEvent);
     if (msg is TableIsDoneEvent)
         OnTableIsDone(msg as TableIsDoneEvent);
     if (msg is PlayIsStartedEvent)
         OnPlayIsStarted(msg as PlayIsStartedEvent);
     if (msg is CommunityHasBeenDealtACardEvent)
         OnCommunityHasBeedDealtACard(msg as CommunityHasBeenDealtACardEvent);
     if (msg is YouHaveBeenDealtACardEvent)
         OnYouHaveBeenDealtACard(msg as YouHaveBeenDealtACardEvent);
     if (msg is YouWonAmountEvent)
         OnYouWonAmountEvent(msg as YouWonAmountEvent);
     if (msg is UnknownMessage)
         logger.Log(LogLevel.Error, "Unknow message received from server: " + ((msg as UnknownMessage).StringData));
 }