Example #1
0
        /// <summary>
        /// Raises the <see cref="WarningMessage"/> event
        /// </summary>
        /// <param name="errorcode">A <see cref="ServerErrorCode"/> describing the warning</param>
        /// <param name="dp">The Datapacket of the transfer with the error</param>
        protected internal void OnWarning(ServerErrorCode errorcode, DataPacket dp)
        {
            // csammis:  Losing a secondary connection (chat room, icon downloader)
            // isn't cause for logging off the session...and setting LoggedIn to false
            // doesn't log off the session anyway.  Call .Logoff() for that.

            //if (errorcode == ServerErrorCode.LostSecondaryConnection)
            //    this.LoggedIn = false;

            if(dp != null)
            {
                Logging.WriteString("OnWarning: {0}, RequestId: {1}", errorcode.ToString(), dp.SNAC.RequestID);
            }

            if (this.WarningMessage != null)
            {
                this.WarningMessage(this, errorcode);
            }
        }
Example #2
0
        /// <summary>
        /// Raises the <see cref="ErrorMessage"/> event or the <see cref="LoginFailed"/> event
        /// </summary>
        /// <param name="errorcode">A <see cref="ServerErrorCode"/> describing the error</param>
        /// <param name="dp">The Datapacket of the transfer with the error</param>
        /// <remarks>If the login process has not completed, <see cref="LoginFailed"/> is raised.
        /// Otherwise, <see cref="ErrorMessage"/> is raised.</remarks>
        protected internal void OnError(ServerErrorCode errorcode, DataPacket dp)
        {
            if (dp != null) {
                Logging.WriteString("OnError: {0}, RequestId: {1}", errorcode.ToString(), dp.SNAC.RequestID);
            }

            if (!_loggedin)
            {
                if (this.LoginFailed != null)
                {
                    if (errorcode == ServerErrorCode.LostBOSConnection)
                    {
                        this.LoggedIn = false;
                        this.LoginFailed(this, LoginErrorCode.CantReachBOSServer);
                    }
                    else
                        this.LoginFailed(this, LoginErrorCode.UnknownError);
                }
            }
            else
            {
                if (this.ErrorMessage != null)
                    this.ErrorMessage(this, errorcode);
            }
        }