Exemple #1
0
        private int CheckSessionStatus(string htmlContent)
        {
            lock (_locker)
            {
                int status;

                if (htmlContent.Equals(Constants.ERROR))
                {
                    status = (int)Enums.SESSION_STATUS.UNKNOWN;
                    //OnErrorOccurred("Error occurred.");
                }
                else if (htmlContent.Contains("ticket/index.php") || htmlContent.Contains("index.php?page=ticket"))
                {
                    status = (int)Enums.SESSION_STATUS.VALID;
                }
                else
                {
                    status = (int)Enums.SESSION_STATUS.INVALID;
                }

                if (_sessionStatus != status)
                {
                    _sessionStatus = status;

                    SessionStatusEventArgs sessionStatusEvent = new SessionStatusEventArgs(_sessionStatus);

                    OnSessionStatusChange(sessionStatusEvent);
                }
                return(_sessionStatus);
            }
        }
Exemple #2
0
 /// <summary>
 /// The method which fires the Event.
 /// </summary>
 /// <param name="sessionStatusEvent"></param>
 protected void OnSessionStatusChange(SessionStatusEventArgs sessionStatusEvent)
 {
     // Check if there are any Subscribers
     if (SessionStatusChange != null)
     {
         // Call the Event
         SessionStatusChange(sessionStatusEvent);
     }
 }
Exemple #3
0
        private int CheckSessionStatus(string htmlContent)
        {
            lock (_locker)
            {
                int status;

                if (htmlContent.StartsWith(Constants.SESSION_INVALID))
                {
                    if (htmlContent.StartsWith(Constants.SESSION_EMPTY))
                    {
                        status = (int)Enums.SESSION_STATUS.INVALID;
                        OnErrorOccurred("Your session has expired.\n\nPlease login again to this universe.");
                    }
                    else if (htmlContent.Contains(Constants.PAGE_ERROR))
                    {
                        status = (int)Enums.SESSION_STATUS.VALID;
                        OnErrorOccurred("OGame server unexpectedly experience an internal error.");
                    }
                    else
                    {
                        status = (int)Enums.SESSION_STATUS.INVALID;
                    }
                }
                else if (htmlContent.Equals(Constants.ERROR))
                {
                    status = (int)Enums.SESSION_STATUS.UNKNOWN;
                    OnErrorOccurred("Error occurred.");
                }
                else
                {
                    status = (int)Enums.SESSION_STATUS.VALID;
                }

                if (_sessionStatus != status)
                {
                    _sessionStatus = status;

                    SessionStatusEventArgs sessionStatusEvent = new SessionStatusEventArgs(_sessionStatus);

                    OnSessionStatusChange(sessionStatusEvent);
                }
                return(_sessionStatus);
            }
        }