예제 #1
0
        /// <summary>
        /// Gets the error label text detail.
        /// </summary>
        /// <param name="value">The value.</param>
        private static string GetErrorLabelTextDetail(IAPIResult result)
        {
            switch (result.ErrorType)
            {
            case APIEnumerations.APIErrors.None:
                return("No error specified");

            case APIEnumerations.APIErrors.CCP:
                return(String.Format(CultureConstants.DefaultCulture,
                                     "CCP Error {0} : {1}",
                                     result.CCPError.ErrorCode,
                                     result.CCPError.ErrorMessage));

            case APIEnumerations.APIErrors.Http:
                return(String.Format(CultureConstants.DefaultCulture,
                                     "HTTP error: {0}", result.ErrorMessage));

            case APIEnumerations.APIErrors.Xml:
                return(String.Format(CultureConstants.DefaultCulture,
                                     "XML error: {0}", result.ErrorMessage));

            case APIEnumerations.APIErrors.Xslt:
                return(String.Format(CultureConstants.DefaultCulture,
                                     "XSLT error: {0}", result.ErrorMessage));

            default:
                throw new NotImplementedException();
            }
        }
예제 #2
0
        /// <summary>
        /// Checks whether we should notify an error.
        /// </summary>
        /// <param name="result"></param>
        /// <param name="method"></param>
        /// <returns></returns>
        internal bool ShouldNotifyError(IAPIResult result, Enum method)
        {
            // Notify an error occurred
            if (result.HasError)
            {
                if (!m_errorNotifiedMethod.Equals(CCPAPIMethodsEnum.None))
                {
                    return(false);
                }

                m_errorNotifiedMethod = method;
                return(true);
            }

            // Removes the previous error notification
            if (!m_errorNotifiedMethod.Equals(method))
            {
                return(false);
            }

            EveMonClient.Notifications.InvalidateCharacterAPIError(this);
            m_errorNotifiedMethod = CCPAPIMethodsEnum.None;

            return(false);
        }
예제 #3
0
 private static void CheckForError(IAPIResult response)
 {
     if (response is ErrorResult)
     {
         var temp = (ErrorResult)response;
         throw new RPCException(temp.error);
     }
 }
예제 #4
0
        /// <summary>
        /// Gets the XML data from the result.
        /// </summary>
        /// <param name="result">The result.</param>
        /// <returns></returns>
        private static string GetXmlData(IAPIResult result)
        {
            if (result == null || result.XmlDocument == null)
            {
                return("There was no associated XML document.");
            }

            return(Util.GetXmlStringRepresentation(result.XmlDocument));
        }
예제 #5
0
        /// <summary>
        /// Notifies EVE Backend Database is temporarily disabled.
        /// </summary>
        /// <param name="character"></param>
        /// <param name="result"></param>
        internal void NotifyEVEBackendDatabaseDisabled(IAPIResult result)
        {
            var notification = new APIErrorNotification(null, result)
            {
                Description = result.ErrorMessage,
                Behaviour   = NotificationBehaviour.Overwrite,
                Priority    = NotificationPriority.Error
            };

            Notify(notification);
        }
예제 #6
0
        /// <summary>
        /// Checks whether we should notify an error.
        /// </summary>
        /// <param name="result"></param>
        /// <param name="method"></param>
        /// <returns></returns>
        internal bool ShouldNotifyError(IAPIResult result, Enum method)
        {
            // Checks if EVE database is out of service
            if (result.EVEDatabaseError)
            {
                return(false);
            }

            // We don't want to be notified about corp roles error
            if (result.CCPError != null && result.CCPError.IsCorpRolesError)
            {
                return(false);
            }

            // We don't want to be notified about kill log exhausted error
            if (result.CCPError != null && result.CCPError.IsKillLogExhaustedError)
            {
                return(false);
            }

            // We don't want to be notified about not enlisted in factional warfare error
            if (result.CCPError != null && result.CCPError.IsFactionalWarfareEnlistedError)
            {
                return(false);
            }

            // Notify an error occurred
            if (result.HasError)
            {
                if (!m_errorNotifiedMethod.Equals(CCPAPIMethodsEnum.None))
                {
                    return(false);
                }

                m_errorNotifiedMethod = method;
                return(true);
            }

            // Removes the previous error notification
            if (!m_errorNotifiedMethod.Equals(method))
            {
                return(false);
            }

            EveMonClient.Notifications.InvalidateCharacterAPIError(this);
            m_errorNotifiedMethod = CCPAPIMethodsEnum.None;

            return(false);
        }
예제 #7
0
        /// <summary>
        /// Checks whether we should notify an error.
        /// </summary>
        /// <param name="result"></param>
        /// <returns></returns>
        private bool ShouldNotifyError(IAPIResult result, APIMethods method)
        {
            // Notify an error occured
            if (result.HasError)
            {
                if (m_errorNotifiedMethod != APIMethods.None)
                {
                    return(false);
                }

                m_errorNotifiedMethod = method;
                return(true);
            }

            // Removes the previous error notification.
            if (m_errorNotifiedMethod == method)
            {
                EveClient.Notifications.InvalidateCharacterAPIError(this);
                m_errorNotifiedMethod = APIMethods.None;
            }
            return(false);
        }
예제 #8
0
        /// <summary>
        /// Gets the error label text detail.
        /// </summary>
        /// <param name="result">The value.</param>
        private static string GetErrorLabelTextDetail(IAPIResult result)
        {
            switch (result.ErrorType)
            {
            case Common.Enumerations.CCPAPI.CCPAPIErrors.None:
                return("No error specified");

            case Common.Enumerations.CCPAPI.CCPAPIErrors.CCP:
                return($"CCP Error {result.CCPError.ErrorCode} : {result.CCPError.ErrorMessage}");

            case Common.Enumerations.CCPAPI.CCPAPIErrors.Http:
                return($"HTTP error: {result.ErrorMessage}");

            case Common.Enumerations.CCPAPI.CCPAPIErrors.Xml:
                return($"XML error: {result.ErrorMessage}");

            case Common.Enumerations.CCPAPI.CCPAPIErrors.Xslt:
                return($"XSLT error: {result.ErrorMessage}");

            default:
                throw new NotImplementedException();
            }
        }
예제 #9
0
        /// <summary>
        /// Gets the error label text detail.
        /// </summary>
        /// <param name="result">The value.</param>
        private static string GetErrorLabelTextDetail(IAPIResult result)
        {
            switch (result.ErrorType)
            {
            case APIErrorType.None:
                return("No error specified");

            case APIErrorType.CCP:
                return($"CCP Error: {result.ErrorMessage}");

            case APIErrorType.Http:
                return($"HTTP error: {result.ErrorMessage}");

            case APIErrorType.Xml:
                return($"XML error: {result.ErrorMessage}");

            case APIErrorType.Json:
                return($"XSLT error: {result.ErrorMessage}");

            default:
                throw new NotImplementedException();
            }
        }
예제 #10
0
        /// <summary>
        /// Checks whether we should notify an error.
        /// </summary>
        /// <param name="result"></param>
        /// <param name="method"></param>
        /// <returns></returns>
        internal bool ShouldNotifyError(IAPIResult result, Enum method)
        {
            // Checks if EVE database is out of service
            if (result.EVEDatabaseError)
                return false;

            // We don't want to be notified about corp roles error
            if (result.CCPError != null && result.CCPError.IsCorpRolesError)
                return false;

            // We don't want to be notified about kill log exhausted error
            if (result.CCPError != null && result.CCPError.IsKillLogExhaustedError)
                return false;

            // We don't want to be notified about not enlisted in factional warfare error
            if (result.CCPError != null && result.CCPError.IsFactionalWarfareEnlistedError)
                return false;

            // Notify an error occurred
            if (result.HasError)
            {
                if (!m_errorNotifiedMethod.Equals(CCPAPIMethodsEnum.None))
                    return false;

                m_errorNotifiedMethod = method;
                return true;
            }

            // Removes the previous error notification
            if (!m_errorNotifiedMethod.Equals(method))
                return false;

            EveMonClient.Notifications.InvalidateCharacterAPIError(this);
            m_errorNotifiedMethod = CCPAPIMethodsEnum.None;

            return false;
        }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="result">The result.</param>
 public APIErrorNotificationEventArgs(object sender, IAPIResult result)
     : base(sender, NotificationCategory.QueryingError)
 {
     Result = result;
 }
예제 #12
0
 public static DataNode FromAPIResult(IAPIResult input)
 {
     return(FromObject(input, null));
 }
예제 #13
0
 /// <summary>
 /// Checks whether the query must be retrieved with CCP as the default provider.
 /// </summary>
 /// <param name="result"></param>
 /// <returns></returns>
 private bool ShouldRetryWithCCP(IAPIResult result)
 => s_ccpProvider != this && s_ccpTestProvider != this && result.HasError &&
 result.ErrorType != CCPAPIErrors.CCP;
예제 #14
0
        /// <summary>
        /// Checks whether we should notify an error.
        /// </summary>
        /// <param name="result"></param>
        /// <param name="method"></param>
        /// <returns></returns>
        internal bool ShouldNotifyError(IAPIResult result, APIMethods method)
        {
            // Notify an error occurred
            if (result.HasError)
            {
                // Checks if EVE Backend Database is temporarily disabled
                if (result.EVEBackendDatabaseDisabled)
                    return false;

                if (m_errorNotifiedMethod != APIMethods.None)
                    return false;

                m_errorNotifiedMethod = method;
                return true;
            }

            // Removes the previous error notification
            if (m_errorNotifiedMethod == method)
            {
                EveClient.Notifications.InvalidateCharacterAPIError(this);
                m_errorNotifiedMethod = APIMethods.None;
            }
            return false;
        }
예제 #15
0
        /// <summary>
        /// Gets the error label text detail.
        /// </summary>
        /// <param name="result">The value.</param>
        private static string GetErrorLabelTextDetail(IAPIResult result)
        {
            switch (result.ErrorType)
            {
                case Common.Enumerations.CCPAPI.CCPAPIErrors.None:
                    return "No error specified";

                case Common.Enumerations.CCPAPI.CCPAPIErrors.CCP:
                    return $"CCP Error {result.CCPError.ErrorCode} : {result.CCPError.ErrorMessage}";

                case Common.Enumerations.CCPAPI.CCPAPIErrors.Http:
                    return $"HTTP error: {result.ErrorMessage}";

                case Common.Enumerations.CCPAPI.CCPAPIErrors.Xml:
                    return $"XML error: {result.ErrorMessage}";

                case Common.Enumerations.CCPAPI.CCPAPIErrors.Xslt:
                    return $"XSLT error: {result.ErrorMessage}";

                default:
                    throw new NotImplementedException();
            }
        }
예제 #16
0
        /// <summary>
        /// Gets the XML data from the result.
        /// </summary>
        /// <param name="result">The result.</param>
        /// <returns></returns>
        private static string GetXmlData(IAPIResult result)
        {
            if (result == null || result.XmlDocument == null)
                return "There was no associated XML document.";

            return Util.GetXmlStringRepresentation(result.XmlDocument);
        }
예제 #17
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="category"></param>
 /// <param name="sender"></param>
 public APIErrorNotification(Object sender, IAPIResult result)
     : base(NotificationCategory.QueryingError, sender)
 {
     m_result = result;
 }
예제 #18
0
        /// <summary>
        /// Gets the error label text detail.
        /// </summary>
        /// <param name="value">The value.</param>
        private static string GetErrorLabelTextDetail(IAPIResult result)
        {
            switch (result.ErrorType)
            {
                case APIEnumerations.APIErrors.None:
                    return "No error specified";

                case APIEnumerations.APIErrors.CCP:
                    return String.Format(CultureConstants.DefaultCulture,
                        "CCP Error {0} : {1}",
                        result.CCPError.ErrorCode,
                        result.CCPError.ErrorMessage);

                case APIEnumerations.APIErrors.Http:
                    return String.Format(CultureConstants.DefaultCulture,
                        "HTTP error: {0}", result.ErrorMessage);

                case APIEnumerations.APIErrors.Xml:
                    return String.Format(CultureConstants.DefaultCulture,
                        "XML error: {0}", result.ErrorMessage);

                case APIEnumerations.APIErrors.Xslt:
                    return String.Format(CultureConstants.DefaultCulture,
                        "XSLT error: {0}", result.ErrorMessage);

                default:
                    throw new NotImplementedException();
            }
        }
예제 #19
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="result">The result.</param>
 public APIErrorNotificationEventArgs(Object sender, IAPIResult result)
     : base(sender, NotificationCategory.QueryingError)
 {
     Result = result;
 }
예제 #20
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="category"></param>
 /// <param name="sender"></param>
 public APIErrorNotification(Object sender, IAPIResult result)
     : base(NotificationCategory.QueryingError, sender)
 {
     m_result = result;
 }
예제 #21
0
 /// <summary>
 /// Checks whether the query must be retrieved with CCP as the default provider.
 /// </summary>
 /// <param name="result"></param>
 /// <returns></returns>
 private bool ShouldRetryWithCCP(IAPIResult result)
 {
     return(s_ccpProvider != this && s_ccpTestProvider != this && result.HasError && result.ErrorType != APIEnumerations.APIErrors.CCP);
 }