//public override void Notify(IResponseNotifier notifier, ResponeCommMessage response) //{ // notifier.Notify(response.OriginalMsg, response); //} public override bool Equals(CommunicationMessage other) { if (other != null && other.GetType() == typeof(ReplayCommMessage)) { var afterCasting = (ReplayCommMessage)other; return(RoomId == afterCasting.RoomId && UserId == afterCasting.UserId); } return(false); }
//public override void Notify(IResponseNotifier notifier, ResponeCommMessage msg) //{ // notifier.Notify(OriginalMsg, this); //} public override bool Equals(CommunicationMessage other) { if (other != null && other.GetType() == typeof(CreateNewGameResponse)) { var afterCasting = (CreateNewGameResponse)other; return(Success == afterCasting.Success && OriginalMsg.Equals(afterCasting.OriginalMsg) && UserId == afterCasting.UserId && GameData.Equals(afterCasting.GameData)); } return(false); }
//public override void Notify(IResponseNotifier notifier, ResponeCommMessage response) //{ // notifier.Notify(response.OriginalMsg, response); //} public override bool Equals(CommunicationMessage other) { if (other != null && other.GetType() == typeof(EditCommMessage)) { var afterCasting = (EditCommMessage)other; return(FieldToEdit == afterCasting.FieldToEdit && NewValue == afterCasting.NewValue && UserId == afterCasting.UserId); } return(false); }
//public override void Notify(IResponseNotifier notifier, ResponeCommMessage response) //{ // notifier.Notify(response.OriginalMsg, response); //} public override bool Equals(CommunicationMessage other) { bool ans = false; if (other.GetType() == typeof(LeaderboardCommMessage)) { var afterCast = (LeaderboardCommMessage)other; ans = UserId == afterCast.UserId && SortedBy.Equals(afterCast.SortedBy); } return(ans); }
//public override void Notify(IResponseNotifier notifier, ResponeCommMessage msg) //{ // notifier.Notify(OriginalMsg, this); //} public override bool Equals(CommunicationMessage other) { if (other != null && other.GetType() == typeof(SearchResponseCommMessage)) { var afterCasting = (SearchResponseCommMessage)other; return(Success == afterCasting.Success && OriginalMsg.Equals(afterCasting.OriginalMsg) && UserId == afterCasting.UserId && Games.TrueForAll(g => afterCasting.Games.Contains(g))); } return(false); }
//public override void Notify(IResponseNotifier notifier, ResponeCommMessage response) //{ // notifier.Notify(response.OriginalMsg, response); //} public override bool Equals(CommunicationMessage other) { if (other != null && other.GetType() == typeof(RegisterCommMessage)) { var afterCasting = (RegisterCommMessage)other; return(Money == afterCasting.Money && Name.Equals(afterCasting.Name) && MemberName.Equals(afterCasting.MemberName) && UserId == afterCasting.UserId && Password.Equals(afterCasting.Password)); } return(false); }
//public override void Notify(IResponseNotifier notifier, ResponeCommMessage msg) //{ // notifier.Notify(OriginalMsg, this); //} public override bool Equals(CommunicationMessage other) { bool ans = false; if (other.GetType() == typeof(UserStatisticsResponseCommMessage)) { var afterCast = (UserStatisticsResponseCommMessage)other; ans = base.Equals(afterCast) && Equals(AvgCashGain, afterCast.AvgCashGain) && Equals(AvgGrossProfit, afterCast.AvgGrossProfit); } return(ans); }
//public override void Notify(IResponseNotifier notifier, ResponeCommMessage msg) //{ // notifier.Notify(OriginalMsg, this); //} public override bool Equals(CommunicationMessage other) { if (other != null && other.GetType() == typeof(ChatResponceCommMessage)) { var afterCasting = (ChatResponceCommMessage)other; return(Success == afterCasting.Success && OriginalMsg.Equals(afterCasting.OriginalMsg) && UserId == afterCasting.UserId && idReciver == afterCasting.idReciver && roomId == afterCasting.roomId && senderngUsername.Equals(afterCasting.senderngUsername) && chatType == afterCasting.chatType); } return(false); }
//public override void Notify(IResponseNotifier notifier, ResponeCommMessage response) //{ // notifier.Notify(response.OriginalMsg, response); //} public override bool Equals(CommunicationMessage other) { if (other != null && other.GetType() == typeof(CreateNewRoomMessage)) { var afterCasting = (CreateNewRoomMessage)other; return(_mode == afterCasting._mode && _minBet == afterCasting._minBet && UserId == afterCasting.UserId && _chipPolicy == afterCasting._chipPolicy && _buyInPolicy == afterCasting._buyInPolicy && _canSpectate == afterCasting._canSpectate && _minPlayer == afterCasting._minPlayer && _maxPlayers == afterCasting._maxPlayers); } return(false); }
//public override void Notify(IResponseNotifier notifier, ResponeCommMessage msg) //{ // notifier.Notify(OriginalMsg, this); //} public override bool Equals(CommunicationMessage other) { if (other != null && other.GetType() == typeof(LoginResponeCommMessage)) { var afterCasting = (LoginResponeCommMessage)other; return(Success == afterCasting.Success && OriginalMsg.Equals(afterCasting.OriginalMsg) && UserId == afterCasting.UserId && Name.Equals(afterCasting.Name) && Username.Equals(afterCasting.Username) && Password.Equals(afterCasting.Password) && Avatar.Equals(afterCasting.Avatar) && Email.Equals(afterCasting.Email) && Leauge.Equals(afterCasting.Leauge) && Money == afterCasting.Money); } return(false); }
//public override void Notify(IResponseNotifier notifier, ResponeCommMessage msg) //{ // notifier.Notify(OriginalMsg, this); //} public override bool Equals(CommunicationMessage other) { bool ans = false; if (other.GetType() == typeof(LeaderboardResponseCommMessage)) { var afterCast = (LeaderboardResponseCommMessage)other; ans = UserId == afterCast.UserId && Results.TrueForAll(line => { //check if all items of Results exist in afterCast.Results return(afterCast.Results.Find(elem => elem.Equals(line)) != null); }); } return(ans); }
//public override void Notify(IResponseNotifier notifier, ResponeCommMessage response) //{ // notifier.Notify(response.OriginalMsg, response); //} public override bool Equals(CommunicationMessage other) { if (other != null && other.GetType() == typeof(GameDataCommMessage)) { var afterCasting = (GameDataCommMessage)other; bool good = IsSucceed == afterCasting.IsSucceed && DealerName.Equals(afterCasting.DealerName) && UserId == afterCasting.UserId && PotSize == afterCasting.PotSize && CurrRound.Equals(afterCasting.CurrRound) && TotalChips == afterCasting.TotalChips && BbName.Equals(afterCasting.BbName) && SbName.Equals(afterCasting.SbName) && CurrPlayerTurn.Equals(afterCasting.CurrPlayerTurn); good = PlayerCards.Aggregate(good, (current, card) => current && afterCasting.PlayerCards.Contains(card)); good = AllPlayerNames.Aggregate(good, (current, name) => current && afterCasting.AllPlayerNames.Contains(name)); good = AllSpectatorNames.Aggregate(good, (current, name) => current && afterCasting.AllSpectatorNames.Contains(name)); good = TableCards.Aggregate(good, (current, card) => current && afterCasting.TableCards.Contains(card)); good = good && afterCasting.ActionPlayerName.Equals(ActionPlayerName); good = good && afterCasting.ActionPlayerName.Equals(ActionPlayerName); good = good && afterCasting.BetAmount == this.BetAmount; good = good && afterCasting.Action.Equals(Action); return(good); } return(false); }
public string SerializeMsg(CommunicationMessage msg, bool addDelimiter) { using (StringWriter stringwriter = new StringWriter()) { var serializer = new XmlSerializer(msg.GetType()); serializer.Serialize(stringwriter, msg); string msgToRet = stringwriter.ToString(); if (msg.GetType() == typeof(ActionCommMessage)) { msgToRet = "a" + msgToRet; } else if (msg.GetType() == typeof(EditCommMessage)) { msgToRet = "b" + msgToRet; } else if (msg.GetType() == typeof(LoginCommMessage)) { msgToRet = "c" + msgToRet; } else if (msg.GetType() == typeof(RegisterCommMessage)) { msgToRet = "d" + msgToRet; } else if (msg.GetType() == typeof(GameDataCommMessage)) { msgToRet = "e" + msgToRet; } else if (msg.GetType() == typeof(ChatCommMessage)) { msgToRet = "f" + msgToRet; } else if (msg.GetType() == typeof(ResponeCommMessage)) { msgToRet = "g" + msgToRet; } else if (msg.GetType() == typeof(SearchCommMessage)) { msgToRet = "h" + msgToRet; } else if (msg.GetType() == typeof(LoginResponeCommMessage)) { msgToRet = "i" + msgToRet; } else if (msg.GetType() == typeof(RegisterResponeCommMessage)) { msgToRet = "j" + msgToRet; } else if (msg.GetType() == typeof(SearchResponseCommMessage)) { msgToRet = "k" + msgToRet; } else if (msg.GetType() == typeof(CreateNewRoomMessage)) { msgToRet = "l" + msgToRet; } else if (msg.GetType() == typeof(ChatResponceCommMessage)) { msgToRet = "m" + msgToRet; } else if (msg.GetType() == typeof(ReplayCommMessage)) { msgToRet = "n" + msgToRet; } else if (msg.GetType() == typeof(ReplaySearchResponseCommMessage)) { msgToRet = "o" + msgToRet; } else if (msg.GetType() == typeof(CreateNewGameResponse)) { msgToRet = "p" + msgToRet; } else if (msg.GetType() == typeof(JoinResponseCommMessage)) { msgToRet = "q" + msgToRet; } else if (msg.GetType() == typeof(LeaderboardResponseCommMessage)) { msgToRet = "r" + msgToRet; } else if (msg.GetType() == typeof(LeaderboardCommMessage)) { msgToRet = "s" + msgToRet; } else if (msg.GetType() == typeof(UserStatisticsCommMessage)) { msgToRet = "t" + msgToRet; } else if (msg.GetType() == typeof(UserStatisticsResponseCommMessage)) { msgToRet = "u" + msgToRet; } else if (msg.GetType() == typeof(ReturnToGameAsPlayerCommMsg)) { msgToRet = "v" + msgToRet; } else if (msg.GetType() == typeof(ReturnToGameAsSpecCommMsg)) { msgToRet = "w" + msgToRet; } else if (msg.GetType() == typeof(ReturnToGameResponseCommMsg)) { msgToRet = "z" + msgToRet; } if (addDelimiter) { msgToRet = AddDelimiter(msgToRet); } return(msgToRet); } }
//public override void Notify(IResponseNotifier notifier, ResponeCommMessage response) //{ // notifier.Notify(response.OriginalMsg, response); //} public override bool Equals(CommunicationMessage other) { return(UserId == other.UserId && other.GetType() == typeof(UserStatisticsCommMessage)); }