Exemplo n.º 1
0
        public async Task LoginUserToken(StandardCommand c)
        {
            if (c.SessionToken != null)
            {
                (ListOf_DBResult flag, string userName) = await HoloData.LoginUserToken(c.SessionToken);

                if (flag == ListOf_DBResult.Success)
                {
                    if (connectedUsers.ContainsKey(Context.ConnectionId))
                    {
                        connectedUsers[Context.ConnectionId].SessionToken = c.SessionToken;
                        await Clients.Caller.SendAsync("ServerLogin", flag, c.SessionToken, userName);

                        System.Console.WriteLine($"Token User: {Context.ConnectionId}");
                        System.Console.WriteLine($"Session Token: {c.SessionToken}");
                    }
                    else
                    {
                        System.Console.WriteLine("Bad Client Token");
                    }
                }
                else
                {
                    System.Console.WriteLine("Login Rejected");
                    await Clients.Caller.SendAsync("ServerLogin", flag);
                }
            }
        }
Exemplo n.º 2
0
        public async Task FetchAdventure(StandardCommand c)
        {
            if (c.SessionToken != null && connectedUsers.ContainsKey(Context.ConnectionId) && c.SessionToken == connectedUsers[Context.ConnectionId].SessionToken)
            {
                (ListOf_DBResult flag, Group group) = await HoloData.FetchAdventure(c.SessionToken);

                UpdateModel updateModel = new UpdateModel();
                updateModel.AddAdventure(group);
                ClientUpdates.SendUpdate(Clients.Caller, flag, updateModel);
            }
        }
Exemplo n.º 3
0
        public async Task FetchRoster(StandardCommand c)
        {
            if (c.SessionToken != null && connectedUsers.ContainsKey(Context.ConnectionId) && c.SessionToken == connectedUsers[Context.ConnectionId].SessionToken)
            {
                (ListOf_DBResult flag, List <Character> characters) = await HoloData.FetchCharacters(c.SessionToken);

                UpdateModel updateModel = new UpdateModel();
                updateModel.AddCharacters(characters);
                ClientUpdates.SendUpdate(Clients.Caller, flag, updateModel);
            }
        }