mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-04-19 03:27:29 +02:00
Code updated to 3.0.238
This commit is contained in:
parent
3302d80678
commit
9c6a1fa92b
257 changed files with 7763 additions and 2861 deletions
|
@ -1,4 +1,4 @@
|
|||
namespace TINK.Model.Repository.Exception
|
||||
namespace TINK.Repository.Exception
|
||||
{
|
||||
/// <summary>
|
||||
/// Is fired with reqest used a cookie which is not defined.
|
||||
|
@ -15,11 +15,25 @@
|
|||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether authcookie is defined or not.
|
||||
/// </summary>
|
||||
/// <param name="reponse">Response to check</param>
|
||||
/// <param name="actionText">Text holding contectin in which authcookie is checked.</param>
|
||||
/// <param name="exception">Exception thrown if cookie is not defined.</param>
|
||||
/// <returns></returns>
|
||||
public static bool IsAuthcookieNotDefined(
|
||||
Response.ResponseBase reponse,
|
||||
string actionText,
|
||||
out AuthcookieNotDefinedException exception)
|
||||
{
|
||||
if (reponse == null || reponse.response_state == null)
|
||||
{
|
||||
// Empty response or response withoud response state is no authcookie not defined exeception.
|
||||
exception = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!reponse.response_state.ToUpper().Contains(AUTH_FAILURE_QUERY_AUTHCOOKIENOTDEFIED.ToUpper())
|
||||
&& !reponse.response_state.ToUpper().Contains(AUTH_FAILURE_BOOK_AUTICOOKIENOTDEFIED.ToUpper())
|
||||
&& !reponse.response_state.ToUpper().Contains(AUTH_FAILURE_BIKESOCCUPIED_AUTICOOKIENOTDEFIED.ToUpper())
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace TINK.Model.Repository.Exception
|
||||
namespace TINK.Repository.Exception
|
||||
{
|
||||
public class InvalidAuthorizationResponseException : InvalidResponseException<Response.ResponseBase>
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace TINK.Model.Repository.Exception
|
||||
namespace TINK.Repository.Exception
|
||||
{
|
||||
/// <summary> Handles booking request which fail due to too many bikes requested/ booked.</summary>
|
||||
public class BookingDeclinedException : InvalidResponseException
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace TINK.Model.Repository.Exception
|
||||
namespace TINK.Repository.Exception
|
||||
{
|
||||
public class CallNotRequiredException : System.Exception
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace TINK.Model.Repository.Exception
|
||||
namespace TINK.Repository.Exception
|
||||
{
|
||||
public class CommunicationException : System.Exception
|
||||
{
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
using TINK.Model.Repository.Exception;
|
||||
|
||||
namespace TINK.Repository.Exception
|
||||
namespace TINK.Repository.Exception
|
||||
{
|
||||
public class DeserializationException : CommunicationException
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace TINK.Model.Repository.Exception
|
||||
namespace TINK.Repository.Exception
|
||||
{
|
||||
public class InvalidResponseException<T> : InvalidResponseException
|
||||
{
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using TINK.Model.Repository.Exception;
|
||||
|
||||
|
||||
namespace TINK.Repository.Exception
|
||||
{
|
||||
public class NoGPSDataException : InvalidResponseException
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace TINK.Model.Repository.Exception
|
||||
namespace TINK.Repository.Exception
|
||||
{
|
||||
public class NotAtStationException : InvalidResponseException
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using TINK.Model.Repository.Response;
|
||||
using TINK.Repository.Response;
|
||||
|
||||
namespace TINK.Repository.Exception
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using TINK.Model.Repository.Response;
|
||||
using TINK.Repository.Response;
|
||||
|
||||
namespace TINK.Repository.Exception
|
||||
{
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
namespace TINK.Repository.Exception
|
||||
{
|
||||
public class UnsupportedCopriVersionDetectedException : System.Exception
|
||||
{
|
||||
public UnsupportedCopriVersionDetectedException() : base("Unsupported app version detected.")
|
||||
{}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
namespace TINK.Model.Repository.Exception
|
||||
namespace TINK.Repository.Exception
|
||||
{
|
||||
public class WebConnectFailureException : CommunicationException
|
||||
{
|
||||
|
|
|
@ -1,42 +1,53 @@
|
|||
using System.Net;
|
||||
|
||||
namespace TINK.Model.Repository.Exception
|
||||
namespace TINK.Repository.Exception
|
||||
{
|
||||
public static class WebExceptionHelper
|
||||
{
|
||||
/// <summary> Gets if a exception is caused by an error connecting to copri (LAN or mobile data off/ not reachable, proxy, ...).</summary>
|
||||
/// <param name="p_oException">Expection to check.</param>
|
||||
/// <param name="exception">Expection to check.</param>
|
||||
/// <returns>True if exception if caused by an connection error. </returns>
|
||||
public static bool GetIsConnectFailureException(this System.Exception p_oException)
|
||||
public static bool GetIsConnectFailureException(this System.Exception exception)
|
||||
{
|
||||
var l_oException = p_oException as WebException;
|
||||
if (l_oException == null)
|
||||
#if !USCSHARP9
|
||||
if (!(exception is WebException webException))
|
||||
#else
|
||||
if (exception is not WebException webException)
|
||||
#endif
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return l_oException.Status == WebExceptionStatus.ConnectFailure // Happens if WLAN and mobile data is off/ Router denies internet access/ ...
|
||||
|| l_oException.Status == WebExceptionStatus.NameResolutionFailure // Happens sometimes when not WLAN and no mobil connection are available (bad connection in lift).
|
||||
|| l_oException.Status == WebExceptionStatus.ReceiveFailure; // Happened when modile was connected to WLAN
|
||||
return webException.Status == WebExceptionStatus.ConnectFailure // Happens if WLAN and mobile data is off/ Router denies internet access/ ...
|
||||
|| webException.Status == WebExceptionStatus.NameResolutionFailure // Happens sometimes when not WLAN and no mobil connection are available (bad connection in lift).
|
||||
|| webException.Status == WebExceptionStatus.ReceiveFailure; // Happened when modile was connected to WLAN
|
||||
}
|
||||
|
||||
/// <summary> Gets if a exception is caused by clicking too fast.</summary>
|
||||
/// <param name="p_oException">Expection to check.</param>
|
||||
/// <param name="exception">Expection to check.</param>
|
||||
/// <returns>True if exception if caused by a fast click sequence. </returns>
|
||||
public static bool GetIsForbiddenException(this System.Exception p_oException)
|
||||
public static bool GetIsForbiddenException(this System.Exception exception)
|
||||
{
|
||||
if (!(p_oException is WebException l_oException))
|
||||
#if !USCSHARP9
|
||||
if (!(exception is WebException webException))
|
||||
#else
|
||||
if (exception is not WebException webException)
|
||||
#endif
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(l_oException?.Response is HttpWebResponse l_oResponse))
|
||||
#if !USCSHARP9
|
||||
if (!(webException?.Response is HttpWebResponse response))
|
||||
#else
|
||||
if (webException?.Response is not HttpWebResponse response)
|
||||
#endif
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return l_oException.Status == WebExceptionStatus.ProtocolError
|
||||
&& l_oResponse.StatusCode == HttpStatusCode.Forbidden;
|
||||
return webException.Status == WebExceptionStatus.ProtocolError
|
||||
&& response.StatusCode == HttpStatusCode.Forbidden;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace TINK.Model.Repository.Exception
|
||||
namespace TINK.Repository.Exception
|
||||
{
|
||||
public class WebForbiddenException : CommunicationException
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue