Skip to content

Commit 864fa8d

Browse files
committed
Add .NET 9 to target frameworks
1 parent 622f36b commit 864fa8d

File tree

14 files changed

+126
-26
lines changed

14 files changed

+126
-26
lines changed

BinaryObjectScanner/FileType/LDSCRYPT.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,12 @@ public class LDSCRYPT : IDetectable
2828
byte[] magic = new byte[16];
2929
int read = stream.Read(magic, 0, 16);
3030

31+
#if NET20
32+
if (Extensions.StartsWith(magic, new byte?[] { 0x4C, 0x44, 0x53, 0x43, 0x52, 0x59, 0x50, 0x54 }))
33+
#else
3134
if (magic.StartsWith(new byte?[] { 0x4C, 0x44, 0x53, 0x43, 0x52, 0x59, 0x50, 0x54 }))
32-
return "Link Data Security encrypted file";
35+
#endif
36+
return "Link Data Security encrypted file";
3337
}
3438
catch (Exception ex)
3539
{

BinaryObjectScanner/FileType/PLJ.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ public class PLJ : IDetectable
2828
byte[] magic = new byte[16];
2929
int read = stream.Read(magic, 0, 16);
3030

31+
#if NET20
32+
if (Extensions.StartsWith(magic, new byte?[] { 0xFF, 0x9D, 0x53, 0x4B }))
33+
#else
3134
if (magic.StartsWith(new byte?[] { 0xFF, 0x9D, 0x53, 0x4B }))
35+
#endif
3236
return "PlayJ Audio File";
3337
}
3438
catch (Exception ex)

BinaryObjectScanner/FileType/RealArcadeInstaller.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ public class RealArcadeInstaller : IDetectable
3232

3333
// RASGI2.0
3434
// Found in the ".rgs" files in IA item "Nova_RealArcadeCD_USA".
35+
#if NET20
36+
if (Extensions.StartsWith(magic, new byte?[] { 0x52, 0x41, 0x53, 0x47, 0x49, 0x32, 0x2E, 0x30 }))
37+
#else
3538
if (magic.StartsWith(new byte?[] { 0x52, 0x41, 0x53, 0x47, 0x49, 0x32, 0x2E, 0x30 }))
39+
#endif
3640
return "RealArcade Installer";
3741
}
3842
catch (Exception ex)

BinaryObjectScanner/FileType/RealArcadeMezzanine.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ public class RealArcadeMezzanine : IDetectable
3232

3333
// XZip2.0
3434
// Found in the ".mez" files in IA item "Nova_RealArcadeCD_USA".
35+
#if NET20
36+
if (Extensions.StartsWith(magic, new byte?[] { 0x58, 0x5A, 0x69, 0x70, 0x32, 0x2E, 0x30 }))
37+
#else
3538
if (magic.StartsWith(new byte?[] { 0x58, 0x5A, 0x69, 0x70, 0x32, 0x2E, 0x30 }))
39+
#endif
3640
return "RealArcade Mezzanine";
3741
}
3842
catch (Exception ex)

BinaryObjectScanner/FileType/SFFS.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,12 @@ public class SFFS : IExtractable, IDetectable
2929
byte[] magic = new byte[16];
3030
int read = stream.Read(magic, 0, 16);
3131

32+
#if NET20
33+
if (Extensions.StartsWith(magic, new byte?[] { 0x53, 0x46, 0x46, 0x53 }))
34+
#else
3235
if (magic.StartsWith(new byte?[] { 0x53, 0x46, 0x46, 0x53 }))
33-
return "StarForce Filesystem Container";
36+
#endif
37+
return "StarForce Filesystem Container";
3438
}
3539
catch (Exception ex)
3640
{

BinaryObjectScanner/Packer/EmbeddedExecutable.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,15 @@ public class EmbeddedExecutable : IExtractableExecutable<PortableExecutable>
2222
return null;
2323

2424
// Get the resources that have an executable signature
25-
if (pex.ResourceData?.Any(kvp => kvp.Value is byte[] ba && ba.StartsWith(SabreTools.Models.MSDOS.Constants.SignatureBytes)) == true)
25+
if (pex.ResourceData?.Any(kvp => kvp.Value is byte[] ba
26+
#if NET20
27+
&& Extensions.StartsWith(ba, SabreTools.Models.MSDOS.Constants.SignatureBytes)) == true)
28+
#else
29+
&& ba.StartsWith(SabreTools.Models.MSDOS.Constants.SignatureBytes)) == true)
30+
#endif
31+
{
2632
return "Embedded Executable";
33+
}
2734

2835
return null;
2936
}
@@ -41,7 +48,11 @@ public bool Extract(string file, PortableExecutable pex, string outDir, bool inc
4148
var resources = pex.ResourceData
4249
.Where(kvp => kvp.Value != null && kvp.Value is byte[])
4350
.Select(kvp => kvp.Value as byte[])
51+
#if NET20
52+
.Where(b => b != null && Extensions.StartsWith(b, SabreTools.Models.MSDOS.Constants.SignatureBytes))
53+
#else
4454
.Where(b => b != null && b.StartsWith(SabreTools.Models.MSDOS.Constants.SignatureBytes))
55+
#endif
4556
.ToList();
4657

4758
for (int i = 0; i < resources.Count; i++)

BinaryObjectScanner/Packer/WiseInstaller.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,11 @@ public bool Extract(string file, PortableExecutable pex, string outDir, bool inc
156156

157157
// If the first entry is PKZIP, we assume it's an embedded zipfile
158158
var magic = overlayData.ReadBytes(ref overlayOffset, 4); overlayOffset -= 4;
159+
#if NET20
160+
bool pkzip = Extensions.StartsWith(magic, new byte?[] { (byte)'P', (byte)'K' });
161+
#else
159162
bool pkzip = magic?.StartsWith(new byte?[] { (byte)'P', (byte)'K' }) ?? false;
163+
#endif
160164

161165
// Create the output directory
162166
Directory.CreateDirectory(outDir);

BinaryObjectScanner/Progress.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@
88

99
namespace System
1010
{
11+
/// <summary>Defines a provider for progress updates.</summary>
12+
/// <typeparam name="T">The type of progress update value.</typeparam>
13+
/// <see href="https://github.com/dotnet/runtime/blob/main/src/libraries/System.Private.CoreLib/src/System/IProgress.cs"/>
14+
public interface IProgress<in T>
15+
{
16+
/// <summary>Reports a progress update.</summary>
17+
/// <param name="value">The value of the updated progress.</param>
18+
void Report(T value);
19+
}
20+
1121
/// <summary>
1222
/// Provides an IProgress{T} that invokes callbacks for each reported progress value.
1323
/// </summary>

BinaryObjectScanner/Protection/ActiveMARK.cs

Lines changed: 28 additions & 18 deletions
Large diffs are not rendered by default.

BinaryObjectScanner/Protection/CDDVDCops.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,13 +228,10 @@ public IEnumerable<string> CheckDirectoryPath(string path, IEnumerable<string>?
228228
if (fileContent == null)
229229
return null;
230230

231-
#if NET20 || NET35 || NET40
232231
byte[] versionBytes = new byte[4];
233232
Array.Copy(fileContent, positions[0] + 15, versionBytes, 0, 4);
234233
char[] version = Array.ConvertAll(versionBytes, b => (char)b);
235-
#else
236-
char[] version = new ArraySegment<byte>(fileContent, positions[0] + 15, 4).Select(b => (char)b).ToArray();
237-
#endif
234+
238235
if (version[0] == 0x00)
239236
return string.Empty;
240237

0 commit comments

Comments
 (0)