default source apikey

broken/ef
Paul Schneider 3 years ago
parent f33ca22255
commit cfd63fe68d
3 changed files with 10 additions and 5 deletions

@ -86,14 +86,14 @@ namespace isn
{
// Une suppression
Settings.Sources.Remove(source);
if (Program.Settings.DefaultSource==source) Settings.DefaultSource = null;
if (Settings.DefaultSource == source) Settings.DefaultSource = null;
}
else
{
// Une mise À jour
string ptd = Protector.Protect(apiKey);
Settings.Sources[source].ApiKey = ptd;
if (Program.Settings.DefaultSource==null) Settings.DefaultSource = source;
if (Settings.DefaultSource == null) Settings.DefaultSource = source;
}
}
else if (apiKey != null)

@ -25,7 +25,11 @@ namespace isn
{
var wrqueryHandler = new UploadFilesToServerUsingWebRequest();
// await wrqueryHandler.UploadFilesToServerAsync(report, new Uri(source), fi, apikey);
if (source == null) source = Program.Settings.DefaultSource;
if (source == null)
{
source = Program.Settings.DefaultSource;
apikey = Program.Settings.Sources[source].ApiKey;
}
if (Program.Settings.Sources.ContainsKey(source))
if (apikey is null) apikey = Program.Protector.UnProtect(Program.Settings.Sources[source].ApiKey);
wrqueryHandler.UploadFilesToServer(report, new Uri(source), fi, apikey);

@ -7,10 +7,11 @@ namespace isn
public string ApiKey { get; set; }
public string Alias { get; set; }
}
public class Settings
{
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 string DefaultSource { get; set; }

Loading…