mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Goodbye .NET Framework 4.8 and RIPEMD160
This commit is contained in:
@@ -2,16 +2,12 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFrameworks>net48;netcoreapp3.1;net5.0</TargetFrameworks>
|
||||
<TargetFrameworks>netcoreapp3.1;net5.0</TargetFrameworks>
|
||||
<RuntimeIdentifiers>win10-x64;win7-x86</RuntimeIdentifiers>
|
||||
<Configurations>Debug;Release</Configurations>
|
||||
<Platforms>AnyCPU;x64</Platforms>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(TargetFramework)'=='net48'">
|
||||
<DefineConstants>NET_FRAMEWORK</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Data.Sqlite" Version="5.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -15,14 +15,6 @@
|
||||
0x8f, 0x00, 0xb2, 0x04,
|
||||
0xe9, 0x80, 0x09, 0x98,
|
||||
0xec, 0xf8, 0x42, 0x7e };
|
||||
#if NET_FRAMEWORK
|
||||
public const string RIPEMD160Zero = "9c1185a5c5e9fc54612808977ee8f548b2258d31";
|
||||
public static readonly byte[] RIPEMD160ZeroBytes = { 0x9c, 0x11, 0x85, 0xa5,
|
||||
0xc5, 0xe9, 0xfc, 0x54,
|
||||
0x61, 0x28, 0x08, 0x97,
|
||||
0x7e, 0xe8, 0xf5, 0x48,
|
||||
0xb2, 0x25, 0x8d, 0x31 };
|
||||
#endif
|
||||
public const string SHA1Zero = "da39a3ee5e6b4b0d3255bfef95601890afd80709";
|
||||
public static readonly byte[] SHA1ZeroBytes = { 0xda, 0x39, 0xa3, 0xee,
|
||||
0x5e, 0x6b, 0x4b, 0x0d,
|
||||
@@ -77,9 +69,6 @@
|
||||
|
||||
public const int CRCLength = 8;
|
||||
public const int MD5Length = 32;
|
||||
#if NET_FRAMEWORK
|
||||
public const int RIPEMD160Length = 40;
|
||||
#endif
|
||||
public const int SHA1Length = 40;
|
||||
public const int SHA256Length = 64;
|
||||
public const int SHA384Length = 96;
|
||||
|
||||
@@ -13,24 +13,16 @@ namespace SabreTools.Core
|
||||
{
|
||||
CRC = 1 << 0,
|
||||
MD5 = 1 << 1,
|
||||
#if NET_FRAMEWORK
|
||||
RIPEMD160 = 1 << 2,
|
||||
#endif
|
||||
SHA1 = 1 << 3,
|
||||
SHA256 = 1 << 4,
|
||||
SHA384 = 1 << 5,
|
||||
SHA512 = 1 << 6,
|
||||
SpamSum = 1 << 7,
|
||||
SHA1 = 1 << 2,
|
||||
SHA256 = 1 << 3,
|
||||
SHA384 = 1 << 4,
|
||||
SHA512 = 1 << 5,
|
||||
SpamSum = 1 << 6,
|
||||
|
||||
// Special combinations
|
||||
Standard = CRC | MD5 | SHA1,
|
||||
#if NET_FRAMEWORK
|
||||
DeepHashes = RIPEMD160 | SHA256 | SHA384 | SHA512 | SpamSum,
|
||||
SecureHashes = MD5 | RIPEMD160 | SHA1 | SHA256 | SHA384 | SHA512 | SpamSum,
|
||||
#else
|
||||
DeepHashes = SHA256 | SHA384 | SHA512 | SpamSum,
|
||||
SecureHashes = MD5 | SHA1 | SHA256 | SHA384 | SHA512 | SpamSum,
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -621,9 +613,6 @@ namespace SabreTools.Core
|
||||
DatItem_Size,
|
||||
DatItem_CRC,
|
||||
DatItem_MD5,
|
||||
#if NET_FRAMEWORK
|
||||
DatItem_RIPEMD160,
|
||||
#endif
|
||||
DatItem_SHA1,
|
||||
DatItem_SHA256,
|
||||
DatItem_SHA384,
|
||||
@@ -884,9 +873,6 @@ namespace SabreTools.Core
|
||||
Size,
|
||||
CRC,
|
||||
MD5,
|
||||
#if NET_FRAMEWORK
|
||||
RIPEMD160,
|
||||
#endif
|
||||
SHA1,
|
||||
SHA256,
|
||||
SHA384,
|
||||
|
||||
@@ -12,8 +12,8 @@ namespace SabreTools.Core
|
||||
/// <summary>
|
||||
/// The current toolset version to be used by all child applications
|
||||
/// </summary>
|
||||
public readonly static string Version = $"v1.0.5";
|
||||
//public readonly static string Version = $"v1.0.5-{File.GetCreationTime(Assembly.GetExecutingAssembly().Location):yyyy-MM-dd HH:mm:ss}";
|
||||
//public readonly static string Version = $"v1.0.5";
|
||||
public readonly static string Version = $"v1.0.5-{File.GetCreationTime(Assembly.GetExecutingAssembly().Location):yyyy-MM-dd HH:mm:ss}";
|
||||
|
||||
/// <summary>
|
||||
/// Readies the console and outputs the header
|
||||
@@ -33,7 +33,7 @@ namespace SabreTools.Core
|
||||
// Set the console to ready state
|
||||
ConsoleColor formertext = ConsoleColor.White;
|
||||
ConsoleColor formerback = ConsoleColor.Black;
|
||||
if (!MonoOrCoreEnvironment)
|
||||
if (!CoreEnvironment)
|
||||
{
|
||||
Console.SetBufferSize(Console.BufferWidth, 999);
|
||||
formertext = Console.ForegroundColor;
|
||||
@@ -51,7 +51,7 @@ namespace SabreTools.Core
|
||||
Console.WriteLine();
|
||||
|
||||
// Return the console to the original text and background colors
|
||||
if (!MonoOrCoreEnvironment)
|
||||
if (!CoreEnvironment)
|
||||
{
|
||||
Console.ForegroundColor = formertext;
|
||||
Console.BackgroundColor = formerback;
|
||||
@@ -60,18 +60,14 @@ namespace SabreTools.Core
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if running in a Mono or .NET Core environment
|
||||
/// Returns true if running in a .NET Core environment
|
||||
/// </summary>
|
||||
/// TODO: Investigate if this is needed when removing .NET Framework 4.8 support
|
||||
private static bool MonoOrCoreEnvironment
|
||||
private static bool CoreEnvironment
|
||||
{
|
||||
get
|
||||
{
|
||||
#if NET_FRAMEWORK
|
||||
return Type.GetType("Mono.Runtime") != null;
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -209,10 +209,6 @@ Options:
|
||||
This allows the user to skip calculating the MD5 for each of the
|
||||
files which will speed up the creation of the DAT.
|
||||
|
||||
-nr160, --skip-ripemd160 Include RIPEMD160 in output
|
||||
This allows the user to include calculating the RIPEMD160 for each of
|
||||
the files. .NET Framework 4.8 only.
|
||||
|
||||
-ns, --skip-sha1 Don't include SHA-1 in output
|
||||
This allows the user to skip calculating the SHA-1 for each of the
|
||||
files which will speed up the creation of the DAT.
|
||||
@@ -269,7 +265,6 @@ Options:
|
||||
msx, openmsx - openMSX Software List
|
||||
ol, offlinelist - OfflineList XML
|
||||
rc, romcenter - RomCenter
|
||||
ripemd160 - RIPEMD160 (.NET Framework 4.8 only)
|
||||
sj, sabrejson - SabreJSON
|
||||
sx, sabrexml - SabreDAT XML
|
||||
sfv - SFV
|
||||
@@ -632,7 +627,6 @@ Options:
|
||||
msx, openmsx - openMSX Software List
|
||||
ol, offlinelist - OfflineList XML
|
||||
rc, romcenter - RomCenter
|
||||
ripemd160 - RIPEMD160 (.NET Framework 4.8 only)
|
||||
sj, sabrejson - SabreJSON
|
||||
sx, sabrexml - SabreDAT XML
|
||||
sfv - SFV
|
||||
@@ -787,7 +781,6 @@ Options:
|
||||
msx, openmsx - openMSX Software List
|
||||
ol, offlinelist - OfflineList XML
|
||||
rc, romcenter - RomCenter
|
||||
ripemd160 - RIPEMD160 (.NET Framework 4.8 only)
|
||||
sj, sabrejson - SabreJSON
|
||||
sx, sabrexml - SabreDAT XML
|
||||
sfv - SFV
|
||||
@@ -816,7 +809,6 @@ Options:
|
||||
- %category% - Replaced with game Category
|
||||
- %crc% - Replaced with the CRC
|
||||
- %md5% - Replaced with the MD5
|
||||
- %ripemd160% - Replaced with the RIPEMD160 (.NET Framework 4.8 only)
|
||||
- %sha1% - Replaced with the SHA-1
|
||||
- %sha256% - Replaced with the SHA-256
|
||||
- %sha384% - Replaced with the SHA-384
|
||||
@@ -1404,7 +1396,6 @@ has been a new stable release.
|
||||
-ool, --output-ol -> -ot=ol, --output-type=offlinelist
|
||||
-ool, --output-offlinelist -> -ot=ol, --output-type=offlinelist
|
||||
-or, --output-rc -> -ot=rc, --output-type=romcenter
|
||||
-oripemd160, --output-ripemd160 -> -ot=ripemd160, --output-type=ripemd160
|
||||
-or, --output-romcenter -> -ot=rc, --output-type=romcenter
|
||||
-os, --output-sd -> -ot=sd, --output-type=sabredat
|
||||
-os, --output-sabredat -> -ot=sd, --output-type=sabredat
|
||||
@@ -1449,11 +1440,10 @@ has been a new stable release.
|
||||
-udd, --update-desc -> -uf=machine.description, --update-field=machine.description
|
||||
-udd, --update-description -> -uf=machine.description, --update-field=machine.description
|
||||
-ugt, --update-game-type -> -uf=machine.type, --update-field=machine.type
|
||||
-uh, --update-hashes -> (-uf=item.crc -uf=item.md5 -uf=item.ripemd160
|
||||
-uf=item.sha1 -uf=item.sha256 -uf=item.sha384 -uf=item.sha512 -uf=item.spamsum),
|
||||
(--update-field=item.crc --update-field=item.md5 --update-field=item.ripemd160
|
||||
--update-field=item.sha1 --update-field=item.sha256 --update-field=item.sha384
|
||||
--update-field=item.sha512 --update-field=item.spamsum)
|
||||
-uh, --update-hashes -> (-uf=item.crc -uf=item.md5 -uf=item.sha1 -uf=item.sha256
|
||||
-uf=item.sha384 -uf=item.sha512 -uf=item.spamsum), (--update-field=item.crc
|
||||
--update-field=item.md5 --update-field=item.sha1 --update-field=item.sha256
|
||||
--update-field=item.sha384 --update-field=item.sha512 --update-field=item.spamsum)
|
||||
-um, --update-manu -> -uf=machine.manufacturer, --update-field=machine.manufacturer
|
||||
-um, --update-manufacturer -> -uf=machine.manufacturer, --update-field=machine.manufacturer
|
||||
-un, --update-names -> -uf=item.name, --update-field=item.name
|
||||
|
||||
@@ -1,16 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net48;netcoreapp3.1;net5.0</TargetFrameworks>
|
||||
<TargetFrameworks>netcoreapp3.1;net5.0</TargetFrameworks>
|
||||
<RuntimeIdentifiers>win10-x64;win7-x86</RuntimeIdentifiers>
|
||||
<Configurations>Debug;Release</Configurations>
|
||||
<Platforms>AnyCPU;x64</Platforms>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(TargetFramework)'=='net48'">
|
||||
<DefineConstants>NET_FRAMEWORK</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -506,13 +506,7 @@ namespace Aaru.Checksums
|
||||
count++;
|
||||
}
|
||||
|
||||
#if NET_FRAMEWORK
|
||||
byte[] newString = new byte[count];
|
||||
Array.Copy(cString, newString, count);
|
||||
return newString;
|
||||
#else
|
||||
return new ReadOnlySpan<byte>(cString, 0, count).ToArray();
|
||||
#endif
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -35,12 +35,6 @@ namespace SabreTools.Core.Tools
|
||||
_hasher = MD5.Create();
|
||||
break;
|
||||
|
||||
#if NET_FRAMEWORK
|
||||
case Hash.RIPEMD160:
|
||||
_hasher = RIPEMD160.Create();
|
||||
break;
|
||||
#endif
|
||||
|
||||
case Hash.SHA1:
|
||||
_hasher = SHA1.Create();
|
||||
break;
|
||||
@@ -80,9 +74,6 @@ namespace SabreTools.Core.Tools
|
||||
break;
|
||||
|
||||
case Hash.MD5:
|
||||
#if NET_FRAMEWORK
|
||||
case Hash.RIPEMD160:
|
||||
#endif
|
||||
case Hash.SHA1:
|
||||
case Hash.SHA256:
|
||||
case Hash.SHA384:
|
||||
@@ -109,9 +100,6 @@ namespace SabreTools.Core.Tools
|
||||
break;
|
||||
|
||||
case Hash.MD5:
|
||||
#if NET_FRAMEWORK
|
||||
case Hash.RIPEMD160:
|
||||
#endif
|
||||
case Hash.SHA1:
|
||||
case Hash.SHA256:
|
||||
case Hash.SHA384:
|
||||
@@ -136,9 +124,6 @@ namespace SabreTools.Core.Tools
|
||||
return BitConverter.GetBytes((_hasher as OptimizedCRC.OptimizedCRC).Value).Reverse().ToArray();
|
||||
|
||||
case Hash.MD5:
|
||||
#if NET_FRAMEWORK
|
||||
case Hash.RIPEMD160:
|
||||
#endif
|
||||
case Hash.SHA1:
|
||||
case Hash.SHA256:
|
||||
case Hash.SHA384:
|
||||
|
||||
@@ -163,7 +163,6 @@ namespace SabreTools.Core.Tools
|
||||
case "dat":
|
||||
case "json":
|
||||
case "md5":
|
||||
case "ripemd160":
|
||||
case "sfv":
|
||||
case "sha1":
|
||||
case "sha256":
|
||||
|
||||
@@ -111,11 +111,6 @@ namespace SabreTools.DatFiles
|
||||
case DatFormat.RedumpMD5:
|
||||
return new Hashfile(baseDat, Hash.MD5);
|
||||
|
||||
#if NET_FRAMEWORK
|
||||
case DatFormat.RedumpRIPEMD160:
|
||||
return new Hashfile(baseDat, Hash.RIPEMD160);
|
||||
#endif
|
||||
|
||||
case DatFormat.RedumpSFV:
|
||||
return new Hashfile(baseDat, Hash.CRC);
|
||||
|
||||
@@ -255,9 +250,6 @@ namespace SabreTools.DatFiles
|
||||
rom.Size = Constants.SizeZero;
|
||||
rom.CRC = Constants.CRCZero;
|
||||
rom.MD5 = Constants.MD5Zero;
|
||||
#if NET_FRAMEWORK
|
||||
rom.RIPEMD160 = null; // Constants.RIPEMD160Zero;
|
||||
#endif
|
||||
rom.SHA1 = Constants.SHA1Zero;
|
||||
rom.SHA256 = null; // Constants.SHA256Zero;
|
||||
rom.SHA384 = null; // Constants.SHA384Zero;
|
||||
@@ -357,7 +349,6 @@ namespace SabreTools.DatFiles
|
||||
name = item.GetName() ?? item.ItemType.ToString(),
|
||||
crc = string.Empty,
|
||||
md5 = string.Empty,
|
||||
ripemd160 = string.Empty,
|
||||
sha1 = string.Empty,
|
||||
sha256 = string.Empty,
|
||||
sha384 = string.Empty,
|
||||
@@ -390,9 +381,6 @@ namespace SabreTools.DatFiles
|
||||
{
|
||||
crc = (item as Rom).CRC ?? string.Empty;
|
||||
md5 = (item as Rom).MD5 ?? string.Empty;
|
||||
#if NET_FRAMEWORK
|
||||
ripemd160 = (item as Rom).RIPEMD160 ?? string.Empty;
|
||||
#endif
|
||||
sha1 = (item as Rom).SHA1 ?? string.Empty;
|
||||
sha256 = (item as Rom).SHA256 ?? string.Empty;
|
||||
sha384 = (item as Rom).SHA384 ?? string.Empty;
|
||||
@@ -411,7 +399,6 @@ namespace SabreTools.DatFiles
|
||||
.Replace("%category%", item.Machine.Category ?? string.Empty)
|
||||
.Replace("%crc%", crc)
|
||||
.Replace("%md5%", md5)
|
||||
.Replace("%ripemd160%", ripemd160)
|
||||
.Replace("%sha1%", sha1)
|
||||
.Replace("%sha256%", sha256)
|
||||
.Replace("%sha384%", sha384)
|
||||
@@ -538,9 +525,6 @@ namespace SabreTools.DatFiles
|
||||
rom.Size = Constants.SizeZero;
|
||||
rom.CRC = rom.CRC == "null" ? Constants.CRCZero : null;
|
||||
rom.MD5 = rom.MD5 == "null" ? Constants.MD5Zero : null;
|
||||
#if NET_FRAMEWORK
|
||||
rom.RIPEMD160 = rom.RIPEMD160 == "null" ? Constants.RIPEMD160Zero : null;
|
||||
#endif
|
||||
rom.SHA1 = rom.SHA1 == "null" ? Constants.SHA1Zero : null;
|
||||
rom.SHA256 = rom.SHA256 == "null" ? Constants.SHA256Zero : null;
|
||||
rom.SHA384 = rom.SHA384 == "null" ? Constants.SHA384Zero : null;
|
||||
|
||||
@@ -797,19 +797,6 @@ namespace SabreTools.DatFiles
|
||||
|
||||
#endregion
|
||||
|
||||
#if NET_FRAMEWORK
|
||||
#region .ripemd160
|
||||
|
||||
// Redump RIPEMD160
|
||||
if (DatFormat.HasFlag(DatFormat.RedumpRIPEMD160))
|
||||
{
|
||||
outfileNames.Add(DatFormat.RedumpRIPEMD160, CreateOutFileNamesHelper(outDir, ".ripemd160", overwrite));
|
||||
usedExtensions.Add(".ripemd160");
|
||||
};
|
||||
|
||||
#endregion
|
||||
#endif
|
||||
|
||||
#region .sfv
|
||||
|
||||
// Redump SFV
|
||||
|
||||
@@ -122,37 +122,30 @@ namespace SabreTools.DatFiles
|
||||
/// </summary>
|
||||
RedumpMD5 = 1 << 19,
|
||||
|
||||
#if NET_FRAMEWORK
|
||||
/// <summary>
|
||||
/// RIPEMD160 hash list
|
||||
/// </summary>
|
||||
RedumpRIPEMD160 = 1 << 20,
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// SHA-1 hash list
|
||||
/// </summary>
|
||||
RedumpSHA1 = 1 << 21,
|
||||
RedumpSHA1 = 1 << 20,
|
||||
|
||||
/// <summary>
|
||||
/// SHA-256 hash list
|
||||
/// </summary>
|
||||
RedumpSHA256 = 1 << 22,
|
||||
RedumpSHA256 = 1 << 21,
|
||||
|
||||
/// <summary>
|
||||
/// SHA-384 hash list
|
||||
/// </summary>
|
||||
RedumpSHA384 = 1 << 23,
|
||||
RedumpSHA384 = 1 << 22,
|
||||
|
||||
/// <summary>
|
||||
/// SHA-512 hash list
|
||||
/// </summary>
|
||||
RedumpSHA512 = 1 << 24,
|
||||
RedumpSHA512 = 1 << 23,
|
||||
|
||||
/// <summary>
|
||||
/// SpamSum hash list
|
||||
/// </summary>
|
||||
RedumpSpamSum = 1 << 25,
|
||||
RedumpSpamSum = 1 << 24,
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -172,9 +165,6 @@ namespace SabreTools.DatFiles
|
||||
Game,
|
||||
CRC,
|
||||
MD5,
|
||||
#if NET_FRAMEWORK
|
||||
RIPEMD160,
|
||||
#endif
|
||||
SHA1,
|
||||
SHA256,
|
||||
SHA384,
|
||||
|
||||
@@ -330,13 +330,6 @@ namespace SabreTools.DatFiles.Formats
|
||||
(item as Rom).MD5 = attrVal;
|
||||
|
||||
break;
|
||||
#if NET_FRAMEWORK
|
||||
case "ripemd160":
|
||||
if (item.ItemType == ItemType.Rom)
|
||||
(item as Rom).RIPEMD160 = attrVal;
|
||||
|
||||
break;
|
||||
#endif
|
||||
case "sha1":
|
||||
if (item.ItemType == ItemType.Disk)
|
||||
(item as Disk).SHA1 = attrVal;
|
||||
@@ -670,9 +663,6 @@ namespace SabreTools.DatFiles.Formats
|
||||
cmpw.WriteOptionalAttributeString("size", rom.Size?.ToString());
|
||||
cmpw.WriteOptionalAttributeString("crc", rom.CRC?.ToLowerInvariant());
|
||||
cmpw.WriteOptionalAttributeString("md5", rom.MD5?.ToLowerInvariant());
|
||||
#if NET_FRAMEWORK
|
||||
cmpw.WriteOptionalAttributeString("ripemd160", rom.RIPEMD160?.ToLowerInvariant());
|
||||
#endif
|
||||
cmpw.WriteOptionalAttributeString("sha1", rom.SHA1?.ToLowerInvariant());
|
||||
cmpw.WriteOptionalAttributeString("sha256", rom.SHA256?.ToLowerInvariant());
|
||||
cmpw.WriteOptionalAttributeString("sha384", rom.SHA384?.ToLowerInvariant());
|
||||
|
||||
@@ -72,9 +72,6 @@ namespace SabreTools.DatFiles.Formats
|
||||
Size = null,
|
||||
CRC = (_hash.HasFlag(Hash.CRC) ? hash : null),
|
||||
MD5 = (_hash.HasFlag(Hash.MD5) ? hash : null),
|
||||
#if NET_FRAMEWORK
|
||||
RIPEMD160 = (_hash.HasFlag(Hash.RIPEMD160) ? hash : null),
|
||||
#endif
|
||||
SHA1 = (_hash.HasFlag(Hash.SHA1) ? hash : null),
|
||||
SHA256 = (_hash.HasFlag(Hash.SHA256) ? hash : null),
|
||||
SHA384 = (_hash.HasFlag(Hash.SHA384) ? hash : null),
|
||||
@@ -264,19 +261,6 @@ namespace SabreTools.DatFiles.Formats
|
||||
|
||||
break;
|
||||
|
||||
#if NET_FRAMEWORK
|
||||
case Hash.RIPEMD160:
|
||||
switch (datItem.ItemType)
|
||||
{
|
||||
case ItemType.Rom:
|
||||
var rom = datItem as Rom;
|
||||
fields[0] = rom.RIPEMD160;
|
||||
fields[1] = name;
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
#endif
|
||||
case Hash.SHA1:
|
||||
switch (datItem.ItemType)
|
||||
{
|
||||
|
||||
@@ -48,7 +48,6 @@ namespace SabreTools.DatFiles.Formats
|
||||
<!ATTLIST rom size CDATA #REQUIRED>
|
||||
<!ATTLIST rom crc CDATA #IMPLIED>
|
||||
<!ATTLIST rom md5 CDATA #IMPLIED>
|
||||
<!ATTLIST rom ripemd160 CDATA #IMPLIED>
|
||||
<!ATTLIST rom sha1 CDATA #IMPLIED>
|
||||
<!ATTLIST rom sha256 CDATA #IMPLIED>
|
||||
<!ATTLIST rom sha384 CDATA #IMPLIED>
|
||||
@@ -61,11 +60,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
<!ELEMENT disk EMPTY>
|
||||
<!ATTLIST disk name CDATA #REQUIRED>
|
||||
<!ATTLIST disk md5 CDATA #IMPLIED>
|
||||
<!ATTLIST disk ripemd160 CDATA #IMPLIED>
|
||||
<!ATTLIST disk sha1 CDATA #IMPLIED>
|
||||
<!ATTLIST disk sha256 CDATA #IMPLIED>
|
||||
<!ATTLIST disk sha384 CDATA #IMPLIED>
|
||||
<!ATTLIST disk sha512 CDATA #IMPLIED>
|
||||
<!ATTLIST disk merge CDATA #IMPLIED>
|
||||
<!ATTLIST disk region CDATA #IMPLIED>
|
||||
<!ATTLIST disk index CDATA #IMPLIED>
|
||||
|
||||
@@ -93,7 +93,6 @@ namespace SabreTools.DatFiles.Formats
|
||||
<!ATTLIST rom size CDATA #REQUIRED>
|
||||
<!ATTLIST rom crc CDATA #IMPLIED>
|
||||
<!ATTLIST rom md5 CDATA #IMPLIED>
|
||||
<!ATTLIST rom ripemd160 CDATA #IMPLIED>
|
||||
<!ATTLIST rom sha1 CDATA #IMPLIED>
|
||||
<!ATTLIST rom sha256 CDATA #IMPLIED>
|
||||
<!ATTLIST rom sha384 CDATA #IMPLIED>
|
||||
@@ -104,11 +103,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
<!ELEMENT disk EMPTY>
|
||||
<!ATTLIST disk name CDATA #REQUIRED>
|
||||
<!ATTLIST disk md5 CDATA #IMPLIED>
|
||||
<!ATTLIST disk ripemd160 CDATA #IMPLIED>
|
||||
<!ATTLIST disk sha1 CDATA #IMPLIED>
|
||||
<!ATTLIST disk sha256 CDATA #IMPLIED>
|
||||
<!ATTLIST disk sha384 CDATA #IMPLIED>
|
||||
<!ATTLIST disk sha512 CDATA #IMPLIED>
|
||||
<!ATTLIST disk merge CDATA #IMPLIED>
|
||||
<!ATTLIST disk status (baddump|nodump|good|verified) string.Emptygoodstring.Empty>
|
||||
<!ELEMENT sample EMPTY>
|
||||
@@ -612,9 +607,6 @@ namespace SabreTools.DatFiles.Formats
|
||||
Size = Utilities.CleanLong(reader.GetAttribute("size")),
|
||||
CRC = reader.GetAttribute("crc"),
|
||||
MD5 = reader.GetAttribute("md5"),
|
||||
#if NET_FRAMEWORK
|
||||
RIPEMD160 = reader.GetAttribute("ripemd160"),
|
||||
#endif
|
||||
SHA1 = reader.GetAttribute("sha1"),
|
||||
SHA256 = reader.GetAttribute("sha256"),
|
||||
SHA384 = reader.GetAttribute("sha384"),
|
||||
@@ -1099,9 +1091,6 @@ namespace SabreTools.DatFiles.Formats
|
||||
xtw.WriteAttributeString("size", rom.Size?.ToString());
|
||||
xtw.WriteOptionalAttributeString("crc", rom.CRC?.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("md5", rom.MD5?.ToLowerInvariant());
|
||||
#if NET_FRAMEWORK
|
||||
xtw.WriteOptionalAttributeString("ripemd160", rom.RIPEMD160?.ToLowerInvariant());
|
||||
#endif
|
||||
xtw.WriteOptionalAttributeString("sha1", rom.SHA1?.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha256", rom.SHA256?.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha384", rom.SHA384?.ToLowerInvariant());
|
||||
|
||||
@@ -220,7 +220,6 @@ namespace SabreTools.DatFiles.Formats
|
||||
"Size",
|
||||
"CRC",
|
||||
"MD5",
|
||||
//"RIPEMD160",
|
||||
"SHA1",
|
||||
"SHA256",
|
||||
//"SHA384",
|
||||
@@ -298,7 +297,6 @@ namespace SabreTools.DatFiles.Formats
|
||||
fields[8] = rom.Size?.ToString();
|
||||
fields[9] = rom.CRC?.ToLowerInvariant();
|
||||
fields[10] = rom.MD5?.ToLowerInvariant();
|
||||
//fields[11] = rom.RIPEMD160?.ToLowerInvariant();
|
||||
fields[11] = rom.SHA1?.ToLowerInvariant();
|
||||
fields[12] = rom.SHA256?.ToLowerInvariant();
|
||||
//fields[13] = rom.SHA384?.ToLowerInvariant();
|
||||
|
||||
@@ -55,7 +55,6 @@ namespace SabreTools.DatFiles.Formats
|
||||
<!ATTLIST rom size CDATA #IMPLIED>
|
||||
<!ATTLIST rom crc CDATA #IMPLIED>
|
||||
<!ATTLIST rom md5 CDATA #IMPLIED>
|
||||
<!ATTLIST rom ripemd160 CDATA #IMPLIED>
|
||||
<!ATTLIST rom sha1 CDATA #IMPLIED>
|
||||
<!ATTLIST rom sha256 CDATA #IMPLIED>
|
||||
<!ATTLIST rom sha384 CDATA #IMPLIED>
|
||||
@@ -69,11 +68,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
<!ELEMENT disk EMPTY>
|
||||
<!ATTLIST disk name CDATA #REQUIRED>
|
||||
<!ATTLIST disk md5 CDATA #IMPLIED>
|
||||
<!ATTLIST disk ripemd160 CDATA #IMPLIED>
|
||||
<!ATTLIST disk sha1 CDATA #IMPLIED>
|
||||
<!ATTLIST disk sha256 CDATA #IMPLIED>
|
||||
<!ATTLIST disk sha384 CDATA #IMPLIED>
|
||||
<!ATTLIST disk sha512 CDATA #IMPLIED>
|
||||
<!ATTLIST disk status (baddump|nodump|good) string.Emptygoodstring.Empty>
|
||||
<!ATTLIST disk writeable (yes|no) string.Emptynostring.Empty>
|
||||
<!ELEMENT dipswitch (dipvalue*)>
|
||||
@@ -846,9 +841,6 @@ namespace SabreTools.DatFiles.Formats
|
||||
xtw.WriteOptionalAttributeString("size", rom.Size?.ToString());
|
||||
xtw.WriteOptionalAttributeString("crc", rom.CRC?.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("md5", rom.MD5?.ToLowerInvariant());
|
||||
#if NET_FRAMEWORK
|
||||
xtw.WriteOptionalAttributeString("ripemd160", rom.RIPEMD160?.ToLowerInvariant());
|
||||
#endif
|
||||
xtw.WriteOptionalAttributeString("sha1", rom.SHA1?.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha256", rom.SHA256?.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha384", rom.SHA384?.ToLowerInvariant());
|
||||
|
||||
@@ -297,14 +297,6 @@ namespace SabreTools.DatFiles
|
||||
[JsonIgnore, XmlIgnore]
|
||||
public long MD5Count { get; private set; } = 0;
|
||||
|
||||
#if NET_FRAMEWORK
|
||||
/// <summary>
|
||||
/// Number of items with a RIPEMD160 hash
|
||||
/// </summary>
|
||||
[JsonIgnore, XmlIgnore]
|
||||
public long RIPEMD160Count { get; private set; } = 0;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Number of items with a SHA-1 hash
|
||||
/// </summary>
|
||||
@@ -479,9 +471,6 @@ namespace SabreTools.DatFiles
|
||||
// Individual hash counts
|
||||
CRCCount += stats.CRCCount;
|
||||
MD5Count += stats.MD5Count;
|
||||
#if NET_FRAMEWORK
|
||||
RIPEMD160Count += stats.RIPEMD160Count;
|
||||
#endif
|
||||
SHA1Count += stats.SHA1Count;
|
||||
SHA256Count += stats.SHA256Count;
|
||||
SHA384Count += stats.SHA384Count;
|
||||
@@ -746,9 +735,6 @@ namespace SabreTools.DatFiles
|
||||
TotalSize += (item as Rom).Size ?? 0;
|
||||
CRCCount += (string.IsNullOrWhiteSpace((item as Rom).CRC) ? 0 : 1);
|
||||
MD5Count += (string.IsNullOrWhiteSpace((item as Rom).MD5) ? 0 : 1);
|
||||
#if NET_FRAMEWORK
|
||||
RIPEMD160Count += (string.IsNullOrWhiteSpace((item as Rom).RIPEMD160) ? 0 : 1);
|
||||
#endif
|
||||
SHA1Count += (string.IsNullOrWhiteSpace((item as Rom).SHA1) ? 0 : 1);
|
||||
SHA256Count += (string.IsNullOrWhiteSpace((item as Rom).SHA256) ? 0 : 1);
|
||||
SHA384Count += (string.IsNullOrWhiteSpace((item as Rom).SHA384) ? 0 : 1);
|
||||
@@ -905,9 +891,6 @@ namespace SabreTools.DatFiles
|
||||
TotalSize -= (item as Rom).Size ?? 0;
|
||||
CRCCount -= (string.IsNullOrWhiteSpace((item as Rom).CRC) ? 0 : 1);
|
||||
MD5Count -= (string.IsNullOrWhiteSpace((item as Rom).MD5) ? 0 : 1);
|
||||
#if NET_FRAMEWORK
|
||||
RIPEMD160Count -= (string.IsNullOrWhiteSpace((item as Rom).RIPEMD160) ? 0 : 1);
|
||||
#endif
|
||||
SHA1Count -= (string.IsNullOrWhiteSpace((item as Rom).SHA1) ? 0 : 1);
|
||||
SHA256Count -= (string.IsNullOrWhiteSpace((item as Rom).SHA256) ? 0 : 1);
|
||||
SHA384Count -= (string.IsNullOrWhiteSpace((item as Rom).SHA384) ? 0 : 1);
|
||||
@@ -1209,9 +1192,6 @@ namespace SabreTools.DatFiles
|
||||
|
||||
CRCCount = 0;
|
||||
MD5Count = 0;
|
||||
#if NET_FRAMEWORK
|
||||
RIPEMD160Count = 0;
|
||||
#endif
|
||||
SHA1Count = 0;
|
||||
SHA256Count = 0;
|
||||
SHA384Count = 0;
|
||||
@@ -1246,12 +1226,6 @@ namespace SabreTools.DatFiles
|
||||
else if (DiskCount + MediaCount + RomCount - NodumpCount == SHA1Count)
|
||||
return Field.DatItem_SHA1;
|
||||
|
||||
#if NET_FRAMEWORK
|
||||
// If all items are supposed to have a RIPEMD160, we bucket by that
|
||||
else if (DiskCount + MediaCount + RomCount - NodumpCount == RIPEMD160Count)
|
||||
return Field.DatItem_RIPEMD160;
|
||||
#endif
|
||||
|
||||
// If all items are supposed to have a MD5, we bucket by that
|
||||
else if (DiskCount + MediaCount + RomCount - NodumpCount == MD5Count)
|
||||
return Field.DatItem_MD5;
|
||||
|
||||
@@ -1,16 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net48;netcoreapp3.1;net5.0</TargetFrameworks>
|
||||
<TargetFrameworks>netcoreapp3.1;net5.0</TargetFrameworks>
|
||||
<RuntimeIdentifiers>win10-x64;win7-x86</RuntimeIdentifiers>
|
||||
<Configurations>Debug;Release</Configurations>
|
||||
<Platforms>AnyCPU;x64</Platforms>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(TargetFramework)'=='net48'">
|
||||
<DefineConstants>NET_FRAMEWORK</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SabreTools.Core\SabreTools.Core.csproj" />
|
||||
<ProjectReference Include="..\SabreTools.DatItems\SabreTools.DatItems.csproj" />
|
||||
|
||||
@@ -156,124 +156,6 @@ namespace SabreTools.DatItems
|
||||
/// <returns>DatItem of the specific internal type that corresponds to the inputs</returns>
|
||||
public static DatItem Create(ItemType? itemType)
|
||||
{
|
||||
#if NET_FRAMEWORK
|
||||
switch (itemType)
|
||||
{
|
||||
case ItemType.Adjuster:
|
||||
return new Adjuster();
|
||||
|
||||
case ItemType.Analog:
|
||||
return new Analog();
|
||||
|
||||
case ItemType.Archive:
|
||||
return new Archive();
|
||||
|
||||
case ItemType.BiosSet:
|
||||
return new BiosSet();
|
||||
|
||||
case ItemType.Blank:
|
||||
return new Blank();
|
||||
|
||||
case ItemType.Chip:
|
||||
return new Chip();
|
||||
|
||||
case ItemType.Condition:
|
||||
return new Condition();
|
||||
|
||||
case ItemType.Configuration:
|
||||
return new Configuration();
|
||||
|
||||
case ItemType.Control:
|
||||
return new Control();
|
||||
|
||||
case ItemType.DataArea:
|
||||
return new DataArea();
|
||||
|
||||
case ItemType.Device:
|
||||
return new Device();
|
||||
|
||||
case ItemType.DeviceReference:
|
||||
return new DeviceReference();
|
||||
|
||||
case ItemType.DipSwitch:
|
||||
return new DipSwitch();
|
||||
|
||||
case ItemType.Disk:
|
||||
return new Disk();
|
||||
|
||||
case ItemType.DiskArea:
|
||||
return new DiskArea();
|
||||
|
||||
case ItemType.Display:
|
||||
return new Display();
|
||||
|
||||
case ItemType.Driver:
|
||||
return new Driver();
|
||||
|
||||
case ItemType.Extension:
|
||||
return new Extension();
|
||||
|
||||
case ItemType.Feature:
|
||||
return new Feature();
|
||||
|
||||
case ItemType.Info:
|
||||
return new Info();
|
||||
|
||||
case ItemType.Input:
|
||||
return new Input();
|
||||
|
||||
case ItemType.Instance:
|
||||
return new Instance();
|
||||
|
||||
case ItemType.Location:
|
||||
return new Location();
|
||||
|
||||
case ItemType.Media:
|
||||
return new Media();
|
||||
|
||||
case ItemType.Part:
|
||||
return new Part();
|
||||
|
||||
case ItemType.PartFeature:
|
||||
return new PartFeature();
|
||||
|
||||
case ItemType.Port:
|
||||
return new Port();
|
||||
|
||||
case ItemType.RamOption:
|
||||
return new RamOption();
|
||||
|
||||
case ItemType.Release:
|
||||
return new Release();
|
||||
|
||||
case ItemType.Rom:
|
||||
return new Rom();
|
||||
|
||||
case ItemType.Sample:
|
||||
return new Sample();
|
||||
|
||||
case ItemType.Setting:
|
||||
return new Setting();
|
||||
|
||||
case ItemType.SharedFeature:
|
||||
return new SharedFeature();
|
||||
|
||||
case ItemType.Slot:
|
||||
return new Slot();
|
||||
|
||||
case ItemType.SlotOption:
|
||||
return new SlotOption();
|
||||
|
||||
case ItemType.SoftwareList:
|
||||
return new SoftwareList();
|
||||
|
||||
case ItemType.Sound:
|
||||
return new Sound();
|
||||
|
||||
default:
|
||||
return new Rom();
|
||||
}
|
||||
#else
|
||||
return itemType switch
|
||||
{
|
||||
ItemType.Adjuster => new Adjuster(),
|
||||
@@ -309,7 +191,6 @@ namespace SabreTools.DatItems
|
||||
ItemType.Sound => new Sound(),
|
||||
_ => new Rom(),
|
||||
};
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -458,18 +339,6 @@ namespace SabreTools.DatItems
|
||||
return CleanHashData(hash, Constants.MD5Length);
|
||||
}
|
||||
|
||||
#if NET_FRAMEWORK
|
||||
/// <summary>
|
||||
/// Clean a RIPEMD160 string and pad to the correct size
|
||||
/// </summary>
|
||||
/// <param name="hash">Hash string to sanitize</param>
|
||||
/// <returns>Cleaned string</returns>
|
||||
protected string CleanRIPEMD160(string hash)
|
||||
{
|
||||
return CleanHashData(hash, Constants.RIPEMD160Length);
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Clean a SHA1 string and pad to the correct size
|
||||
/// </summary>
|
||||
@@ -596,12 +465,6 @@ namespace SabreTools.DatItems
|
||||
key = Constants.MD5Zero;
|
||||
break;
|
||||
|
||||
#if NET_FRAMEWORK
|
||||
case Field.DatItem_RIPEMD160:
|
||||
key = Constants.RIPEMD160Zero;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case Field.DatItem_SHA1:
|
||||
key = Constants.SHA1Zero;
|
||||
break;
|
||||
@@ -819,11 +682,7 @@ namespace SabreTools.DatItems
|
||||
if (datItem.ItemType == ItemType.Disk || datItem.ItemType == ItemType.Media || datItem.ItemType == ItemType.Rom)
|
||||
{
|
||||
datItemName += GetDuplicateSuffix(datItem);
|
||||
#if NET_FRAMEWORK
|
||||
lastrenamed = lastrenamed ?? datItemName;
|
||||
#else
|
||||
lastrenamed ??= datItemName;
|
||||
#endif
|
||||
}
|
||||
|
||||
// If we have a conflict with the last renamed item, do the right thing
|
||||
|
||||
@@ -708,11 +708,6 @@ namespace SabreTools.DatItems
|
||||
if (datItemFields.Contains(DatItemField.MD5))
|
||||
rom.MD5 = null;
|
||||
|
||||
#if NET_FRAMEWORK
|
||||
if (datItemFields.Contains(DatItemField.RIPEMD160))
|
||||
rom.RIPEMD160 = null;
|
||||
#endif
|
||||
|
||||
if (datItemFields.Contains(DatItemField.SHA1))
|
||||
rom.SHA1 = null;
|
||||
|
||||
@@ -1755,14 +1750,6 @@ namespace SabreTools.DatItems
|
||||
rom.MD5 = newItem.MD5;
|
||||
}
|
||||
|
||||
#if NET_FRAMEWORK
|
||||
if (datItemFields.Contains(DatItemField.RIPEMD160))
|
||||
{
|
||||
if (string.IsNullOrEmpty(rom.RIPEMD160) && !string.IsNullOrEmpty(newItem.RIPEMD160))
|
||||
rom.RIPEMD160 = newItem.RIPEMD160;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (datItemFields.Contains(DatItemField.SHA1))
|
||||
{
|
||||
if (string.IsNullOrEmpty(rom.SHA1) && !string.IsNullOrEmpty(newItem.SHA1))
|
||||
@@ -2829,11 +2816,6 @@ namespace SabreTools.DatItems
|
||||
if (datItemMappings.Keys.Contains(DatItemField.MD5))
|
||||
rom.MD5 = datItemMappings[DatItemField.MD5];
|
||||
|
||||
#if NET_FRAMEWORK
|
||||
if (datItemMappings.Keys.Contains(DatItemField.RIPEMD160))
|
||||
rom.RIPEMD160 = datItemMappings[DatItemField.RIPEMD160];
|
||||
#endif
|
||||
|
||||
if (datItemMappings.Keys.Contains(DatItemField.SHA1))
|
||||
rom.SHA1 = datItemMappings[DatItemField.SHA1];
|
||||
|
||||
|
||||
@@ -21,9 +21,6 @@ namespace SabreTools.DatItems
|
||||
|
||||
private byte[] _crc; // 8 bytes
|
||||
private byte[] _md5; // 16 bytes
|
||||
#if NET_FRAMEWORK
|
||||
private byte[] _ripemd160; // 20 bytes
|
||||
#endif
|
||||
private byte[] _sha1; // 20 bytes
|
||||
private byte[] _sha256; // 32 bytes
|
||||
private byte[] _sha384; // 48 bytes
|
||||
@@ -82,19 +79,6 @@ namespace SabreTools.DatItems
|
||||
set { _md5 = Utilities.StringToByteArray(CleanMD5(value)); }
|
||||
}
|
||||
|
||||
#if NET_FRAMEWORK
|
||||
/// <summary>
|
||||
/// File RIPEMD160 hash
|
||||
/// </summary>
|
||||
[JsonProperty("ripemd160", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
[XmlElement("ripemd160")]
|
||||
public string RIPEMD160
|
||||
{
|
||||
get { return _ripemd160.IsNullOrEmpty() ? null : Utilities.ByteArrayToString(_ripemd160); }
|
||||
set { _ripemd160 = Utilities.StringToByteArray(CleanRIPEMD160(value)); }
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// File SHA-1 hash
|
||||
/// </summary>
|
||||
@@ -391,9 +375,6 @@ namespace SabreTools.DatItems
|
||||
Size = baseFile.Size;
|
||||
_crc = baseFile.CRC;
|
||||
_md5 = baseFile.MD5;
|
||||
#if NET_FRAMEWORK
|
||||
_ripemd160 = baseFile.RIPEMD160;
|
||||
#endif
|
||||
_sha1 = baseFile.SHA1;
|
||||
_sha256 = baseFile.SHA256;
|
||||
_sha384 = baseFile.SHA384;
|
||||
@@ -426,9 +407,6 @@ namespace SabreTools.DatItems
|
||||
Size = this.Size,
|
||||
_crc = this._crc,
|
||||
_md5 = this._md5,
|
||||
#if NET_FRAMEWORK
|
||||
_ripemd160 = this._ripemd160,
|
||||
#endif
|
||||
_sha1 = this._sha1,
|
||||
_sha256 = this._sha256,
|
||||
_sha384 = this._sha384,
|
||||
@@ -471,9 +449,6 @@ namespace SabreTools.DatItems
|
||||
Size = this.Size,
|
||||
CRC = this._crc,
|
||||
MD5 = this._md5,
|
||||
#if NET_FRAMEWORK
|
||||
RIPEMD160 = this._ripemd160,
|
||||
#endif
|
||||
SHA1 = this._sha1,
|
||||
SHA256 = this._sha256,
|
||||
SHA384 = this._sha384,
|
||||
@@ -535,11 +510,6 @@ namespace SabreTools.DatItems
|
||||
if (_md5.IsNullOrEmpty() && !other._md5.IsNullOrEmpty())
|
||||
_md5 = other._md5;
|
||||
|
||||
#if NET_FRAMEWORK
|
||||
if (_ripemd160.IsNullOrEmpty() && !other._ripemd160.IsNullOrEmpty())
|
||||
_ripemd160 = other._ripemd160;
|
||||
#endif
|
||||
|
||||
if (_sha1.IsNullOrEmpty() && !other._sha1.IsNullOrEmpty())
|
||||
_sha1 = other._sha1;
|
||||
|
||||
@@ -588,9 +558,6 @@ namespace SabreTools.DatItems
|
||||
{
|
||||
return !_crc.IsNullOrEmpty()
|
||||
|| !_md5.IsNullOrEmpty()
|
||||
#if NET_FRAMEWORK
|
||||
|| !_ripemd160.IsNullOrEmpty()
|
||||
#endif
|
||||
|| !_sha1.IsNullOrEmpty()
|
||||
|| !_sha256.IsNullOrEmpty()
|
||||
|| !_sha384.IsNullOrEmpty()
|
||||
@@ -606,9 +573,6 @@ namespace SabreTools.DatItems
|
||||
{
|
||||
return (_crc != null && _crc.SequenceEqual(Constants.CRCZeroBytes))
|
||||
|| (_md5 != null && _md5.SequenceEqual(Constants.MD5ZeroBytes))
|
||||
#if NET_FRAMEWORK
|
||||
|| (_ripemd160 != null && _ripemd160.SequenceEqual(Constants.RIPEMD160ZeroBytes))
|
||||
#endif
|
||||
|| (_sha1 != null && _sha1.SequenceEqual(Constants.SHA1ZeroBytes))
|
||||
|| (_sha256 != null && _sha256.SequenceEqual(Constants.SHA256ZeroBytes))
|
||||
|| (_sha384 != null && _sha384.SequenceEqual(Constants.SHA384ZeroBytes))
|
||||
@@ -625,9 +589,6 @@ namespace SabreTools.DatItems
|
||||
{
|
||||
return !(_crc.IsNullOrEmpty() ^ other._crc.IsNullOrEmpty())
|
||||
|| !(_md5.IsNullOrEmpty() ^ other._md5.IsNullOrEmpty())
|
||||
#if NET_FRAMEWORK
|
||||
|| !(_ripemd160.IsNullOrEmpty() || other._ripemd160.IsNullOrEmpty())
|
||||
#endif
|
||||
|| !(_sha1.IsNullOrEmpty() ^ other._sha1.IsNullOrEmpty())
|
||||
|| !(_sha256.IsNullOrEmpty() ^ other._sha256.IsNullOrEmpty())
|
||||
|| !(_sha384.IsNullOrEmpty() ^ other._sha384.IsNullOrEmpty())
|
||||
@@ -653,9 +614,6 @@ namespace SabreTools.DatItems
|
||||
// Return if all hashes match according to merge rules
|
||||
return ConditionalHashEquals(_crc, other._crc)
|
||||
&& ConditionalHashEquals(_md5, other._md5)
|
||||
#if NET_FRAMEWORK
|
||||
&& ConditionalHashEquals(_ripemd160, other._ripemd160)
|
||||
#endif
|
||||
&& ConditionalHashEquals(_sha1, other._sha1)
|
||||
&& ConditionalHashEquals(_sha256, other._sha256)
|
||||
&& ConditionalHashEquals(_sha384, other._sha384)
|
||||
@@ -690,12 +648,6 @@ namespace SabreTools.DatItems
|
||||
key = MD5;
|
||||
break;
|
||||
|
||||
#if NET_FRAMEWORK
|
||||
case Field.DatItem_RIPEMD160:
|
||||
key = RIPEMD160;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case Field.DatItem_SHA1:
|
||||
key = SHA1;
|
||||
break;
|
||||
|
||||
@@ -1,16 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net48;netcoreapp3.1;net5.0</TargetFrameworks>
|
||||
<TargetFrameworks>netcoreapp3.1;net5.0</TargetFrameworks>
|
||||
<RuntimeIdentifiers>win10-x64;win7-x86</RuntimeIdentifiers>
|
||||
<Configurations>Debug;Release</Configurations>
|
||||
<Platforms>AnyCPU;x64</Platforms>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(TargetFramework)'=='net48'">
|
||||
<DefineConstants>NET_FRAMEWORK</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SabreTools.Core\SabreTools.Core.csproj" />
|
||||
<ProjectReference Include="..\SabreTools.FileTypes\SabreTools.FileTypes.csproj" />
|
||||
|
||||
@@ -134,10 +134,6 @@ namespace SabreTools.DatTools
|
||||
return DatFormat.SabreJSON;
|
||||
case "md5":
|
||||
return DatFormat.RedumpMD5;
|
||||
#if NET_FRAMEWORK
|
||||
case "ripemd160":
|
||||
return DatFormat.RedumpRIPEMD160;
|
||||
#endif
|
||||
case "sfv":
|
||||
return DatFormat.RedumpSFV;
|
||||
case "sha1":
|
||||
|
||||
@@ -653,21 +653,6 @@ namespace SabreTools.DatTools
|
||||
/// </summary>
|
||||
private static OutputFormat GetOutputFormat(PackingFlag packing)
|
||||
{
|
||||
#if NET_FRAMEWORK
|
||||
switch (packing)
|
||||
{
|
||||
case PackingFlag.Zip:
|
||||
return OutputFormat.TorrentZip;
|
||||
case PackingFlag.Unzip:
|
||||
case PackingFlag.Partial:
|
||||
return OutputFormat.Folder;
|
||||
case PackingFlag.Flat:
|
||||
return OutputFormat.ParentFolder;
|
||||
case PackingFlag.None:
|
||||
default:
|
||||
return OutputFormat.Folder;
|
||||
}
|
||||
#else
|
||||
return packing switch
|
||||
{
|
||||
PackingFlag.Zip => OutputFormat.TorrentZip,
|
||||
@@ -677,7 +662,6 @@ namespace SabreTools.DatTools
|
||||
PackingFlag.None => OutputFormat.Folder,
|
||||
_ => OutputFormat.Folder,
|
||||
};
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -709,32 +693,6 @@ namespace SabreTools.DatTools
|
||||
/// <returns>String value corresponding to the OutputFormat</returns>
|
||||
private static string FromOutputFormat(OutputFormat itemType)
|
||||
{
|
||||
#if NET_FRAMEWORK
|
||||
switch (itemType)
|
||||
{
|
||||
case OutputFormat.Folder:
|
||||
case OutputFormat.ParentFolder:
|
||||
return "directory";
|
||||
case OutputFormat.TapeArchive:
|
||||
return "TAR";
|
||||
case OutputFormat.Torrent7Zip:
|
||||
return "Torrent7Z";
|
||||
case OutputFormat.TorrentGzip:
|
||||
case OutputFormat.TorrentGzipRomba:
|
||||
return "TorrentGZ";
|
||||
case OutputFormat.TorrentLRZip:
|
||||
return "TorrentLRZ";
|
||||
case OutputFormat.TorrentRar:
|
||||
return "TorrentRAR";
|
||||
case OutputFormat.TorrentXZ:
|
||||
case OutputFormat.TorrentXZRomba:
|
||||
return "TorrentXZ";
|
||||
case OutputFormat.TorrentZip:
|
||||
return "TorrentZip";
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
#else
|
||||
return itemType switch
|
||||
{
|
||||
OutputFormat.Folder => "directory",
|
||||
@@ -750,7 +708,6 @@ namespace SabreTools.DatTools
|
||||
OutputFormat.TorrentZip => "TorrentZip",
|
||||
_ => null,
|
||||
};
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net48;netcoreapp3.1;net5.0</TargetFrameworks>
|
||||
<TargetFrameworks>netcoreapp3.1;net5.0</TargetFrameworks>
|
||||
<RuntimeIdentifiers>win10-x64;win7-x86</RuntimeIdentifiers>
|
||||
<Configurations>Debug;Release</Configurations>
|
||||
<Platforms>AnyCPU;x64</Platforms>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(TargetFramework)'=='net48'">
|
||||
<DefineConstants>NET_FRAMEWORK</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SabreTools.Core\SabreTools.Core.csproj" />
|
||||
<ProjectReference Include="..\SabreTools.DatFiles\SabreTools.DatFiles.csproj" />
|
||||
|
||||
@@ -123,13 +123,6 @@ namespace SabreTools.DatTools
|
||||
fieldDats[Field.DatItem_SHA1].Header.Name += " (SHA-1)";
|
||||
fieldDats[Field.DatItem_SHA1].Header.Description += " (SHA-1)";
|
||||
|
||||
#if NET_FRAMEWORK
|
||||
fieldDats[Field.DatItem_RIPEMD160] = DatFile.Create(datFile.Header.CloneStandard());
|
||||
fieldDats[Field.DatItem_RIPEMD160].Header.FileName += " (RIPEMD160)";
|
||||
fieldDats[Field.DatItem_RIPEMD160].Header.Name += " (RIPEMD160)";
|
||||
fieldDats[Field.DatItem_RIPEMD160].Header.Description += " (RIPEMD160)";
|
||||
#endif
|
||||
|
||||
fieldDats[Field.DatItem_MD5] = DatFile.Create(datFile.Header.CloneStandard());
|
||||
fieldDats[Field.DatItem_MD5].Header.FileName += " (MD5)";
|
||||
fieldDats[Field.DatItem_MD5].Header.Name += " (MD5)";
|
||||
@@ -189,14 +182,6 @@ namespace SabreTools.DatTools
|
||||
fieldDats[Field.DatItem_SHA1].Items.Add(key, item);
|
||||
}
|
||||
|
||||
#if NET_FRAMEWORK
|
||||
// If the file has a RIPEMD160
|
||||
else if ((item.ItemType == ItemType.Rom && !string.IsNullOrWhiteSpace((item as Rom).RIPEMD160)))
|
||||
{
|
||||
fieldDats[Field.DatItem_RIPEMD160].Items.Add(key, item);
|
||||
}
|
||||
#endif
|
||||
|
||||
// If the file has an MD5
|
||||
else if ((item.ItemType == ItemType.Disk && !string.IsNullOrWhiteSpace((item as Disk).MD5))
|
||||
|| (item.ItemType == ItemType.Media && !string.IsNullOrWhiteSpace((item as Media).MD5))
|
||||
|
||||
@@ -87,13 +87,6 @@ namespace SabreTools.FileTypes
|
||||
/// </summary>
|
||||
public byte[] MD5 { get; set; } = null;
|
||||
|
||||
#if NET_FRAMEWORK
|
||||
/// <summary>
|
||||
/// RIPEMD160 hash of the file
|
||||
/// </summary>
|
||||
public byte[] RIPEMD160 { get; set; } = null;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// SHA-1 hash of the file
|
||||
/// </summary>
|
||||
@@ -148,9 +141,6 @@ namespace SabreTools.FileTypes
|
||||
this.Date = temp.Date;
|
||||
this.CRC = temp.CRC;
|
||||
this.MD5 = temp.MD5;
|
||||
#if NET_FRAMEWORK
|
||||
this.RIPEMD160 = temp.RIPEMD160;
|
||||
#endif
|
||||
this.SHA1 = temp.SHA1;
|
||||
this.SHA256 = temp.SHA256;
|
||||
this.SHA384 = temp.SHA384;
|
||||
@@ -179,9 +169,6 @@ namespace SabreTools.FileTypes
|
||||
this.Date = temp.Date;
|
||||
this.CRC = temp.CRC;
|
||||
this.MD5 = temp.MD5;
|
||||
#if NET_FRAMEWORK
|
||||
this.RIPEMD160 = temp.RIPEMD160;
|
||||
#endif
|
||||
this.SHA1 = temp.SHA1;
|
||||
this.SHA256 = temp.SHA256;
|
||||
this.SHA384 = temp.SHA384;
|
||||
@@ -355,10 +342,6 @@ namespace SabreTools.FileTypes
|
||||
hashers.Add(new Hasher(Hash.CRC));
|
||||
if (hashes.HasFlag(Hash.MD5))
|
||||
hashers.Add(new Hasher(Hash.MD5));
|
||||
#if NET_FRAMEWORK
|
||||
if (hashes.HasFlag(Hash.RIPEMD160))
|
||||
hashers.Add(new Hasher(Hash.RIPEMD160));
|
||||
#endif
|
||||
if (hashes.HasFlag(Hash.SHA1))
|
||||
hashers.Add(new Hasher(Hash.SHA1));
|
||||
if (hashes.HasFlag(Hash.SHA256))
|
||||
@@ -424,9 +407,6 @@ namespace SabreTools.FileTypes
|
||||
Size = size,
|
||||
CRC = hashes.HasFlag(Hash.CRC) ? hashers.First(h => h.HashType == Hash.CRC).GetHash() : null,
|
||||
MD5 = hashes.HasFlag(Hash.MD5) ? hashers.First(h => h.HashType == Hash.MD5).GetHash() : null,
|
||||
#if NET_FRAMEWORK
|
||||
RIPEMD160 = hashes.HasFlag(Hash.RIPEMD160) ? hashers.First(h => h.HashType == Hash.RIPEMD160).GetHash() : null,
|
||||
#endif
|
||||
SHA1 = hashes.HasFlag(Hash.SHA1) ? hashers.First(h => h.HashType == Hash.SHA1).GetHash() : null,
|
||||
SHA256 = hashes.HasFlag(Hash.SHA256) ? hashers.First(h => h.HashType == Hash.SHA256).GetHash() : null,
|
||||
SHA384 = hashes.HasFlag(Hash.SHA384) ? hashers.First(h => h.HashType == Hash.SHA384).GetHash() : null,
|
||||
|
||||
@@ -1,16 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net48;netcoreapp3.1;net5.0</TargetFrameworks>
|
||||
<TargetFrameworks>netcoreapp3.1;net5.0</TargetFrameworks>
|
||||
<RuntimeIdentifiers>win10-x64;win7-x86</RuntimeIdentifiers>
|
||||
<Configurations>Debug;Release</Configurations>
|
||||
<Platforms>AnyCPU;x64</Platforms>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(TargetFramework)'=='net48'">
|
||||
<DefineConstants>NET_FRAMEWORK</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SabreTools.Core\SabreTools.Core.csproj" />
|
||||
<ProjectReference Include="..\SabreTools.IO\SabreTools.IO.csproj" />
|
||||
|
||||
@@ -1206,12 +1206,6 @@ namespace SabreTools.Filtering
|
||||
if (!Filter.PassStringFilter(DatItemFilter.MD5, rom.MD5))
|
||||
return false;
|
||||
|
||||
#if NET_FRAMEWORK
|
||||
// Filter on RIPEMD160
|
||||
if (!Filter.PassStringFilter(DatItemFilter.RIPEMD160, rom.RIPEMD160))
|
||||
return false;
|
||||
#endif
|
||||
|
||||
// Filter on SHA-1
|
||||
if (!Filter.PassStringFilter(DatItemFilter.SHA1, rom.SHA1))
|
||||
return false;
|
||||
|
||||
@@ -31,9 +31,6 @@ namespace SabreTools.Filtering
|
||||
public FilterItem<long?> Size { get; private set; } = new FilterItem<long?>() { Positive = null, Negative = null, Neutral = null };
|
||||
public FilterItem<string> CRC { get; private set; } = new FilterItem<string>();
|
||||
public FilterItem<string> MD5 { get; private set; } = new FilterItem<string>();
|
||||
#if NET_FRAMEWORK
|
||||
public FilterItem<string> RIPEMD160 { get; private set; } = new FilterItem<string>();
|
||||
#endif
|
||||
public FilterItem<string> SHA1 { get; private set; } = new FilterItem<string>();
|
||||
public FilterItem<string> SHA256 { get; private set; } = new FilterItem<string>();
|
||||
public FilterItem<string> SHA384 { get; private set; } = new FilterItem<string>();
|
||||
@@ -292,12 +289,6 @@ namespace SabreTools.Filtering
|
||||
SetStringFilter(MD5, value, negate);
|
||||
break;
|
||||
|
||||
#if NET_FRAMEWORK
|
||||
case DatItemField.RIPEMD160:
|
||||
SetStringFilter(RIPEMD160, value, negate);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case DatItemField.SHA1:
|
||||
SetStringFilter(SHA1, value, negate);
|
||||
break;
|
||||
|
||||
@@ -1,16 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net48;netcoreapp3.1;net5.0</TargetFrameworks>
|
||||
<TargetFrameworks>netcoreapp3.1;net5.0</TargetFrameworks>
|
||||
<RuntimeIdentifiers>win10-x64;win7-x86</RuntimeIdentifiers>
|
||||
<Configurations>Debug;Release</Configurations>
|
||||
<Platforms>AnyCPU;x64</Platforms>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(TargetFramework)'=='net48'">
|
||||
<DefineConstants>NET_FRAMEWORK</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SabreTools.Core\SabreTools.Core.csproj" />
|
||||
<ProjectReference Include="..\SabreTools.DatFiles\SabreTools.DatFiles.csproj" />
|
||||
|
||||
@@ -238,11 +238,7 @@ namespace SabreTools.Help
|
||||
output = CreatePadding(pre + 4);
|
||||
}
|
||||
|
||||
#if NET_FRAMEWORK
|
||||
output += subsplit[subsplit.Length - 1];
|
||||
#else
|
||||
output += subsplit[^1];
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -376,11 +372,7 @@ namespace SabreTools.Help
|
||||
output = CreatePadding(preAdjusted + 4);
|
||||
}
|
||||
|
||||
#if NET_FRAMEWORK
|
||||
output += subsplit[subsplit.Length - 1];
|
||||
#else
|
||||
output += subsplit[^1];
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -577,23 +569,6 @@ namespace SabreTools.Help
|
||||
/// <returns>True if the feature is enabled, false otherwise</returns>
|
||||
public bool IsEnabled()
|
||||
{
|
||||
#if NET_FRAMEWORK
|
||||
switch (_featureType)
|
||||
{
|
||||
case ParameterType.Flag:
|
||||
return (_value as bool?) == true;
|
||||
case ParameterType.String:
|
||||
return (_value as string) != null;
|
||||
case ParameterType.Int32:
|
||||
return (_value as int?).HasValue && (_value as int?).Value != int.MinValue;
|
||||
case ParameterType.Int64:
|
||||
return (_value as long?).HasValue && (_value as long?).Value != long.MinValue;
|
||||
case ParameterType.List:
|
||||
return (_value as List<string>) != null;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
return _featureType switch
|
||||
{
|
||||
ParameterType.Flag => (_value as bool?) == true,
|
||||
@@ -603,7 +578,6 @@ namespace SabreTools.Help
|
||||
ParameterType.List => (_value as List<string>) != null,
|
||||
_ => false,
|
||||
};
|
||||
#endif
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -1,16 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net48;netcoreapp3.1;net5.0</TargetFrameworks>
|
||||
<TargetFrameworks>netcoreapp3.1;net5.0</TargetFrameworks>
|
||||
<RuntimeIdentifiers>win10-x64;win7-x86</RuntimeIdentifiers>
|
||||
<Configurations>Debug;Release</Configurations>
|
||||
<Platforms>AnyCPU;x64</Platforms>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(TargetFramework)'=='net48'">
|
||||
<DefineConstants>NET_FRAMEWORK</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SabreTools.Logging\SabreTools.Logging.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -1,16 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net48;netcoreapp3.1;net5.0</TargetFrameworks>
|
||||
<TargetFrameworks>netcoreapp3.1;net5.0</TargetFrameworks>
|
||||
<RuntimeIdentifiers>win10-x64;win7-x86</RuntimeIdentifiers>
|
||||
<Configurations>Debug;Release</Configurations>
|
||||
<Platforms>AnyCPU;x64</Platforms>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(TargetFramework)'=='net48'">
|
||||
<DefineConstants>NET_FRAMEWORK</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SabreTools.Core\SabreTools.Core.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -1,16 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net48;netcoreapp3.1;net5.0</TargetFrameworks>
|
||||
<TargetFrameworks>netcoreapp3.1;net5.0</TargetFrameworks>
|
||||
<RuntimeIdentifiers>win10-x64;win7-x86</RuntimeIdentifiers>
|
||||
<Configurations>Debug;Release</Configurations>
|
||||
<Platforms>AnyCPU;x64</Platforms>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(TargetFramework)'=='net48'">
|
||||
<DefineConstants>NET_FRAMEWORK</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SabreTools.Core\SabreTools.Core.csproj" />
|
||||
<ProjectReference Include="..\SabreTools.IO\SabreTools.IO.csproj" />
|
||||
|
||||
@@ -62,31 +62,6 @@ namespace SabreTools.Reports
|
||||
/// <returns>BaseReport of the specific internal type that corresponds to the inputs</returns>
|
||||
public static BaseReport Create(StatReportFormat statReportFormat, string filename, bool baddumpCol, bool nodumpCol)
|
||||
{
|
||||
#if NET_FRAMEWORK
|
||||
switch (statReportFormat)
|
||||
{
|
||||
case StatReportFormat.None:
|
||||
return new Textfile(Console.OpenStandardOutput(), baddumpCol, nodumpCol);
|
||||
|
||||
case StatReportFormat.Textfile:
|
||||
return new Textfile(filename, baddumpCol, nodumpCol);
|
||||
|
||||
case StatReportFormat.CSV:
|
||||
return new SeparatedValue(filename, ',', baddumpCol, nodumpCol);
|
||||
|
||||
case StatReportFormat.HTML:
|
||||
return new Html(filename, baddumpCol, nodumpCol);
|
||||
|
||||
case StatReportFormat.SSV:
|
||||
return new SeparatedValue(filename, ';', baddumpCol, nodumpCol);
|
||||
|
||||
case StatReportFormat.TSV:
|
||||
return new SeparatedValue(filename, '\t', baddumpCol, nodumpCol);
|
||||
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
#else
|
||||
return statReportFormat switch
|
||||
{
|
||||
StatReportFormat.None => new Textfile(Console.OpenStandardOutput(), baddumpCol, nodumpCol),
|
||||
@@ -97,7 +72,6 @@ namespace SabreTools.Reports
|
||||
StatReportFormat.TSV => new SeparatedValue(filename, '\t', baddumpCol, nodumpCol),
|
||||
_ => null,
|
||||
};
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -47,9 +47,6 @@ namespace SabreTools.Reports.Formats
|
||||
+ $"<td align=\"right\">{_stats.DiskCount}</td>"
|
||||
+ $"<td align=\"right\">{_stats.CRCCount}</td>"
|
||||
+ $"<td align=\"right\">{_stats.MD5Count}</td>"
|
||||
#if NET_FRAMEWORK
|
||||
+ $"<td align=\"right\">{_stats.RIPEMD160Count}</td>"
|
||||
#endif
|
||||
+ $"<td align=\"right\">{_stats.SHA1Count}</td>"
|
||||
+ $"<td align=\"right\">{_stats.SHA256Count}</td>"
|
||||
+ (_baddumpCol ? $"<td align=\"right\">{_stats.BaddumpCount}</td>" : string.Empty)
|
||||
|
||||
@@ -47,9 +47,6 @@ namespace SabreTools.Reports.Formats
|
||||
+ "\"" + _stats.DiskCount + "\"{0}"
|
||||
+ "\"" + _stats.CRCCount + "\"{0}"
|
||||
+ "\"" + _stats.MD5Count + "\"{0}"
|
||||
#if NET_FRAMEWORK
|
||||
+ "\"" + _stats.RIPEMD160Count + "\"{0}"
|
||||
#endif
|
||||
+ "\"" + _stats.SHA1Count + "\"{0}"
|
||||
+ "\"" + _stats.SHA256Count + "\"{0}"
|
||||
+ "\"" + _stats.SHA384Count + "\"{0}"
|
||||
|
||||
@@ -41,12 +41,7 @@ namespace SabreTools.Reports.Formats
|
||||
Roms found: " + _stats.RomCount + @"
|
||||
Disks found: " + _stats.DiskCount + @"
|
||||
Roms with CRC: " + _stats.CRCCount + @"
|
||||
Roms with MD5: " + _stats.MD5Count
|
||||
#if NET_FRAMEWORK
|
||||
+ @"
|
||||
Roms with RIPEMD160: " + _stats.RIPEMD160Count
|
||||
#endif
|
||||
+ @"
|
||||
Roms with MD5: " + _stats.MD5Count + @"
|
||||
Roms with SHA-1: " + _stats.SHA1Count + @"
|
||||
Roms with SHA-256: " + _stats.SHA256Count + @"
|
||||
Roms with SHA-384: " + _stats.SHA384Count + @"
|
||||
|
||||
@@ -1,16 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net48;netcoreapp3.1;net5.0</TargetFrameworks>
|
||||
<TargetFrameworks>netcoreapp3.1;net5.0</TargetFrameworks>
|
||||
<RuntimeIdentifiers>win10-x64;win7-x86</RuntimeIdentifiers>
|
||||
<Configurations>Debug;Release</Configurations>
|
||||
<Platforms>AnyCPU;x64</Platforms>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(TargetFramework)'=='net48'">
|
||||
<DefineConstants>NET_FRAMEWORK</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SabreTools.Core\SabreTools.Core.csproj" />
|
||||
<ProjectReference Include="..\SabreTools.DatFiles\SabreTools.DatFiles.csproj" />
|
||||
|
||||
@@ -1,16 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net48;netcoreapp3.1;net5.0</TargetFrameworks>
|
||||
<TargetFrameworks>netcoreapp3.1;net5.0</TargetFrameworks>
|
||||
<RuntimeIdentifiers>win10-x64;win7-x86</RuntimeIdentifiers>
|
||||
<Configurations>Debug;Release</Configurations>
|
||||
<Platforms>AnyCPU;x64</Platforms>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(TargetFramework)'=='net48'">
|
||||
<DefineConstants>NET_FRAMEWORK</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SabreTools.Logging\SabreTools.Logging.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -336,21 +336,6 @@ namespace SabreTools.Skippers
|
||||
if (xtr.GetAttribute("operator") != null)
|
||||
{
|
||||
string oper = xtr.GetAttribute("operator");
|
||||
#if NET_FRAMEWORK
|
||||
switch (oper.ToLowerInvariant())
|
||||
{
|
||||
case "less":
|
||||
test.Operator = HeaderSkipTestFileOperator.Less;
|
||||
break;
|
||||
case "greater":
|
||||
test.Operator = HeaderSkipTestFileOperator.Greater;
|
||||
break;
|
||||
case "equal":
|
||||
default:
|
||||
test.Operator = HeaderSkipTestFileOperator.Equal;
|
||||
break;
|
||||
}
|
||||
#else
|
||||
test.Operator = oper.ToLowerInvariant() switch
|
||||
{
|
||||
"less" => HeaderSkipTestFileOperator.Less,
|
||||
@@ -358,7 +343,6 @@ namespace SabreTools.Skippers
|
||||
"equal" => HeaderSkipTestFileOperator.Equal,
|
||||
_ => HeaderSkipTestFileOperator.Equal,
|
||||
};
|
||||
#endif
|
||||
}
|
||||
|
||||
return test;
|
||||
|
||||
@@ -55,23 +55,6 @@ namespace SabreTools.Skippers
|
||||
/// <remarks>The Stream is assumed to be in the proper position for a given test</remarks>
|
||||
public bool Passes(Stream input)
|
||||
{
|
||||
#if NET_FRAMEWORK
|
||||
switch (Type)
|
||||
{
|
||||
case HeaderSkipTest.And:
|
||||
return CheckAnd(input);
|
||||
case HeaderSkipTest.Data:
|
||||
return CheckData(input);
|
||||
case HeaderSkipTest.File:
|
||||
return CheckFile(input);
|
||||
case HeaderSkipTest.Or:
|
||||
return CheckOr(input);
|
||||
case HeaderSkipTest.Xor:
|
||||
return CheckXor(input);
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
return Type switch
|
||||
{
|
||||
HeaderSkipTest.And => CheckAnd(input),
|
||||
@@ -81,7 +64,6 @@ namespace SabreTools.Skippers
|
||||
HeaderSkipTest.Xor => CheckXor(input),
|
||||
_ => true,
|
||||
};
|
||||
#endif
|
||||
}
|
||||
|
||||
#region Checking Helpers
|
||||
|
||||
@@ -980,22 +980,6 @@ namespace SabreTools.Features
|
||||
}
|
||||
}
|
||||
|
||||
#if NET_FRAMEWORK
|
||||
internal const string SkipRipeMd160Value = "skip-ripemd160";
|
||||
internal static Feature SkipRipeMd160Flag
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Feature(
|
||||
SkipRipeMd160Value,
|
||||
new List<string>() { "-nr160", "--skip-ripemd160" },
|
||||
"Include RIPEMD160 in output", // TODO: This needs to be inverted later
|
||||
ParameterType.Flag,
|
||||
longDescription: "This allows the user to include calculating the RIPEMD160 for each of the files.");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
internal const string SkipSha1Value = "skip-sha1";
|
||||
internal static Feature SkipSha1Flag
|
||||
{
|
||||
@@ -1668,22 +1652,6 @@ Possible values are: None, Bios, Device, Mechanical");
|
||||
}
|
||||
}
|
||||
|
||||
#if NET_FRAMEWORK
|
||||
internal const string NotRipeMd160ListValue = "not-ripemd160";
|
||||
internal static Feature NotRipeMd160ListInput
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Feature(
|
||||
NotRipeMd160ListValue,
|
||||
new List<string>() { "-nripemd160", "--not-ripemd160" },
|
||||
"Filter by not RIPEMD160 hash",
|
||||
ParameterType.List,
|
||||
longDescription: "Include only items without this RIPEMD160 hash in the output. Additionally, the user can specify an exact match or full C#-style regex for pattern matching. Multiple instances of this flag are allowed.");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
internal const string NotSha1ListValue = "not-sha1";
|
||||
internal static Feature NotSha1ListInput
|
||||
{
|
||||
@@ -1779,12 +1747,7 @@ Possible values are:
|
||||
md5 - MD5
|
||||
msx, openmsx - openMSX Software List
|
||||
ol, offlinelist - OfflineList XML
|
||||
rc, romcenter - RomCenter"
|
||||
#if NET_FRAMEWORK
|
||||
+ @"
|
||||
ripemd160 - RIPEMD160"
|
||||
#endif
|
||||
+ @"
|
||||
rc, romcenter - RomCenter
|
||||
sj, sabrejson - SabreJSON
|
||||
sx, sabrexml - SabreDAT XML
|
||||
sfv - SFV
|
||||
@@ -1837,22 +1800,6 @@ Possible values are:
|
||||
}
|
||||
}
|
||||
|
||||
#if NET_FRAMEWORK
|
||||
internal const string RipeMd160ListValue = "ripemd160";
|
||||
internal static Feature RipeMd160ListInput
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Feature(
|
||||
RipeMd160ListValue,
|
||||
new List<string>() { "-ripemd160", "--ripemd160" },
|
||||
"Filter by RIPEMD160 hash",
|
||||
ParameterType.List,
|
||||
longDescription: "Include only items with this RIPEMD160 hash in the output. Additionally, the user can specify an exact match or full C#-style regex for pattern matching. Multiple instances of this flag are allowed.");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
internal const string Sha1ListValue = "sha1";
|
||||
internal static Feature Sha1ListInput
|
||||
{
|
||||
@@ -2217,12 +2164,7 @@ Some special strings that can be used:
|
||||
- %publisher% - Replaced with game Publisher
|
||||
- %category% - Replaced with game Category
|
||||
- %crc% - Replaced with the CRC
|
||||
- %md5% - Replaced with the MD5"
|
||||
#if NET_FRAMEWORK
|
||||
+ @"
|
||||
- %ripemd160% - Replaced with the RIPEMD160"
|
||||
#endif
|
||||
+ @"
|
||||
- %md5% - Replaced with the MD5
|
||||
- %sha1% - Replaced with the SHA-1
|
||||
- %sha256% - Replaced with the SHA-256
|
||||
- %sha384% - Replaced with the SHA-384
|
||||
@@ -2383,10 +2325,6 @@ Some special strings that can be used:
|
||||
AddFeature(NotCrcListInput);
|
||||
AddFeature(Md5ListInput);
|
||||
AddFeature(NotMd5ListInput);
|
||||
#if NET_FRAMEWORK
|
||||
AddFeature(RipeMd160ListInput);
|
||||
AddFeature(NotRipeMd160ListInput);
|
||||
#endif
|
||||
AddFeature(Sha1ListInput);
|
||||
AddFeature(NotSha1ListInput);
|
||||
AddFeature(Sha256ListInput);
|
||||
@@ -2473,10 +2411,6 @@ Some special strings that can be used:
|
||||
|
||||
if (GetBoolean(features, SkipMd5Value))
|
||||
includeInScan &= ~Hash.MD5;
|
||||
#if NET_FRAMEWORK
|
||||
if (GetBoolean(features, SkipRipeMd160Value))
|
||||
includeInScan |= Hash.RIPEMD160; // TODO: This needs to be inverted later
|
||||
#endif
|
||||
if (GetBoolean(features, SkipSha1Value))
|
||||
includeInScan &= ~Hash.SHA1;
|
||||
if (GetBoolean(features, SkipSha256Value))
|
||||
@@ -2617,9 +2551,6 @@ Some special strings that can be used:
|
||||
logger.User($"This flag '{(UpdateHashesValue)}' is deprecated, please use {(string.Join(", ", UpdateFieldListInput.Flags))} instead. Please refer to README.1ST or the help feature for more details.");
|
||||
updateFields.Add(DatItemField.CRC);
|
||||
updateFields.Add(DatItemField.MD5);
|
||||
#if NET_FRAMEWORK
|
||||
updateFields.Add(DatItemField.RIPEMD160);
|
||||
#endif
|
||||
updateFields.Add(DatItemField.SHA1);
|
||||
updateFields.Add(DatItemField.SHA256);
|
||||
updateFields.Add(DatItemField.SHA384);
|
||||
@@ -2882,20 +2813,6 @@ Some special strings that can be used:
|
||||
cleaner.DatItemFilter.SetFilter(DatItemField.MD5, GetList(features, Md5ListValue), false);
|
||||
}
|
||||
|
||||
#if NET_FRAMEWORK
|
||||
// RIPEMD160
|
||||
if (features.ContainsKey(NotRipeMd160ListValue))
|
||||
{
|
||||
logger.User($"This flag '{NotRipeMd160ListValue}' is deprecated, please use {string.Join(", ", FilterListInput.Flags)} instead. Please refer to README.1ST or the help feature for more details.");
|
||||
cleaner.DatItemFilter.SetFilter(DatItemField.RIPEMD160, GetList(features, NotRipeMd160ListValue), true);
|
||||
}
|
||||
if (features.ContainsKey(RipeMd160ListValue))
|
||||
{
|
||||
logger.User($"This flag '{RipeMd160ListValue}' is deprecated, please use {string.Join(", ", FilterListInput.Flags)} instead. Please refer to README.1ST or the help feature for more details.");
|
||||
cleaner.DatItemFilter.SetFilter(DatItemField.RIPEMD160, GetList(features, RipeMd160ListValue), false);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Runnable
|
||||
if (features.ContainsKey(NotRunnableValue))
|
||||
{
|
||||
@@ -3138,10 +3055,6 @@ CREATE TABLE IF NOT EXISTS data (
|
||||
case "rc":
|
||||
case "romcenter":
|
||||
return DatFormat.RomCenter;
|
||||
#if NET_FRAMEWORK
|
||||
case "ripemd160":
|
||||
return DatFormat.RedumpRIPEMD160;
|
||||
#endif
|
||||
case "sd":
|
||||
case "sabredat":
|
||||
case "sx":
|
||||
@@ -3185,25 +3098,6 @@ CREATE TABLE IF NOT EXISTS data (
|
||||
/// <returns>StatReportFormat value corresponding to the string</returns>
|
||||
private static StatReportFormat GetStatReportFormat(string input)
|
||||
{
|
||||
#if NET_FRAMEWORK
|
||||
switch (input?.Trim().ToLowerInvariant())
|
||||
{
|
||||
case "all":
|
||||
return StatReportFormat.All;
|
||||
case "csv":
|
||||
return StatReportFormat.CSV;
|
||||
case "html":
|
||||
return StatReportFormat.HTML;
|
||||
case "ssv":
|
||||
return StatReportFormat.SSV;
|
||||
case "text":
|
||||
return StatReportFormat.Textfile;
|
||||
case "tsv":
|
||||
return StatReportFormat.TSV;
|
||||
default:
|
||||
return 0x0;
|
||||
}
|
||||
#else
|
||||
return input?.Trim().ToLowerInvariant() switch
|
||||
{
|
||||
"all" => StatReportFormat.All,
|
||||
@@ -3214,7 +3108,6 @@ CREATE TABLE IF NOT EXISTS data (
|
||||
"tsv" => StatReportFormat.TSV,
|
||||
_ => 0x0,
|
||||
};
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -175,7 +175,9 @@ Reset the internal state: reset();";
|
||||
}
|
||||
|
||||
// Read in the individual arguments
|
||||
Field filterField = command.Arguments[0].AsField();
|
||||
DatHeaderField filterDatHeaderField = command.Arguments[0].AsDatHeaderField();
|
||||
MachineField filterMachineField = command.Arguments[0].AsMachineField();
|
||||
DatItemField filterDatItemField = command.Arguments[0].AsDatItemField();
|
||||
string filterValue = command.Arguments[1];
|
||||
bool? filterRemove = false;
|
||||
if (command.Arguments.Count >= 3)
|
||||
@@ -185,7 +187,9 @@ Reset the internal state: reset();";
|
||||
filterPerMachine = command.Arguments[3].AsYesNo();
|
||||
|
||||
// If we had an invalid input, log and continue
|
||||
if (filterField == Field.NULL)
|
||||
if (filterDatHeaderField == DatHeaderField.NULL
|
||||
&& filterMachineField == MachineField.NULL
|
||||
&& filterDatItemField == DatItemField.NULL)
|
||||
{
|
||||
logger.User($"{command.Arguments[0]} was an invalid field name");
|
||||
continue;
|
||||
@@ -210,9 +214,9 @@ Reset the internal state: reset();";
|
||||
};
|
||||
|
||||
// Set the possible filters
|
||||
cleaner.DatHeaderFilter.SetFilter(command.Arguments[0].AsDatHeaderField(), filterValue, filterRemove.Value);
|
||||
cleaner.MachineFilter.SetFilter(command.Arguments[0].AsMachineField(), filterValue, filterRemove.Value);
|
||||
cleaner.DatItemFilter.SetFilter(command.Arguments[0].AsDatItemField(), filterValue, filterRemove.Value);
|
||||
cleaner.DatHeaderFilter.SetFilter(filterDatHeaderField, filterValue, filterRemove.Value);
|
||||
cleaner.MachineFilter.SetFilter(filterMachineField, filterValue, filterRemove.Value);
|
||||
cleaner.DatItemFilter.SetFilter(filterDatItemField, filterValue, filterRemove.Value);
|
||||
|
||||
// Apply the filters blindly
|
||||
Modification.ApplyFilters(datFile, cleaner, filterPerMachine.Value);
|
||||
@@ -234,11 +238,13 @@ Reset the internal state: reset();";
|
||||
}
|
||||
|
||||
// Read in the individual arguments
|
||||
Field extraField = command.Arguments[0].AsField();
|
||||
MachineField extraMachineField = command.Arguments[0].AsMachineField();
|
||||
DatItemField extraDatItemField = command.Arguments[0].AsDatItemField();
|
||||
string extraFile = command.Arguments[1];
|
||||
|
||||
// If we had an invalid input, log and continue
|
||||
if (extraField == Field.NULL)
|
||||
if (extraMachineField == MachineField.NULL
|
||||
&& extraDatItemField == DatItemField.NULL)
|
||||
{
|
||||
logger.User($"{command.Arguments[0]} was an invalid field name");
|
||||
continue;
|
||||
@@ -253,8 +259,8 @@ Reset the internal state: reset();";
|
||||
ExtraIni extraIni = new ExtraIni();
|
||||
ExtraIniItem extraIniItem = new ExtraIniItem();
|
||||
extraIniItem.PopulateFromFile(extraFile);
|
||||
extraIniItem.MachineField = command.Arguments[0].AsMachineField();
|
||||
extraIniItem.DatItemField = command.Arguments[0].AsDatItemField();
|
||||
extraIniItem.MachineField = extraMachineField;
|
||||
extraIniItem.DatItemField = extraDatItemField;
|
||||
extraIni.Items.Add(extraIniItem);
|
||||
|
||||
// Apply the extra INI blindly
|
||||
|
||||
@@ -25,9 +25,6 @@ namespace SabreTools.Features
|
||||
|
||||
// Hash Features
|
||||
AddFeature(SkipMd5Flag);
|
||||
#if NET_FRAMEWORK
|
||||
AddFeature(SkipRipeMd160Flag);
|
||||
#endif
|
||||
AddFeature(SkipSha1Flag);
|
||||
AddFeature(SkipSha256Flag);
|
||||
AddFeature(SkipSha384Flag);
|
||||
|
||||
@@ -83,18 +83,10 @@ The following systems have headers that this program can work with:
|
||||
try
|
||||
{
|
||||
// Extract the header as a string for the database
|
||||
#if NET_FRAMEWORK
|
||||
using (var fs = File.OpenRead(file))
|
||||
{
|
||||
#else
|
||||
using var fs = File.OpenRead(file);
|
||||
#endif
|
||||
byte[] hbin = new byte[(int)rule.StartOffset];
|
||||
fs.Read(hbin, 0, (int)rule.StartOffset);
|
||||
hstr = Utilities.ByteArrayToString(hbin);
|
||||
#if NET_FRAMEWORK
|
||||
}
|
||||
#endif
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
@@ -137,18 +137,10 @@ The following systems have headers that this program can work with:
|
||||
if (!File.Exists(input))
|
||||
return;
|
||||
|
||||
#if NET_FRAMEWORK
|
||||
using (FileStream fsr = File.OpenRead(input))
|
||||
using (FileStream fsw = File.OpenWrite(output))
|
||||
{
|
||||
#else
|
||||
using FileStream fsr = File.OpenRead(input);
|
||||
using FileStream fsw = File.OpenWrite(output);
|
||||
#endif
|
||||
|
||||
AppendBytes(fsr, fsw, bytesToAddToHead, bytesToAddToTail);
|
||||
#if NET_FRAMEWORK
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -2,16 +2,12 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFrameworks>net48;netcoreapp3.1;net5.0</TargetFrameworks>
|
||||
<TargetFrameworks>netcoreapp3.1;net5.0</TargetFrameworks>
|
||||
<RuntimeIdentifiers>win10-x64;win7-x86</RuntimeIdentifiers>
|
||||
<Configurations>Debug;Release</Configurations>
|
||||
<Platforms>AnyCPU;x64</Platforms>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(TargetFramework)'=='net48'">
|
||||
<DefineConstants>NET_FRAMEWORK</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Data.Sqlite" Version="5.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user