Skip to content

Commit

Permalink
Cut off at .NET Framework 4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mnadareski committed Nov 8, 2023
1 parent 4027470 commit dfe0c2f
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Data/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1053,7 +1053,7 @@ public static List<string> ListMediaTypes()

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()}");
Expand Down
7 changes: 6 additions & 1 deletion SabreTools.RedumpLib.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<!-- Assembly Properties -->
<TargetFrameworks>net48;net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>net40;net452;net462;net472;net48;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0</TargetFrameworks>
<RuntimeIdentifiers>win-x86;win-x64;win-arm64;linux-x64;linux-arm64;osx-x64;osx-arm64</RuntimeIdentifiers>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
Expand All @@ -25,6 +25,11 @@
<None Include="README.md" Pack="true" PackagePath=""/>
</ItemGroup>

<!-- Support for old .NET versions -->
<ItemGroup Condition="$(TargetFramework.StartsWith(`net4`))">
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
Expand Down
20 changes: 16 additions & 4 deletions Web/RedumpHttpClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,11 @@ public async Task<List<int>> CheckSingleSitePage(string url)

// 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))
Expand Down Expand Up @@ -219,8 +222,11 @@ public async Task<bool> CheckSingleSitePage(string url, string? outDir, bool fai

// 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))
Expand Down Expand Up @@ -258,8 +264,11 @@ public async Task<List<int>> CheckSingleWIPPage(string url)

// 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))
Expand Down Expand Up @@ -293,8 +302,11 @@ public async Task<bool> CheckSingleWIPPage(string url, string? outDir, bool fail

// 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))
Expand Down
4 changes: 4 additions & 0 deletions Web/RedumpWebClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,11 @@ public static (bool?, string?) ValidateCredentials(string username, string passw
}

// 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++)
Expand Down

0 comments on commit dfe0c2f

Please sign in to comment.