diff --git a/src/isn/Program.Commands.cs b/src/isn/Program.Commands.cs index b193f0b..d0b684b 100644 --- a/src/isn/Program.Commands.cs +++ b/src/isn/Program.Commands.cs @@ -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) diff --git a/src/isn/PushCommand.cs b/src/isn/PushCommand.cs index 7c218fc..12e2ea7 100644 --- a/src/isn/PushCommand.cs +++ b/src/isn/PushCommand.cs @@ -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); diff --git a/src/isn/Settings.cs b/src/isn/Settings.cs index 62c96ae..7bf03b9 100644 --- a/src/isn/Settings.cs +++ b/src/isn/Settings.cs @@ -7,12 +7,13 @@ namespace isn public string ApiKey { get; set; } public string Alias { get; set; } } + public class Settings { public string DataProtectionTitle {get; set; } - public Dictionary Sources {get; set; } + public Dictionary Sources { get; set; } public bool AutoUpdateApiKey { get; set; } = false; - public string DefaultSource { get; set; } + public string DefaultSource { get; set; } } } \ No newline at end of file