Example #1
0
        public ActionResult AddFriend(AddFriend model)
        {
            //if (!IsLogin) {
            //    return View();
            //}
            using (blogEntities ct = new blogEntities()) {
                //SunMoon.Blog.DataAccess.EntityFramework.Friend f = new DataAccess.EntityFramework.Friend();

                //f.CreateTime = DateTime.Now;
                //f.FriendID = model.Friend;
                //f.Self = base.Passport.AccountID;

                //ct.Friends.Add(f);

                SunMoon.Blog.DataAccess.EntityFramework.Message msg = new Message();

                msg.ID          = Guid.NewGuid();
                msg.Author      = Passport.AccountID;
                msg.CreateTime  = DateTime.Now;
                msg.Description = "{'type':'addfriend'}";
                msg.Owner       = model.Friend;

                ct.Messages.Add(msg);
                ct.SaveChanges();

                return(RedirectToAction("queryperson"));
            }
        }
Example #2
0
        public Task <HttpResponseMessage> AddFriendRequest(AddFriend addFriend)
        {
            ResponseBase <string> response = new ResponseBase <string>();

            try
            {
                var result = wechat.VerifyUser(addFriend.WxId, MMPro.MM.VerifyUserOpCode.MM_VERIFYUSER_SENDREQUEST, addFriend.Content, addFriend.AntispamTicket, addFriend.UserNameV1, (byte)addFriend.Origin);
                if (result == null || result.baseResponse.ret != (int)MMPro.MM.RetConst.MM_OK)
                {
                    response.Success = false;
                    response.Code    = "501";
                    response.Message = result?.baseResponse?.errMsg?.@string;
                    return(response.ToHttpResponseAsync());
                }
                else
                {
                    response.Data = result.userName;
                }
            }
            catch (ExpiredException ex)
            {
                response.Success = false;
                response.Code    = "401";
                response.Message = ex.Message;
            }
            catch (Exception ex)
            {
                response.Success = false;
                response.Code    = "500";
                response.Message = ex.Message;
            }
            return(response.ToHttpResponseAsync());
        }
Example #3
0
        private void buttonFindFriend_Click(object sender, RoutedEventArgs e)
        {
            AddFriend add = new AddFriend(loginnedUser, client);

            add.Owner = this;
            add.ShowDialog();
        }
Example #4
0
        public async void AddUserFriend(Guid userId, AddFriend addFriend)
        {
            var uriString = _apiConfig.IdentityApiUrl + "/api/users/" + userId + "/friends";
            var response  = await _apiClient.PostAsync(uriString, addFriend);

            response.EnsureSuccessStatusCode();
        }
Example #5
0
        public ActionResult AddFriend(AddFriend model)
        {
            model.Friend = model.Friend.Trim();
            using (var ct = new SunMoon.Blog.DataAccess.EntityFramework.blogEntities()) {
                var user = ct.Users.Single(u => u.UserID.Equals(Passport.AccountID));

                var friend = ct.Users.Single(u => u.UserID.Equals(model.Friend));

                SunMoon.Blog.DataAccess.EntityFramework.Friend f = new DataAccess.EntityFramework.Friend();

                f.Self       = user.UserID;
                f.FriendID   = model.Friend;
                f.CreateTime = DateTime.Now;

                ct.Friends.Add(f);
                Friend ff = new Friend();

                ff.Self       = model.Friend;
                ff.FriendID   = user.UserID;
                ff.CreateTime = DateTime.Now;

                ct.Friends.Add(ff);
                ct.SaveChanges();
            }
            return(View());
        }
Example #6
0
        public async Task <IActionResult> AddUserFriend(Guid userId, [FromBody] AddFriend addFriend)
        {
            var user = await _users.Include(u => u.Friends).Where(u => u.Id == userId).FirstOrDefaultAsync();

            var friend = await _users.Include(f => f.Friends).Where(f => f.Id == addFriend.UserId).FirstOrDefaultAsync();

            if (user != null && friend != null &&
                !user.Friends.Exists(uf => uf.FriendId == friend.Id) &&
                !friend.Friends.Exists(uf => uf.FriendId == userId))
            {
                user.Friends.Add(new UserFriend
                {
                    UserId   = user.Id,
                    FriendId = friend.Id
                });
                friend.Friends.Add(new UserFriend
                {
                    UserId   = friend.Id,
                    FriendId = user.Id
                });
                _users.Update(user);
                _users.Update(friend);
                await _context.SaveChangesAsync();
            }
            return(Ok());
        }
Example #7
0
        public static AddFriend read(BinaryReader binaryReader)
        {
            AddFriend newObj = new AddFriend();

            newObj.i_friend_name = PStringChar.read(binaryReader);
            return(newObj);
        }
Example #8
0
        void HandleAddFriend(AddFriend packet)
        {
            if (!ObjectManager.NormalizePlayerName(ref packet.Name))
            {
                return;
            }

            FriendsResult friendResult = FriendsResult.NotFound;
            ObjectGuid    friendGuid   = Global.CharacterCacheStorage.GetCharacterGuidByName(packet.Name);

            if (!friendGuid.IsEmpty())
            {
                CharacterCacheEntry characterInfo = Global.CharacterCacheStorage.GetCharacterCacheByGuid(friendGuid);
                if (characterInfo != null)
                {
                    Team team            = Player.TeamForRace(characterInfo.RaceId);
                    uint friendAccountId = characterInfo.AccountId;

                    if (HasPermission(RBACPermissions.AllowGmFriend) || Global.AccountMgr.IsPlayerAccount(Global.AccountMgr.GetSecurity(friendAccountId, (int)Global.WorldMgr.GetRealm().Id.Realm)))
                    {
                        if (friendGuid == GetPlayer().GetGUID())
                        {
                            friendResult = FriendsResult.Self;
                        }
                        else if (GetPlayer().GetTeam() != team && !HasPermission(RBACPermissions.TwoSideAddFriend))
                        {
                            friendResult = FriendsResult.Enemy;
                        }
                        else if (GetPlayer().GetSocial().HasFriend(friendGuid))
                        {
                            friendResult = FriendsResult.Already;
                        }
                        else
                        {
                            Player playerFriend = Global.ObjAccessor.FindPlayer(friendGuid);
                            if (playerFriend && playerFriend.IsVisibleGloballyFor(GetPlayer()))
                            {
                                friendResult = FriendsResult.AddedOnline;
                            }
                            else
                            {
                                friendResult = FriendsResult.AddedOffline;
                            }

                            if (GetPlayer().GetSocial().AddToSocialList(friendGuid, SocialFlag.Friend))
                            {
                                GetPlayer().GetSocial().SetFriendNote(friendGuid, packet.Notes);
                            }
                            else
                            {
                                friendResult = FriendsResult.ListFull;
                            }
                        }
                    }
                }
            }

            Global.SocialMgr.SendFriendStatus(GetPlayer(), friendResult, friendGuid);
        }
Example #9
0
 public async Task <IActionResult> AddFriend(Guid userId, [FromBody] AddFriend addFriend)
 {
     try
     {
         await Task.Run(() => _usersService.AddUserFriend(userId, addFriend));
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
     return(Ok());
 }
Example #10
0
        void HandleAddFriend(AddFriend packet)
        {
            if (!ObjectManager.NormalizePlayerName(ref packet.Name))
            {
                return;
            }

            PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_GUID_RACE_ACC_BY_NAME);

            stmt.AddValue(0, packet.Name);

            _queryProcessor.AddQuery(DB.Characters.AsyncQuery(stmt).WithCallback(HandleAddFriendCallBack, packet.Notes));
        }
Example #11
0
 private void OnAddNewFriend(AddFriend msg)
 {
     if (_friends.ContainsKey(msg.Name))
     {
         Sender.Tell(new AddFriendError(friendName: msg.Name, ownerName: Name));
     }
     else
     {
         IActorRef friendActor = Context.ActorOf(Props.Create <FriendActor>(msg.Name), "friend_" + msg.Name);
         Context.System.EventStream.Subscribe(friendActor, typeof(GreetFriendFrom));
         Context.System.EventStream.Subscribe(friendActor, typeof(BlameMe));
         _friends.Add(msg.Name, friendActor);
         Sender.Tell(new AddFriendSuccesfully(friendName: msg.Name, ownerName: Name));
     }
 }
Example #12
0
 public WebSocketApi(string uri)
 {
     _client        = new Client(uri);
     _login         = new Login(_client);
     _changePwd     = new ChangePwd(_client);
     _forgotPwd     = new ForgotPwd(_client);
     _resetPwd      = new ResetPwd(_client);
     _validMail     = new ValidMail(_client);
     _register      = new Register(_client);
     _getFriends    = new GetFriends(_client);
     _getPFriends   = new GetPendingFriends(_client);
     _removeFriend  = new RemoveFriend(_client);
     _addFriend     = new AddFriend(_client);
     _confirmFriend = new ConfirmFriend(_client);
 }
Example #13
0
        public void TestFriends()
        {
            var accept = new AcceptFriend("targetid");

            Assert.IsNotNullOrEmpty(accept.RequestMethod.ToString());
            Assert.IsTrue(accept.EndPoint.Contains("targetid"));
            Assert.IsNotNull(accept.BodyParameters);

            var add = new AddFriend("targetid");

            Assert.IsNotNullOrEmpty(add.RequestMethod.ToString());
            Assert.IsTrue(add.EndPoint.Contains("targetid"));
            Assert.IsNotNull(add.BodyParameters);

            var toast = new ToastUntoast("targetid");

            Assert.IsNotNullOrEmpty(toast.RequestMethod.ToString());
            Assert.IsTrue(toast.EndPoint.Contains("targetid"));
            Assert.IsNotNull(toast.BodyParameters);

            var remove = new RemoveFriend("targetid");

            Assert.IsNotNullOrEmpty(remove.RequestMethod.ToString());
            Assert.IsTrue(remove.EndPoint.Contains("targetid"));
            Assert.IsNotNull(remove.BodyParameters);

            var removeWish = new RemoveFromWishList(1);

            Assert.IsNotNullOrEmpty(removeWish.RequestMethod.ToString());
            Assert.IsNotNullOrEmpty(removeWish.EndPoint);
            Assert.AreEqual(removeWish.BodyParameters["bid"], 1);


            var addWish = new AddToWishList(1);

            Assert.IsNotNullOrEmpty(addWish.RequestMethod.ToString());
            Assert.IsNotNullOrEmpty(addWish.EndPoint);
            Assert.AreEqual(addWish.BodyParameters["bid"], 1);

            var comment = new AddComment("checkin", "shout");

            Assert.IsNotNullOrEmpty(comment.RequestMethod.ToString());
            Assert.IsTrue(comment.EndPoint.Contains("checkin"));
            Assert.AreEqual(comment.BodyParameters["shout"], "shout");
        }
Example #14
0
        public WebSocketApi(string uri)
        {
            _client = new Client(uri);
            var dataExchange = new DataExchange(_client);

            _login         = new Login(dataExchange);
            _changePwd     = new ChangePwd(dataExchange);
            _forgotPwd     = new ForgotPwd(dataExchange);
            _resetPwd      = new ResetPwd(dataExchange);
            _validMail     = new ValidMail(dataExchange);
            _register      = new Register(dataExchange);
            _getFriends    = new GetFriends(dataExchange);
            _getPFriends   = new GetPendingFriends(dataExchange);
            _removeFriend  = new RemoveFriend(dataExchange);
            _addFriend     = new AddFriend(dataExchange);
            _confirmFriend = new ConfirmFriend(dataExchange);
            _logger        = LoggerFactory.GetLogger();
        }
Example #15
0
        public List <AddFriend> GetAddFriend(int dbid)
        {
            Console.WriteLine("GetAddFriend()");
            var cmd = new NpgsqlCommand(string.Format("select * from friend, player where friend.request=player.id and response = {0} and status = 0;", dbid), conn);
            List <AddFriend> friendList = new List <AddFriend>();
            var reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                AddFriend result = new AddFriend
                {
                    dbID = Convert.ToInt32(reader["request"]),
                    name = Convert.ToString(reader["name"]),
                    info = Convert.ToString(reader["message"])
                };
                friendList.Add(result);
            }
            reader.Close();
            return(friendList);
        }
 public ActionResult <Friend> PostFriend(AddFriend addFriend)
 {
     _friendRepository.AddFriend(addFriend);
     return(Ok());
 }
Example #17
0
        async Task ProcessAsync(HttpListenerContext ctx)
        {
            if (ctx.Request.UserAgent != "osu!")
            {
                return;
            }
            if (ctx.Request.Url.AbsolutePath.StartsWith("/web/"))
            {
                return;
            }

            if (string.IsNullOrEmpty(ctx.Request.Headers["osu-token"]))
            {
                await Login.Handle(ctx);

                return;
            }

            Player p = Global.FindPlayer(ctx.Request.Headers["osu-token"]);

            if (p == null) // if they arent part of the player collection, force them to relogin
            {
                ctx.Response.StatusCode = 403;
                ctx.Response.OutputStream.Write(Packets.Packets.SingleIntPacket(5, -5));
                ctx.Response.Close();
                return;
            }

            using (MemoryStream ms = new MemoryStream())
                using (BinaryReader r = new BinaryReader(ms))
                {
                    await ctx.Request.InputStream.CopyToAsync(ms);

                    ms.Position = 0;
                    while (ms.Position < ctx.Request.ContentLength64 - 6)
                    {
                        short Id = r.ReadInt16();
                        ms.Position += 1;
                        int Length = r.ReadInt32();
                        if (ms.Position + Length > ctx.Request.ContentLength64)
                        {
                            break;
                        }
                        if (Id == 68 || Id == 79)
                        {
                            ms.Position += Length;
                            continue;
                        }

                        byte[] Data = r.ReadBytes(Length);
                        switch (Id)
                        {
                        case 4: p.Ping = DateTime.Now.Ticks; break;

                        case 0:
                            StatusUpdate.Handle(p, Data);
                            break;

                        case 1:
                            IrcMessage.Handle(p, Data);
                            break;

                        case 2:
                            Player.RemovePlayer(p);
                            break;

                        case 3:
                            await StatsUpdateRequest.Handle(p);

                            break;

                        case 16:
                            StartSpectating.Handle(p, Data);
                            break;

                        case 17:
                            StopSpectating.Handle(p);
                            break;

                        case 18:
                            SpectatorFrames.Handle(p, Data);
                            break;

                        case 25:
                            IrcMessage.HandlePrivate(p, Data);
                            break;

                        case 29:
                            Global.LeaveLobby(p);
                            break;

                        case 30:
                            Global.JoinLobby(p);
                            break;

                        case 31:
                            CreateMatch.Handle(p, Data);
                            break;

                        case 32:
                            JoinMatch.Handle(p, Data);
                            break;

                        case 33:
                            LeaveMatch.Handle(p);
                            break;

                        case 38:
                            ChangeSlot.Handle(p, Data);
                            break;

                        case 39:
                            MatchReady.Handle(p);
                            break;

                        case 40:
                            SlotLock.Handle(p, Data);
                            break;

                        case 41:
                            MatchSettings.Handle(p, Data);
                            break;

                        case 44:
                            MatchStart.Handle(p, Data);
                            break;

                        case 49:
                            MatchFinished.Handle(p);
                            break;

                        case 51:
                            ModsChange.Handle(p, Data);
                            break;

                        case 52:
                            MatchLoaded.Handle(p);
                            break;

                        case 54:
                            NoBeatmap.Handle(p);
                            break;

                        case 55:
                            MatchReady.Handle(p);
                            break;

                        case 56:
                            MatchFailed.Handle(p);
                            break;

                        case 59:
                            HasBeatmap.Handle(p);
                            break;

                        case 60:
                            MatchSkip.Handle(p);
                            break;

                        case 63:
                            ChannelJoinEvent.Handle(p, Data);
                            break;

                        case 70:
                            ChangeHost.Handle(p, Data);
                            break;

                        case 73:
                            AddFriend.Handle(p, Data);
                            break;

                        case 74:
                            RemoveFriend.Handle(p, Data);
                            break;

                        case 77:
                            ChangeTeam.Handle(p, Data);
                            break;

                        case 78:
                            ChannelLeaveEvent.Handle(p, Data);
                            break;

                        case 85:
                            StatsUpdateRequest.Handle(p, Data);
                            break;

                        case 90:
                            MatchChangePassword.Handle(p, Data);
                            break;

                        default:
                            Log.LogFormat($"%#FFFF%Unhandled Packet {Id} with {Length}");
                            break;
                        }
                    }
                }

            if (p.StreamLength != 0)
            {
                p.StreamCopyTo(ctx.Response.OutputStream);
            }
            ctx.Response.Close();
        }
 public async Task <IActionResult> AddFriend([FromBody] AddFriend command)
 => Json(await _friendService.AddFriendAsync(UserId, command.friendID));
Example #19
0
        public async Task SendAddPerson(string from, string to, string msg)
        {
            string uid    = string.Empty;
            string connId = string.Empty;

            if (UserIdByClient.ContainsKey(Context.ConnectionId))
            {
                uid = UserIdByClient[Context.ConnectionId];
            }

            if (ClientByUserId.ContainsKey(to))
            {
                connId = ClientByUserId[to];
            }

            var model = FriendNotificationRepository.Find(f =>
                                                          (f.FromUserId == new Guid(from) && f.ToUserId == new Guid(to)) || (f.FromUserId == new Guid(to) && f.ToUserId == new Guid(from))
                                                          ).FirstOrDefault();

            if (model == null)
            {
                //通知添加到数据库
                model            = new FriendNotification();
                model.Id         = Guid.NewGuid();
                model.State      = 1;
                model.FromUserId = new Guid(uid);
                model.FromUser   = UsersRepository.Load(model.FromUserId);
                model.ToUserId   = new Guid(to);
                model.ToUser     = UsersRepository.Load(model.ToUserId);
                model.Message    = msg;
                model.CreateTime = DateTime.Now;
                model.UpdateTime = DateTime.Now;

                FriendNotificationRepository.Add(model);
                FriendNotificationRepository.SaveChanges();
            }
            else
            {
                if (model.State != 3)
                {
                    model.State      = 1;
                    model.Message    = msg;
                    model.UpdateTime = DateTime.Now;

                    FriendNotificationRepository.SaveChanges();
                }
            }

            if (new Guid(uid) == model.ToUserId)
            {
                await Clients.Client(Context.ConnectionId).SendAsync("OnlineCallbackFunc", "你们已经是好友了,无法重复添加");
            }
            else
            {
                AddFriend friend = new AddFriend();
                friend.Id         = model.Id.ToString().ToLower();
                friend.Type       = MessageType.AddUser;
                friend.FromUid    = uid;
                friend.ToUid      = to;
                friend.Message    = msg;
                friend.State      = model.State;
                friend.UserName   = model.FromUser.UserName;
                friend.NickName   = model.FromUser.NickName;
                friend.HeadImg    = model.FromUser.HeadImg;
                friend.CreateTime = model.FromUser.CreateTime;
                friend.UpdateTime = model.FromUser.UpdateTime;

                if (!string.IsNullOrEmpty(connId) && model.State == 1)
                {
                    await Clients.Client(connId).SendAsync("ClientNoticeRemind", friend.ToJsonString());
                }
            }
        }
Example #20
0
 public void MergeFrom(Quest other)
 {
     if (other == null)
     {
         return;
     }
     if (other.QuestType != 0)
     {
         QuestType = other.QuestType;
     }
     if (other.dailyQuest_ != null)
     {
         if (dailyQuest_ == null)
         {
             dailyQuest_ = new global::POGOProtos.Data.Quests.DailyQuest();
         }
         DailyQuest.MergeFrom(other.DailyQuest);
     }
     if (other.multiPart_ != null)
     {
         if (multiPart_ == null)
         {
             multiPart_ = new global::POGOProtos.Data.Quests.Quest.Types.MultiPartQuest();
         }
         MultiPart.MergeFrom(other.MultiPart);
     }
     if (other.catchPokemon_ != null)
     {
         if (catchPokemon_ == null)
         {
             catchPokemon_ = new global::POGOProtos.Data.Quests.CatchPokemonQuest();
         }
         CatchPokemon.MergeFrom(other.CatchPokemon);
     }
     if (other.addFriend_ != null)
     {
         if (addFriend_ == null)
         {
             addFriend_ = new global::POGOProtos.Data.Quests.AddFriendQuest();
         }
         AddFriend.MergeFrom(other.AddFriend);
     }
     if (other.tradePokemon_ != null)
     {
         if (tradePokemon_ == null)
         {
             tradePokemon_ = new global::POGOProtos.Data.Quests.TradePokemonQuest();
         }
         TradePokemon.MergeFrom(other.TradePokemon);
     }
     if (other.QuestId.Length != 0)
     {
         QuestId = other.QuestId;
     }
     if (other.QuestSeed != 0L)
     {
         QuestSeed = other.QuestSeed;
     }
     if (other.QuestContext != 0)
     {
         QuestContext = other.QuestContext;
     }
     if (other.TemplateId.Length != 0)
     {
         TemplateId = other.TemplateId;
     }
     if (other.Progress != 0)
     {
         Progress = other.Progress;
     }
     if (other.goal_ != null)
     {
         if (goal_ == null)
         {
             goal_ = new global::POGOProtos.Data.Quests.QuestGoal();
         }
         Goal.MergeFrom(other.Goal);
     }
     if (other.Status != 0)
     {
         Status = other.Status;
     }
     questRewards_.Add(other.questRewards_);
     if (other.CreationTimestampMs != 0L)
     {
         CreationTimestampMs = other.CreationTimestampMs;
     }
     if (other.LastUpdateTimestampMs != 0L)
     {
         LastUpdateTimestampMs = other.LastUpdateTimestampMs;
     }
     if (other.CompeletionTimestampMs != 0L)
     {
         CompeletionTimestampMs = other.CompeletionTimestampMs;
     }
     if (other.FortId.Length != 0)
     {
         FortId = other.FortId;
     }
     if (other.AdminGenerated != false)
     {
         AdminGenerated = other.AdminGenerated;
     }
     if (other.StampCountOverrideEnabled != false)
     {
         StampCountOverrideEnabled = other.StampCountOverrideEnabled;
     }
     if (other.StampCountOverride != 0)
     {
         StampCountOverride = other.StampCountOverride;
     }
     if (other.S2CellId != 0L)
     {
         S2CellId = other.S2CellId;
     }
     if (other.StoryQuestTemplateVersion != 0)
     {
         StoryQuestTemplateVersion = other.StoryQuestTemplateVersion;
     }
     _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
 }
Example #21
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (QuestType != 0)
            {
                hash ^= QuestType.GetHashCode();
            }
            if (dailyQuest_ != null)
            {
                hash ^= DailyQuest.GetHashCode();
            }
            if (multiPart_ != null)
            {
                hash ^= MultiPart.GetHashCode();
            }
            if (catchPokemon_ != null)
            {
                hash ^= CatchPokemon.GetHashCode();
            }
            if (addFriend_ != null)
            {
                hash ^= AddFriend.GetHashCode();
            }
            if (tradePokemon_ != null)
            {
                hash ^= TradePokemon.GetHashCode();
            }
            if (QuestId.Length != 0)
            {
                hash ^= QuestId.GetHashCode();
            }
            if (QuestSeed != 0L)
            {
                hash ^= QuestSeed.GetHashCode();
            }
            if (QuestContext != 0)
            {
                hash ^= QuestContext.GetHashCode();
            }
            if (TemplateId.Length != 0)
            {
                hash ^= TemplateId.GetHashCode();
            }
            if (Progress != 0)
            {
                hash ^= Progress.GetHashCode();
            }
            if (goal_ != null)
            {
                hash ^= Goal.GetHashCode();
            }
            if (Status != 0)
            {
                hash ^= Status.GetHashCode();
            }
            hash ^= questRewards_.GetHashCode();
            if (CreationTimestampMs != 0L)
            {
                hash ^= CreationTimestampMs.GetHashCode();
            }
            if (LastUpdateTimestampMs != 0L)
            {
                hash ^= LastUpdateTimestampMs.GetHashCode();
            }
            if (CompeletionTimestampMs != 0L)
            {
                hash ^= CompeletionTimestampMs.GetHashCode();
            }
            if (FortId.Length != 0)
            {
                hash ^= FortId.GetHashCode();
            }
            if (AdminGenerated != false)
            {
                hash ^= AdminGenerated.GetHashCode();
            }
            if (StampCountOverrideEnabled != false)
            {
                hash ^= StampCountOverrideEnabled.GetHashCode();
            }
            if (StampCountOverride != 0)
            {
                hash ^= StampCountOverride.GetHashCode();
            }
            if (S2CellId != 0L)
            {
                hash ^= S2CellId.GetHashCode();
            }
            if (StoryQuestTemplateVersion != 0)
            {
                hash ^= StoryQuestTemplateVersion.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Example #22
0
        /// <summary>
        /// Handle the Action Based on the input Model Api Action type.
        /// Conrtoll Flow can divert based on respective Api Action.
        /// </summary>
        /// <param name="inputModel">Chat Common Input Model.</param>
        /// <returns>Chat Common Ouput Model.</returns>
        /// <seealso cref="SocialCommunicationModels.ChatInputAndOutputModels.InputModel.ApiAction"/>
        /// <seealso cref="SocialCommunicationModels.ChatInputAndOutputModels.InputModel"/>
        /// <seealso cref="SocialCommunicationModels.ChatInputAndOutputModels.OutputModel"/>
        public async Task <OutputModel> ChatApiActionFlow(InputModel inputModel)
        {
            OutputModel outputModel;

            if (inputModel?.ApiAction == null)
            {
                return(new OutputModel()
                {
                    ExecutionalStatus = ExecutionStatusEnums.ExecutionStatus.ActionTypeRequired,
                });
            }

            switch (inputModel.ApiAction)
            {
            case ChatApiActionEnums.ChatApiActions.Registration:
                // Test Input Json  : {"ApiAction":100,"chatRegisterUserModel":{"UserName":"******"}}
                // Test Output Json : {"chatRegisterUserOutput":{"userName":"******","userId":23},"chatRegisteredUsers":null,"chatRegisteredUserFriends":null,"responseModel":{"executionStatus":1,"errorStatus":0,"errorMessage":""},"errorMessage":null,"innerException":null,"stackTrace":null,"executionalStatus":1003,"executionalStatusMessage":"Success"}

                ChatUserRegistration chatUserRegistration = new ChatUserRegistration();
                outputModel = chatUserRegistration.UserRegistration(inputModel);

                break;

            case ChatApiActionEnums.ChatApiActions.GetGolbalChatUsersList:
                // Test Input Json  : {"ApiAction":101,"chatRegisterUserModel":{}}
                // Test Output Json : {"chatRegisterUserOutput":null,"chatRegisteredUsers":[{"userName":"******","userId":1},{"userName":"******","userId":3},{"userName":"******","userId":4},{"userName":"******","userId":5},{"userName":"******","userId":6},{"userName":"******","userId":7},{"userName":"******","userId":8},{"userName":"******","userId":9},{"userName":"******","userId":10},{"userName":"******","userId":11},{"userName":"******","userId":12},{"userName":"******","userId":16},{"userName":"******","userId":17},{"userName":"******","userId":20},{"userName":"******","userId":21},{"userName":"******","userId":22},{"userName":"******","userId":23}],"chatRegisteredUserFriends":null,"responseModel":null,"errorMessage":null,"innerException":null,"stackTrace":null,"executionalStatus":1003,"executionalStatusMessage":"Success"}

                GetChatRegisteredUsers getChatRegisteredUsers = new GetChatRegisteredUsers();

                outputModel = getChatRegisteredUsers.ChatRegisteredUsersGet(inputModel);

                break;

            case ChatApiActionEnums.ChatApiActions.GetUserFriendsList:
                // Test Input Json  : {"ApiAction":102,"chatRegisterUserModel":{"UserId":1}}
                // Test Output Json : {"chatRegisterUserOutput":null,"chatRegisteredUsers":null,"chatRegisteredUserFriends":[{"userName":"******","userId":3},{"userName":"******","userId":4}],"responseModel":null,"errorMessage":null,"innerException":null,"stackTrace":null,"executionalStatus":1003,"executionalStatusMessage":"Success"}

                GetChatRegisteredUserFriends getChatRegisteredUserFriends = new GetChatRegisteredUserFriends();

                outputModel = getChatRegisteredUserFriends.ChatRegisteredUserFriends(inputModel);

                break;

            case ChatApiActionEnums.ChatApiActions.GetUsersWithoutFriends:
                // Test Input Json  : {"ApiAction":102,"chatRegisterUserModel":{"UserId":1}}
                // Test Output Json : {"chatRegisterUserOutput":null,"chatRegisteredUsers":null,"chatRegisteredUserFriends":[{"userName":"******","userId":3},{"userName":"******","userId":4}],"responseModel":null,"errorMessage":null,"innerException":null,"stackTrace":null,"executionalStatus":1003,"executionalStatusMessage":"Success"}

                GetChatUsersWithoutFriends getChatUsersWithoutFriends = new GetChatUsersWithoutFriends();

                outputModel = getChatUsersWithoutFriends.ChatUsersWithoutFriendsGet(inputModel);

                break;

            case ChatApiActionEnums.ChatApiActions.AddFriend:
                // Test Input Json  : {"ApiAction":104,"addFriend":{"UserId":70,"AddingFriendUserId":23}}
                // Test Output Json : {"responseModel":{"executionStatus":1,"errorStatus":0,"errorMessage":""},"errorMessage":null,"innerException":null,"stackTrace":null,"executionalStatus":1003,"executionalStatusMessage":"Success"}

                AddFriend addFriend = new AddFriend();

                outputModel = addFriend.FriendAdding(inputModel);

                break;

            case ChatApiActionEnums.ChatApiActions.GetUserApplicationDetails:
                // Test Input Json  : {"ApiAction":105,"chatRegisterUserModel":{"UserId":1}}
                // Test Output Json : {"userApplicationDetailsModel":{"userName":"******","online":false,"recentChatUsers":null},"responseModel":{"executionStatus":1,"errorStatus":0,"errorMessage":""},"errorMessage":null,"innerException":null,"stackTrace":null,"executionalStatus":1003,"executionalStatusMessage":"Success"}

                var getChatUserApplicationDetails = new GetChatUserApplicationDetails();

                outputModel = getChatUserApplicationDetails.GetChatUserAppDetails(inputModel);

                break;

            default:
                outputModel = new OutputModel()
                {
                    ExecutionalStatus = ExecutionStatusEnums.ExecutionStatus.NoSuchAction,
                };
                break;
            }

            return(await Task.FromResult(outputModel));
        }
Example #23
0
        private void btn_add_Click(object sender, RoutedEventArgs e)
        {
            AddFriend AddF = new AddFriend();

            AddF.Show();
        }
Example #24
0
    public override bool acceptMessageData(BinaryReader messageDataReader, TreeView outputTreeView)
    {
        bool handled = true;

        PacketOpcode opcode = Util.readOpcode(messageDataReader);

        switch (opcode)
        {
        case PacketOpcode.Evt_Social__ClearFriends_ID: {
            EmptyMessage message = new EmptyMessage(opcode);
            message.contributeToTreeView(outputTreeView);
            break;
        }

        case PacketOpcode.Evt_Social__RemoveFriend_ID: {
            RemoveFriend message = RemoveFriend.read(messageDataReader);
            message.contributeToTreeView(outputTreeView);
            break;
        }

        case PacketOpcode.Evt_Social__AddFriend_ID: {
            AddFriend message = AddFriend.read(messageDataReader);
            message.contributeToTreeView(outputTreeView);
            break;
        }

        case PacketOpcode.Evt_Social__FriendsUpdate_ID: {
            FriendsUpdate message = FriendsUpdate.read(messageDataReader);
            message.contributeToTreeView(outputTreeView);
            break;
        }

        // TODO: AddCharacterTitle
        case PacketOpcode.Evt_Social__CharacterTitleTable_ID: {
            CharacterTitleTable message = CharacterTitleTable.read(messageDataReader);
            message.contributeToTreeView(outputTreeView);
            break;
        }

        case PacketOpcode.Evt_Social__AddOrSetCharacterTitle_ID: {
            AddOrSetCharacterTitle message = AddOrSetCharacterTitle.read(messageDataReader);
            message.contributeToTreeView(outputTreeView);
            break;
        }

        case PacketOpcode.Evt_Social__SetDisplayCharacterTitle_ID: {
            SetDisplayCharacterTitle message = SetDisplayCharacterTitle.read(messageDataReader);
            message.contributeToTreeView(outputTreeView);
            break;
        }

        case PacketOpcode.Evt_Social__SendClientContractTrackerTable_ID: {
            SendClientContractTrackerTable message = SendClientContractTrackerTable.read(messageDataReader);
            message.contributeToTreeView(outputTreeView);
            break;
        }

        case PacketOpcode.Evt_Social__SendClientContractTracker_ID: {
            SendClientContractTracker message = SendClientContractTracker.read(messageDataReader);
            message.contributeToTreeView(outputTreeView);
            break;
        }

        case PacketOpcode.Evt_Social__AbandonContract_ID: {
            AbandonContract message = AbandonContract.read(messageDataReader);
            message.contributeToTreeView(outputTreeView);
            break;
        }

        default: {
            handled = false;
            break;
        }
        }

        return(handled);
    }