mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-06-22 05:47:28 +02:00
Version 3.0.360
This commit is contained in:
parent
5c0b2e70c9
commit
faf68061f4
160 changed files with 2114 additions and 1932 deletions
|
@ -118,12 +118,12 @@ namespace TINK.Model.Settings
|
|||
}
|
||||
/// <summary> Sets the uri of the active copri host. </summary>
|
||||
/// <param name="settingsJSON">Dictionary holding parameters from JSON.</param>
|
||||
public static Dictionary<string, string> SetCopriHostUri(this IDictionary<string, string> p_oTargetDictionary, string p_strNextActiveUriText)
|
||||
public static Dictionary<string, string> SetCopriHostUri(this IDictionary<string, string> targetDictionary, string p_strNextActiveUriText)
|
||||
{
|
||||
if (p_oTargetDictionary == null)
|
||||
if (targetDictionary == null)
|
||||
throw new Exception("Writing copri host uri to dictionary failed. Dictionary must not be null.");
|
||||
|
||||
return p_oTargetDictionary.Union(new Dictionary<string, string>
|
||||
return targetDictionary.Union(new Dictionary<string, string>
|
||||
{
|
||||
{ typeof(CopriServerUriList).ToString(), JsonConvert.SerializeObject(p_strNextActiveUriText) },
|
||||
}).ToDictionary(key => key.Key, value => value.Value);
|
||||
|
@ -196,15 +196,17 @@ namespace TINK.Model.Settings
|
|||
|
||||
/// <summary> Sets whether polling is on or off and the periode if polling is on. </summary>
|
||||
/// <param name="settingsJSON">Dictionary to write entries to.</param>
|
||||
public static Dictionary<string, string> SetPollingParameters(this IDictionary<string, string> p_oTargetDictionary, PollingParameters p_oPollingParameter)
|
||||
public static Dictionary<string, string> SetPollingParameters(
|
||||
this IDictionary<string, string> targetDictionary,
|
||||
PollingParameters pollingParameter)
|
||||
{
|
||||
if (p_oTargetDictionary == null)
|
||||
if (targetDictionary == null)
|
||||
throw new Exception("Writing polling parameters to dictionary failed. Dictionary must not be null.");
|
||||
|
||||
return p_oTargetDictionary.Union(new Dictionary<string, string>
|
||||
return targetDictionary.Union(new Dictionary<string, string>
|
||||
{
|
||||
{ $"{typeof(PollingParameters).Name}_{typeof(TimeSpan).Name}", JsonConvert.SerializeObject(p_oPollingParameter.Periode) },
|
||||
{ $"{typeof(PollingParameters).Name}_{typeof(bool).Name}", JsonConvert.SerializeObject(p_oPollingParameter.IsActivated) },
|
||||
{ $"{typeof(PollingParameters).Name}_{typeof(TimeSpan).Name}", JsonConvert.SerializeObject(pollingParameter.Periode) },
|
||||
{ $"{typeof(PollingParameters).Name}_{typeof(bool).Name}", JsonConvert.SerializeObject(pollingParameter.IsActivated) },
|
||||
}).ToDictionary(key => key.Key, value => value.Value);
|
||||
}
|
||||
|
||||
|
@ -242,24 +244,24 @@ namespace TINK.Model.Settings
|
|||
/// <returns>Dictionary of settings.</returns>
|
||||
public static Dictionary<string, string> Deserialize(string settingsDirectory)
|
||||
{
|
||||
var l_oFileName = $"{settingsDirectory}{System.IO.Path.DirectorySeparatorChar}{SETTINGSFILETITLE}";
|
||||
var fileName = $"{settingsDirectory}{System.IO.Path.DirectorySeparatorChar}{SETTINGSFILETITLE}";
|
||||
|
||||
if (!System.IO.File.Exists(l_oFileName))
|
||||
if (!System.IO.File.Exists(fileName))
|
||||
{
|
||||
// File is empty. Nothing to read.
|
||||
return new Dictionary<string, string>(); ;
|
||||
}
|
||||
|
||||
var l_oJSONFile = System.IO.File.ReadAllText(l_oFileName);
|
||||
var jsonFile = System.IO.File.ReadAllText(fileName);
|
||||
|
||||
if (string.IsNullOrEmpty(l_oJSONFile))
|
||||
if (string.IsNullOrEmpty(jsonFile))
|
||||
{
|
||||
// File is empty. Nothing to read.
|
||||
return new Dictionary<string, string>();
|
||||
}
|
||||
|
||||
// Load setting file.
|
||||
return JsonConvert.DeserializeObject<Dictionary<string, string>>(l_oJSONFile);
|
||||
return JsonConvert.DeserializeObject<Dictionary<string, string>>(jsonFile);
|
||||
}
|
||||
|
||||
/// <summary> Gets the logging level.</summary>
|
||||
|
@ -291,15 +293,15 @@ namespace TINK.Model.Settings
|
|||
|
||||
/// <summary> Sets the logging level.</summary>
|
||||
/// <param name="settingsJSON">Dictionary to get logging level from.</param>
|
||||
public static Dictionary<string, string> SetMinimumLoggingLevel(this IDictionary<string, string> p_oTargetDictionary, LogEventLevel p_oLevel)
|
||||
public static Dictionary<string, string> SetMinimumLoggingLevel(this IDictionary<string, string> targetDictionary, LogEventLevel level)
|
||||
{
|
||||
// Set logging level.
|
||||
if (p_oTargetDictionary == null)
|
||||
if (targetDictionary == null)
|
||||
throw new Exception("Writing logging level to dictionary failed. Dictionary must not be null.");
|
||||
|
||||
return p_oTargetDictionary.Union(new Dictionary<string, string>
|
||||
return targetDictionary.Union(new Dictionary<string, string>
|
||||
{
|
||||
{ MINLOGGINGLEVELKEY, JsonConvert.SerializeObject((int)p_oLevel) }
|
||||
{ MINLOGGINGLEVELKEY, JsonConvert.SerializeObject((int)level) }
|
||||
}).ToDictionary(key => key.Key, value => value.Value);
|
||||
}
|
||||
|
||||
|
@ -321,15 +323,15 @@ namespace TINK.Model.Settings
|
|||
|
||||
/// <summary> Sets the version of app when whats new was shown.</summary>
|
||||
/// <param name="settingsJSON">Dictionary to get information from.</param>
|
||||
public static Dictionary<string, string> SetWhatsNew(this IDictionary<string, string> p_oTargetDictionary, Version p_oAppVersion)
|
||||
public static Dictionary<string, string> SetWhatsNew(this IDictionary<string, string> targetDictionary, Version appVersion)
|
||||
{
|
||||
// Set logging level.
|
||||
if (p_oTargetDictionary == null)
|
||||
if (targetDictionary == null)
|
||||
throw new Exception("Writing WhatsNew info failed. Dictionary must not be null.");
|
||||
|
||||
return p_oTargetDictionary.Union(new Dictionary<string, string>
|
||||
return targetDictionary.Union(new Dictionary<string, string>
|
||||
{
|
||||
{ SHOWWHATSNEWKEY, JsonConvert.SerializeObject(p_oAppVersion, new VersionConverter()) }
|
||||
{ SHOWWHATSNEWKEY, JsonConvert.SerializeObject(appVersion, new VersionConverter()) }
|
||||
}).ToDictionary(key => key.Key, value => value.Value);
|
||||
}
|
||||
|
||||
|
@ -350,12 +352,12 @@ namespace TINK.Model.Settings
|
|||
|
||||
/// <summary> Sets the the expiration time.</summary>
|
||||
/// <param name="settingsJSON">Dictionary to write information to.</param>
|
||||
public static Dictionary<string, string> SetExpiresAfter(this IDictionary<string, string> p_oTargetDictionary, TimeSpan expiresAfter)
|
||||
public static Dictionary<string, string> SetExpiresAfter(this IDictionary<string, string> targetDictionary, TimeSpan expiresAfter)
|
||||
{
|
||||
if (p_oTargetDictionary == null)
|
||||
if (targetDictionary == null)
|
||||
throw new Exception("Writing ExpiresAfter info failed. Dictionary must not be null.");
|
||||
|
||||
return p_oTargetDictionary.Union(new Dictionary<string, string>
|
||||
return targetDictionary.Union(new Dictionary<string, string>
|
||||
{
|
||||
{ EXPIRESAFTER, JsonConvert.SerializeObject(expiresAfter, new JavaScriptDateTimeConverter()) }
|
||||
}).ToDictionary(key => key.Key, value => value.Value);
|
||||
|
@ -497,16 +499,16 @@ namespace TINK.Model.Settings
|
|||
|
||||
public static IDictionary<string, string> SetGroupFilterMapPage(
|
||||
this IDictionary<string, string> settings,
|
||||
IDictionary<string, FilterState> p_oFilterCollection)
|
||||
IDictionary<string, FilterState> filterCollection)
|
||||
{
|
||||
if (settings == null
|
||||
|| p_oFilterCollection == null
|
||||
|| p_oFilterCollection.Count < 1)
|
||||
|| filterCollection == null
|
||||
|| filterCollection.Count < 1)
|
||||
{
|
||||
return settings;
|
||||
}
|
||||
|
||||
settings["FilterCollection_MapPageFilter"] = JsonConvert.SerializeObject(p_oFilterCollection);
|
||||
settings["FilterCollection_MapPageFilter"] = JsonConvert.SerializeObject(filterCollection);
|
||||
return settings;
|
||||
}
|
||||
|
||||
|
@ -541,16 +543,16 @@ namespace TINK.Model.Settings
|
|||
|
||||
public static IDictionary<string, string> SetGroupFilterSettings(
|
||||
this IDictionary<string, string> settings,
|
||||
IDictionary<string, FilterState> p_oFilterCollection)
|
||||
IDictionary<string, FilterState> filterCollection)
|
||||
{
|
||||
if (settings == null
|
||||
|| p_oFilterCollection == null
|
||||
|| p_oFilterCollection.Count < 1)
|
||||
|| filterCollection == null
|
||||
|| filterCollection.Count < 1)
|
||||
{
|
||||
return settings;
|
||||
}
|
||||
|
||||
settings["FilterCollection"] = JsonConvert.SerializeObject(p_oFilterCollection);
|
||||
settings["FilterCollection"] = JsonConvert.SerializeObject(filterCollection);
|
||||
return settings;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
|
||||
namespace TINK.Settings
|
||||
{
|
||||
|
@ -7,7 +7,7 @@ namespace TINK.Settings
|
|||
{
|
||||
/// <summary> Holds default polling parameters. </summary>
|
||||
public static PollingParameters Default { get; } = new PollingParameters(
|
||||
new TimeSpan(0, 0, 0, 10 /*secs*/, 0),// Default polling interval.
|
||||
new TimeSpan(0, 0, 0, 60 /*secs*/, 0), // Default polling interval. Was 10 secs up to 3.0.357.
|
||||
true);
|
||||
|
||||
/// <summary> Holds polling parameters which represent polling off (empty polling object). </summary>
|
||||
|
@ -16,12 +16,12 @@ namespace TINK.Settings
|
|||
false);
|
||||
|
||||
/// <summary> Constructs a polling parameter object. </summary>
|
||||
/// <param name="p_oPeriode">Polling periode.</param>
|
||||
/// <param name="p_bIsActivated">True if polling is activated.</param>
|
||||
public PollingParameters(TimeSpan p_oPeriode, bool p_bIsActivated)
|
||||
/// <param name="periode">Polling periode.</param>
|
||||
/// <param name="activated">True if polling is activated.</param>
|
||||
public PollingParameters(TimeSpan periode, bool activated)
|
||||
{
|
||||
Periode = p_oPeriode; // Can not be null because is a struct.
|
||||
IsActivated = p_bIsActivated;
|
||||
Periode = periode; // Can not be null because is a struct.
|
||||
IsActivated = activated;
|
||||
}
|
||||
|
||||
/// <summary>Holds the polling periode.</summary>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue