diff --git a/updater/software/Firefox.cs b/updater/software/Firefox.cs index da2dff08..43bc34ff 100644 --- a/updater/software/Firefox.cs +++ b/updater/software/Firefox.cs @@ -66,18 +66,16 @@ public Firefox(string langCode, bool autoGetNewer) languageCode = langCode.Trim(); var d32 = knownChecksums32Bit(); var d64 = knownChecksums64Bit(); - if (!d32.ContainsKey(languageCode)) + if (!d32.TryGetValue(languageCode, out checksum32Bit)) { logger.Error("The string '" + langCode + "' does not represent a valid language code!"); throw new ArgumentOutOfRangeException(nameof(langCode), "The string '" + langCode + "' does not represent a valid language code!"); } - if (!d64.ContainsKey(languageCode)) + if (!d64.TryGetValue(languageCode, out checksum64Bit)) { logger.Error("The string '" + langCode + "' does not represent a valid language code!"); throw new ArgumentOutOfRangeException(nameof(langCode), "The string '" + langCode + "' does not represent a valid language code!"); } - checksum32Bit = d32[languageCode]; - checksum64Bit = d64[languageCode]; } diff --git a/updater/software/FirefoxAurora.cs b/updater/software/FirefoxAurora.cs index 6df8c497..7b2d6d7f 100644 --- a/updater/software/FirefoxAurora.cs +++ b/updater/software/FirefoxAurora.cs @@ -460,9 +460,11 @@ private string[] determineNewestChecksums(string newerVersion) { fillChecksumDictionaries(); } - if (cs64 != null && cs32 != null && cs32.ContainsKey(languageCode) && cs64.ContainsKey(languageCode)) + if (cs64 != null && cs32 != null + && cs32.TryGetValue(languageCode, out string hash32) + && cs64.TryGetValue(languageCode, out string hash64)) { - return [cs32[languageCode], cs64[languageCode]]; + return [hash32, hash64]; } } var sums = new List(2); diff --git a/updater/software/FirefoxESR.cs b/updater/software/FirefoxESR.cs index dcaa2b96..9d23412c 100644 --- a/updater/software/FirefoxESR.cs +++ b/updater/software/FirefoxESR.cs @@ -73,13 +73,11 @@ public FirefoxESR(string langCode, bool autoGetNewer) languageCode = langCode.Trim(); var d32 = knownChecksums32Bit(); var d64 = knownChecksums64Bit(); - if (!d32.ContainsKey(languageCode) || !d64.ContainsKey(languageCode)) + if (!d32.TryGetValue(languageCode, out checksum32Bit) || !d64.TryGetValue(languageCode, out checksum64Bit)) { logger.Error("The string '" + langCode + "' does not represent a valid language code!"); throw new ArgumentOutOfRangeException(nameof(langCode), "The string '" + langCode + "' does not represent a valid language code!"); } - checksum32Bit = d32[languageCode]; - checksum64Bit = d64[languageCode]; } diff --git a/updater/software/SeaMonkey.cs b/updater/software/SeaMonkey.cs index cafd6d27..07ff60db 100644 --- a/updater/software/SeaMonkey.cs +++ b/updater/software/SeaMonkey.cs @@ -66,13 +66,11 @@ public SeaMonkey(string langCode, bool autoGetNewer) languageCode = langCode.Trim(); var d32 = knownChecksums32Bit(); var d64 = knownChecksums64Bit(); - if (!d32.ContainsKey(languageCode) || !d64.ContainsKey(languageCode)) + if (!d32.TryGetValue(languageCode, out checksum32Bit) || !d64.TryGetValue(languageCode, out checksum64Bit)) { logger.Error("The string '" + langCode + "' does not represent a valid language code for SeaMonkey!"); throw new ArgumentOutOfRangeException(nameof(langCode), "The string '" + langCode + "' does not represent a valid language code!"); } - checksum32Bit = d32[languageCode]; - checksum64Bit = d64[languageCode]; } diff --git a/updater/software/SeaMonkey_2.46.cs b/updater/software/SeaMonkey_2.46.cs index 187996a5..da8c36d4 100644 --- a/updater/software/SeaMonkey_2.46.cs +++ b/updater/software/SeaMonkey_2.46.cs @@ -1,6 +1,6 @@ /* This file is part of the updater command line interface. - Copyright (C) 2017, 2018, 2020, 2021 Dirk Stolle + Copyright (C) 2017, 2018, 2020, 2021, 2024 Dirk Stolle This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -59,12 +59,11 @@ public SeaMonkey246(string langCode, bool autoGetNewer) } languageCode = langCode.Trim(); var d = knownChecksums(); - if (!d.ContainsKey(languageCode)) + if (!d.TryGetValue(languageCode, out checksum)) { logger.Error("The string '" + langCode + "' does not represent a valid language code!"); throw new ArgumentOutOfRangeException(nameof(langCode), "The string '" + langCode + "' does not represent a valid language code!"); } - checksum = d[languageCode]; } diff --git a/updater/software/Thunderbird.cs b/updater/software/Thunderbird.cs index d3c78ea9..4e645333 100644 --- a/updater/software/Thunderbird.cs +++ b/updater/software/Thunderbird.cs @@ -75,13 +75,11 @@ public Thunderbird(string langCode, bool autoGetNewer) languageCode = langCode.Trim(); var d32 = knownChecksums32Bit(); var d64 = knownChecksums64Bit(); - if (!d32.ContainsKey(languageCode) || !d64.ContainsKey(languageCode)) + if (!d32.TryGetValue(languageCode, out checksum32Bit) || !d64.TryGetValue(languageCode, out checksum64Bit)) { logger.Error("The string '" + langCode + "' does not represent a valid language code!"); throw new ArgumentOutOfRangeException(nameof(langCode), "The string '" + langCode + "' does not represent a valid language code!"); } - checksum32Bit = d32[languageCode]; - checksum64Bit = d64[languageCode]; } diff --git a/updater/software/Thunderbird_78.cs b/updater/software/Thunderbird_78.cs index 33ad6114..a451e98e 100644 --- a/updater/software/Thunderbird_78.cs +++ b/updater/software/Thunderbird_78.cs @@ -70,13 +70,11 @@ public Thunderbird78(string langCode, bool autoGetNewer) languageCode = langCode.Trim(); var d32 = knownChecksums32Bit(); var d64 = knownChecksums64Bit(); - if (!d32.ContainsKey(languageCode) || !d64.ContainsKey(languageCode)) + if (!d32.TryGetValue(languageCode, out checksum32Bit) || !d64.TryGetValue(languageCode, out checksum64Bit)) { logger.Error("The string '" + langCode + "' does not represent a valid language code!"); throw new ArgumentOutOfRangeException(nameof(langCode), "The string '" + langCode + "' does not represent a valid language code!"); } - checksum32Bit = d32[languageCode]; - checksum64Bit = d64[languageCode]; }