Exemplo n.º 1
0
        // -------------------------------------------------------------------------------
        // GetUserOnline
        // Checks if the user is online right now, using 'lastonline' time
        // -------------------------------------------------------------------------------
        public bool GetUserOnline(string userName)
        {
            TableUser tableUser = FindWithQuery <TableUser>("SELECT * FROM " + nameof(TableUser) + " WHERE username=? AND banned=0 AND deleted=0", userName);

            if (tableUser == null)
            {
                return(false);
            }
            else
            {
                DateTime dateTime = tableUser.lastonline.AddSeconds(logoutInterval);
                return(DateTime.Compare(DateTime.UtcNow, dateTime) <= 0);
            }
        }
        // -------------------------------------------------------------------------------
        // GetUserOnline
        //
        // -------------------------------------------------------------------------------
        public bool GetUserOnline(string userName)
        {
            TableUser tableUser = FindWithQuery <TableUser>("SELECT * FROM " + nameof(TableUser) + " WHERE username=? AND banned=0 AND deleted=0", userName);

            if (tableUser == null)
            {
                return(false);
            }
            else
            {
                DateTime dateTime = tableUser.lastonline.AddSeconds(saveInterval * 2.0f);

                debug.Log("<b>GetUserOnline</b>");
                debug.Log("original:" + tableUser.lastonline);
                debug.Log("modified:" + dateTime);
                debug.Log(DateTime.UtcNow + " / " + dateTime);



                return(DateTime.Compare(DateTime.UtcNow, dateTime) <= 0);
            }
        }