diff --git a/SabreTools.Helper/Data/Structs.cs b/SabreTools.Helper/Data/Structs.cs
index ad9947d0..d88fd08e 100644
--- a/SabreTools.Helper/Data/Structs.cs
+++ b/SabreTools.Helper/Data/Structs.cs
@@ -3,22 +3,136 @@ using System.Collections.Generic;
namespace SabreTools.Helper
{
+ #region Hash-to-Dat structs [Currently Unused]
+
+ /* Thought experiment
+
+ So, here's a connundrum: Should the internal structure of how DATs work (down to the hash level) mirror
+ how people see it (Dat to multiple games, game to multiple roms, rom to single hash) or
+ should it more closely mirror real life (Hash to multiple roms, rom to multiple games, game to single DAT)
+
+ If I use the "how people see it":
+ Things are pretty much how they are now with redundant data and the like
+ It makes sense to write things out to file, though. And life is easier when output is easier.
+ No code changes (big plus!)
+
+ If I use the "how it is":
+ Less data is likely to be mirrored
+ Refs to DAT files are possible so that there aren't duplicates
+ A lot of code will have to change...
+ */
+
+ ///
+ /// Intermediate struct for holding and processing Hash data (NEW SYSTEM)
+ ///
+ public struct HashData
+ {
+ public long Size;
+ public string CRC;
+ public string MD5;
+ public string SHA1;
+ public List Roms;
+ }
+
+ ///
+ /// Intermediate struct for holding and processing Rom data (NEW SYSTEM)
+ ///
+ public struct RomData
+ {
+ public string Name;
+ public ItemType Type;
+ public bool Nodump;
+ public string Date;
+ public List Machines;
+ }
+
+ ///
+ /// Intermediate struct for holding and processing Game/Machine data (NEW SYSTEM)
+ ///
+ public struct MachineData
+ {
+ public string Name;
+ public string Comment;
+ public string Description;
+ public string Year;
+ public string Manufacturer;
+ public string RomOf;
+ public string CloneOf;
+ public string SampleOf;
+ public string SourceFile;
+ public bool IsBios;
+ public string Board;
+ public string RebuildTo;
+ public bool TorrentZipped;
+ }
+
+ ///
+ /// Intermediate struct for holding and processing DAT data (NEW SYSTEM)
+ ///
+ public struct DatData
+ {
+ // Data common to most DAT types
+ public string FileName;
+ public string Name;
+ public string Description;
+ public string RootDir;
+ public string Category;
+ public string Version;
+ public string Date;
+ public string Author;
+ public string Email;
+ public string Homepage;
+ public string Url;
+ public string Comment;
+ public string Header;
+ public string Type; // Generally only used for SuperDAT
+ public ForceMerging ForceMerging;
+ public ForceNodump ForceNodump;
+ public ForcePacking ForcePacking;
+ public OutputFormat OutputFormat;
+ public bool MergeRoms;
+
+ // Data specific to the Miss DAT type
+ public bool UseGame;
+ public string Prefix;
+ public string Postfix;
+ public bool Quotes;
+ public string RepExt;
+ public string AddExt;
+ public bool GameName;
+ public bool Romba;
+ public bool? XSV; // true for tab-deliminated output, false for comma-deliminated output
+
+ // Statistical data related to the DAT
+ public long RomCount;
+ public long DiskCount;
+ public long TotalSize;
+ public long CRCCount;
+ public long MD5Count;
+ public long SHA1Count;
+ public long NodumpCount;
+ }
+
+ #endregion
+
+ #region Dat-to-Hash structs
+
///
/// Intermediate struct for holding and processing hash data
///
- public struct HashData : IEquatable
+ public struct Hash : IEquatable
{
public long Size;
public string CRC;
public string MD5;
public string SHA1;
- public bool Equals(HashData other)
+ public bool Equals(Hash other)
{
return this.Equals(other, false);
}
- public bool Equals(HashData other, bool IsDisk)
+ public bool Equals(Hash other, bool IsDisk)
{
bool equals = false;
@@ -49,7 +163,7 @@ namespace SabreTools.Helper
public Machine Machine;
public string Name;
public ItemType Type;
- public HashData HashData;
+ public Hash HashData;
public DupeType Dupe;
public bool Nodump;
public string Date;
@@ -57,9 +171,6 @@ namespace SabreTools.Helper
public int CompareTo(object obj)
{
- Logger temp = new Logger(false, "");
- temp.Start();
-
int ret = 0;
try
@@ -70,7 +181,7 @@ namespace SabreTools.Helper
{
if (this.Name == comp.Name)
{
- ret = (RomTools.IsDuplicate(this, comp, temp) ? 0 : 1);
+ ret = (this.Equals(comp) ? 0 : 1);
}
ret = String.Compare(this.Name, comp.Name);
}
@@ -81,7 +192,6 @@ namespace SabreTools.Helper
ret = 1;
}
- temp.Close();
return ret;
}
@@ -278,6 +388,10 @@ namespace SabreTools.Helper
}
}
+ #endregion
+
+ #region Skipper structs
+
///
/// Intermediate struct for holding header skipper information
///
@@ -313,4 +427,6 @@ namespace SabreTools.Helper
public long? Size; // null is PO2, "power of 2" filesize
public HeaderSkipTestFileOperator Operator;
}
+
+ #endregion
}
diff --git a/SabreTools.Helper/Tools/ArchiveTools.cs b/SabreTools.Helper/Tools/ArchiveTools.cs
index 180b7035..6157e81c 100644
--- a/SabreTools.Helper/Tools/ArchiveTools.cs
+++ b/SabreTools.Helper/Tools/ArchiveTools.cs
@@ -542,7 +542,7 @@ namespace SabreTools.Helper
{
Name = gamename,
},
- HashData = new HashData
+ HashData = new Hash
{
Size = (size == 0 ? reader.Entry.Size : size),
CRC = (crc == "" ? reader.Entry.Crc.ToString("X").ToLowerInvariant() : crc),
@@ -626,7 +626,7 @@ namespace SabreTools.Helper
Name = Path.GetFileNameWithoutExtension(input).ToLowerInvariant(),
},
Name = Path.GetFileNameWithoutExtension(input).ToLowerInvariant(),
- HashData = new HashData
+ HashData = new Hash
{
Size = extractedsize,
CRC = gzcrc.ToLowerInvariant(),
diff --git a/SabreTools.Helper/Tools/DatTools.cs b/SabreTools.Helper/Tools/DatTools.cs
index 8cb9ff26..ec27c174 100644
--- a/SabreTools.Helper/Tools/DatTools.cs
+++ b/SabreTools.Helper/Tools/DatTools.cs
@@ -574,7 +574,7 @@ namespace SabreTools.Helper
Description = rominfo[4],
},
Name = rominfo[5],
- HashData = new HashData
+ HashData = new Hash
{
CRC = rominfo[6].ToLowerInvariant(),
Size = Int64.Parse(rominfo[7]),
@@ -686,7 +686,7 @@ namespace SabreTools.Helper
Name = tempgame,
Description = tempgame,
},
- HashData = new HashData
+ HashData = new Hash
{
Size = -1,
CRC = "null",
@@ -1136,7 +1136,7 @@ namespace SabreTools.Helper
},
Name = subreader.GetAttribute("name"),
Type = (subreader.Name.ToLowerInvariant() == "disk" ? ItemType.Disk : ItemType.Rom),
- HashData = new HashData
+ HashData = new Hash
{
Size = size,
CRC = crc,
@@ -1195,7 +1195,7 @@ namespace SabreTools.Helper
Name = tempname,
Description = tempname,
},
- HashData = new HashData
+ HashData = new Hash
{
Size = -1,
CRC = "null",
@@ -1375,7 +1375,7 @@ namespace SabreTools.Helper
},
Name = xtr.GetAttribute("name"),
Type = (xtr.GetAttribute("type").ToLowerInvariant() == "disk" ? ItemType.Disk : ItemType.Rom),
- HashData = new HashData
+ HashData = new Hash
{
Size = size,
CRC = crc,
diff --git a/SabreTools.Helper/Tools/RomTools.cs b/SabreTools.Helper/Tools/RomTools.cs
index 3b37ae5c..6cf5e885 100644
--- a/SabreTools.Helper/Tools/RomTools.cs
+++ b/SabreTools.Helper/Tools/RomTools.cs
@@ -30,7 +30,7 @@ namespace SabreTools.Helper
{
Name = Path.GetFileName(input),
Type = ItemType.Rom,
- HashData = new HashData
+ HashData = new Hash
{
Size = (new FileInfo(input)).Length,
CRC = string.Empty,
diff --git a/SabreTools/DATFromDir.cs b/SabreTools/DATFromDir.cs
index 9feafab8..e2ee39c0 100644
--- a/SabreTools/DATFromDir.cs
+++ b/SabreTools/DATFromDir.cs
@@ -181,7 +181,7 @@ namespace SabreTools
"") + actualroot :
actualroot),
},
- HashData = new HashData
+ HashData = new Hash
{
Size = -1,
CRC = "null",
@@ -220,7 +220,7 @@ namespace SabreTools
"") + actualroot :
actualroot),
},
- HashData = new HashData
+ HashData = new Hash
{
Size = -1,
CRC = "null",