diff --git a/Data/Extensions.cs b/Data/Extensions.cs index 3aa3e36..2b6fe1d 100644 --- a/Data/Extensions.cs +++ b/Data/Extensions.cs @@ -1053,7 +1053,7 @@ namespace SabreTools.RedumpLib.Data foreach (var val in Enum.GetValues(typeof(MediaType))) { - if (((MediaType)val) == MediaType.NONE) + if (val == null || ((MediaType)val) == MediaType.NONE) continue; mediaTypes.Add($"{((MediaType?)val).ShortName()} - {((MediaType?)val).LongName()}"); diff --git a/SabreTools.RedumpLib.csproj b/SabreTools.RedumpLib.csproj index 7bed56b..5e2a9d4 100644 --- a/SabreTools.RedumpLib.csproj +++ b/SabreTools.RedumpLib.csproj @@ -2,7 +2,7 @@ - net48;net6.0;net7.0;net8.0 + net40;net452;net462;net472;net48;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0 win-x86;win-x64;win-arm64;linux-x64;linux-arm64;osx-x64;osx-arm64 latest enable @@ -25,6 +25,11 @@ + + + + + diff --git a/Web/RedumpHttpClient.cs b/Web/RedumpHttpClient.cs index 3343893..7968624 100644 --- a/Web/RedumpHttpClient.cs +++ b/Web/RedumpHttpClient.cs @@ -170,8 +170,11 @@ namespace SabreTools.RedumpLib.Web // Otherwise, traverse each dump on the page var matches = Constants.DiscRegex.Matches(dumpsPage); - foreach (Match match in matches) + foreach (Match? match in matches) { + if (match == null) + continue; + try { if (int.TryParse(match.Groups[1].Value, out int value)) @@ -219,8 +222,11 @@ namespace SabreTools.RedumpLib.Web // Otherwise, traverse each dump on the page var matches = Constants.DiscRegex.Matches(dumpsPage); - foreach (Match match in matches) + foreach (Match? match in matches) { + if (match == null) + continue; + try { if (int.TryParse(match.Groups[1].Value, out int value)) @@ -258,8 +264,11 @@ namespace SabreTools.RedumpLib.Web // Otherwise, traverse each dump on the page var matches = Constants.NewDiscRegex.Matches(dumpsPage); - foreach (Match match in matches) + foreach (Match? match in matches) { + if (match == null) + continue; + try { if (int.TryParse(match.Groups[2].Value, out int value)) @@ -293,8 +302,11 @@ namespace SabreTools.RedumpLib.Web // Otherwise, traverse each dump on the page var matches = Constants.NewDiscRegex.Matches(dumpsPage); - foreach (Match match in matches) + foreach (Match? match in matches) { + if (match == null) + continue; + try { if (int.TryParse(match.Groups[2].Value, out int value)) diff --git a/Web/RedumpWebClient.cs b/Web/RedumpWebClient.cs index 9c99e2b..45b51fd 100644 --- a/Web/RedumpWebClient.cs +++ b/Web/RedumpWebClient.cs @@ -101,7 +101,11 @@ namespace SabreTools.RedumpLib.Web } // HTTP encode the password +#if NET40 + password = Uri.EscapeUriString(password); +#else password = WebUtility.UrlEncode(password); +#endif // Attempt to login up to 3 times for (int i = 0; i < 3; i++)