Version 3.0.338

This commit is contained in:
Anja Müller-Meißner 2022-09-06 16:08:19 +02:00 committed by Anja
parent 573fe77e12
commit 0468955d49
751 changed files with 62747 additions and 60672 deletions

View file

@ -3,15 +3,15 @@ using TINK.Model.Services.CopriApi.ServerUris;
namespace TINK.Services.CopriApi.ServerUris
{
public static class CopriHelper
{
public const string SHAREE_SILTEFOLDERNAME = "site";
public static class CopriHelper
{
public const string SHAREE_SILTEFOLDERNAME = "site";
/// <summary> Gets a value indicating whether a host is copri or not. </summary>
/// <param name="hostName">Host name.</param>
/// <returns>True if server is copri, fals if not.</returns>
public static bool GetIsCopri(this string hostName)
=> new Uri(CopriServerUriList.TINK_DEVEL).Host == hostName
|| new Uri(CopriServerUriList.TINK_LIVE).Host == hostName;
}
/// <summary> Gets a value indicating whether a host is copri or not. </summary>
/// <param name="hostName">Host name.</param>
/// <returns>True if server is copri, fals if not.</returns>
public static bool GetIsCopri(this string hostName)
=> new Uri(CopriServerUriList.TINK_DEVEL).Host == hostName
|| new Uri(CopriServerUriList.TINK_LIVE).Host == hostName;
}
}

View file

@ -5,88 +5,88 @@ using Newtonsoft.Json;
namespace TINK.Model.Services.CopriApi.ServerUris
{
[JsonObject(MemberSerialization.OptIn)]
sealed public class CopriServerUriList
{
/// <summary>
/// Holds the rest resource root name.
/// </summary>
public const string REST_RESOURCE_ROOT = "APIjsonserver";
[JsonObject(MemberSerialization.OptIn)]
sealed public class CopriServerUriList
{
/// <summary>
/// Holds the rest resource root name.
/// </summary>
public const string REST_RESOURCE_ROOT = "APIjsonserver";
/// <summary> Holds the URL of the TINK/Konrad test server.</summary>
public const string TINK_DEVEL = @"https://tinkwwp.copri-bike.de/APIjsonserver";
/// <summary> Holds the URL of the TINK/Konrad test server.</summary>
public const string TINK_DEVEL = @"https://tinkwwp.copri-bike.de/APIjsonserver";
/// <summary> Holds the URL the TINK/Konrad productive server.</summary>
public const string TINK_LIVE = @"https://app.tink-konstanz.de/APIjsonserver";
/// <summary> Holds the URL the TINK/Konrad productive server.</summary>
public const string TINK_LIVE = @"https://app.tink-konstanz.de/APIjsonserver";
/// <summary> Holds the URL the Sharee server.</summary>
public const string SHAREE_DEVEL = @"https://shareeapp-primary.copri-bike.de/APIjsonserver";
/// <summary> Holds the URL the Sharee server.</summary>
public const string SHAREE_DEVEL = @"https://shareeapp-primary.copri-bike.de/APIjsonserver";
/// <summary> Holds the URL the Sharee server.</summary>
public const string SHAREE_LIVE = @"https://shareeapp-primary.copri.eu/APIjsonserver";
/// <summary> Holds the URL the Sharee server.</summary>
public const string SHAREE_LIVE = @"https://shareeapp-primary.copri.eu/APIjsonserver";
/// <summary>Constructs default uri list.</summary>
public CopriServerUriList(Uri activeUri = null) : this(
new List<Uri>
{
new Uri(SHAREE_LIVE),
new Uri(TINK_LIVE),
new Uri(SHAREE_DEVEL),
new Uri(TINK_DEVEL)
}.ToArray(),
activeUri ?? new Uri(SHAREE_LIVE)) // Default URi which is used after install of app
{
}
/// <summary>Constructs default uri list.</summary>
public CopriServerUriList(Uri activeUri = null) : this(
new List<Uri>
{
new Uri(SHAREE_LIVE),
new Uri(TINK_LIVE),
new Uri(SHAREE_DEVEL),
new Uri(TINK_DEVEL)
}.ToArray(),
activeUri ?? new Uri(SHAREE_LIVE)) // Default URi which is used after install of app
{
}
/// <summary> Constructs uris object. </summary>
/// <param name="p_oSource">Object to copy from.</param>
public CopriServerUriList(CopriServerUriList p_oSource) : this(
p_oSource.Uris.ToArray(),
p_oSource.ActiveUri)
{
}
/// <summary> Constructs uris object. </summary>
/// <param name="p_oSource">Object to copy from.</param>
public CopriServerUriList(CopriServerUriList p_oSource) : this(
p_oSource.Uris.ToArray(),
p_oSource.ActiveUri)
{
}
/// <summary> Constructs a valid uris object. </summary>
/// <param name="uris">Known uris.</param>
/// <param name="p_oActiveUri">Zero based index of active uri.</param>
/// <param name="p_oDevelUri">Uri of the development server.</param>
public CopriServerUriList(
Uri[] uris,
Uri p_oActiveUri)
{
if (uris == null || uris.Length < 1)
{
throw new ArgumentException($"Can not construct {typeof(CopriServerUriList)}- object. Array of uris must not be null and contain at least one element.");
}
/// <summary> Constructs a valid uris object. </summary>
/// <param name="uris">Known uris.</param>
/// <param name="p_oActiveUri">Zero based index of active uri.</param>
/// <param name="p_oDevelUri">Uri of the development server.</param>
public CopriServerUriList(
Uri[] uris,
Uri p_oActiveUri)
{
if (uris == null || uris.Length < 1)
{
throw new ArgumentException($"Can not construct {typeof(CopriServerUriList)}- object. Array of uris must not be null and contain at least one element.");
}
if (!uris.Contains(p_oActiveUri))
{
throw new ArgumentException($"Active uri {p_oActiveUri} not contained in ({string.Join("; ", uris.Select(x => x.AbsoluteUri))}).");
}
if (!uris.Contains(p_oActiveUri))
{
throw new ArgumentException($"Active uri {p_oActiveUri} not contained in ({string.Join("; ", uris.Select(x => x.AbsoluteUri))}).");
}
Uris = new List<Uri>(uris);
ActiveUri = p_oActiveUri;
}
Uris = new List<Uri>(uris);
ActiveUri = p_oActiveUri;
}
/// <summary> Gets the active uri. </summary>
[JsonProperty]
public Uri ActiveUri { get; }
/// <summary> Gets the active uri. </summary>
[JsonProperty]
public Uri ActiveUri { get; }
/// <summary> Gets the active uri. </summary>
/// <summary> Gets the active uri. </summary>
#if USCSHARP9
public static Uri DevelopUri => new (TINK_DEVEL);
#else
public static Uri DevelopUri => new Uri(TINK_DEVEL);
public static Uri DevelopUri => new Uri(TINK_DEVEL);
#endif
/// <summary> Gets the known uris. </summary>
[JsonProperty]
public IList<Uri> Uris { get; }
/// <summary> Gets the known uris. </summary>
[JsonProperty]
public IList<Uri> Uris { get; }
/// <summary> Gets the default uri which is active after first installation. </summary>
public static Uri DefaultActiveUri
{
get { return new CopriServerUriList().ActiveUri; }
}
}
/// <summary> Gets the default uri which is active after first installation. </summary>
public static Uri DefaultActiveUri
{
get { return new CopriServerUriList().ActiveUri; }
}
}
}