|
|
@ -1,4 +1,6 @@
|
|
|
|
|
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
|
|
|
|
namespace isn
|
|
|
|
namespace isn
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -10,10 +12,32 @@ namespace isn
|
|
|
|
|
|
|
|
|
|
|
|
public class Settings
|
|
|
|
public class Settings
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public string DataProtectionTitle {get; set; }
|
|
|
|
public string DataProtectionTitle { get; set; }
|
|
|
|
public Dictionary<string, SourceSettings> Sources { get; set; }
|
|
|
|
public Dictionary<string, SourceSettings> Sources { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public bool AutoUpdateApiKey { get; set; } = false;
|
|
|
|
public bool AutoUpdateApiKey { get; set; } = false;
|
|
|
|
public string DefaultSource { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
private string source;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// Default Url or alias for the source
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <value></value>
|
|
|
|
|
|
|
|
public string DefaultSource
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get => source;
|
|
|
|
|
|
|
|
set
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (Sources.ContainsKey(value))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
source = value;
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Sources.Values.Any(s => s.Alias == value))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
source = Sources[value].Alias;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
throw new InvalidOperationException("Add it to Sources before, with an API key, as source or alias .");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|