diff --git a/SabreTools.Helper/Dats/Archive.cs b/SabreTools.Helper/Dats/Archive.cs
index 04a16fc6..82961a05 100644
--- a/SabreTools.Helper/Dats/Archive.cs
+++ b/SabreTools.Helper/Dats/Archive.cs
@@ -1,8 +1,9 @@
-using SabreTools.Helper.Data;
+using System;
+using SabreTools.Helper.Data;
namespace SabreTools.Helper.Dats
{
- public class Archive : DatItem
+ public class Archive : DatItem, ICloneable
{
#region Constructors
@@ -17,6 +18,36 @@ namespace SabreTools.Helper.Dats
#endregion
+ #region Cloning Methods
+
+ public object Clone()
+ {
+ return new Archive()
+ {
+ Name = this.Name,
+ Type = this.Type,
+ Dupe = this.Dupe,
+
+ Machine = this.Machine,
+
+ Supported = this.Supported,
+ Publisher = this.Publisher,
+ Infos = this.Infos,
+ PartName = this.PartName,
+ PartInterface = this.PartInterface,
+ Features = this.Features,
+ AreaName = this.AreaName,
+ AreaSize = this.AreaSize,
+
+ SystemID = this.SystemID,
+ System = this.System,
+ SourceID = this.SourceID,
+ Source = this.Source,
+ };
+ }
+
+ #endregion
+
#region Comparision Methods
public override bool Equals(DatItem other)
diff --git a/SabreTools.Helper/Dats/BiosSet.cs b/SabreTools.Helper/Dats/BiosSet.cs
index b5c9c31d..26f5c6bd 100644
--- a/SabreTools.Helper/Dats/BiosSet.cs
+++ b/SabreTools.Helper/Dats/BiosSet.cs
@@ -1,8 +1,9 @@
-using SabreTools.Helper.Data;
+using System;
+using SabreTools.Helper.Data;
namespace SabreTools.Helper.Dats
{
- public class BiosSet : DatItem
+ public class BiosSet : DatItem, ICloneable
{
#region Private instance variables
@@ -39,6 +40,39 @@ namespace SabreTools.Helper.Dats
#endregion
+ #region Cloning Methods
+
+ public object Clone()
+ {
+ return new BiosSet()
+ {
+ Name = this.Name,
+ Type = this.Type,
+ Dupe = this.Dupe,
+
+ Machine = this.Machine,
+
+ Supported = this.Supported,
+ Publisher = this.Publisher,
+ Infos = this.Infos,
+ PartName = this.PartName,
+ PartInterface = this.PartInterface,
+ Features = this.Features,
+ AreaName = this.AreaName,
+ AreaSize = this.AreaSize,
+
+ SystemID = this.SystemID,
+ System = this.System,
+ SourceID = this.SourceID,
+ Source = this.Source,
+
+ Description = this.Description,
+ Default = this.Default,
+ };
+ }
+
+ #endregion
+
#region Comparision Methods
public override bool Equals(DatItem other)
diff --git a/SabreTools.Helper/Dats/Disk.cs b/SabreTools.Helper/Dats/Disk.cs
index bfa7bb27..1f31f5ab 100644
--- a/SabreTools.Helper/Dats/Disk.cs
+++ b/SabreTools.Helper/Dats/Disk.cs
@@ -4,7 +4,7 @@ using SabreTools.Helper.Data;
namespace SabreTools.Helper.Dats
{
- public class Disk : DatItem
+ public class Disk : DatItem, ICloneable
{
#region Private instance variables
@@ -52,6 +52,40 @@ namespace SabreTools.Helper.Dats
#endregion
+ #region Cloning Methods
+
+ public object Clone()
+ {
+ return new Disk()
+ {
+ Name = this.Name,
+ Type = this.Type,
+ Dupe = this.Dupe,
+
+ Machine = this.Machine,
+
+ Supported = this.Supported,
+ Publisher = this.Publisher,
+ Infos = this.Infos,
+ PartName = this.PartName,
+ PartInterface = this.PartInterface,
+ Features = this.Features,
+ AreaName = this.AreaName,
+ AreaSize = this.AreaSize,
+
+ SystemID = this.SystemID,
+ System = this.System,
+ SourceID = this.SourceID,
+ Source = this.Source,
+
+ MD5 = this.MD5,
+ SHA1 = this.SHA1,
+ ItemStatus = this.ItemStatus,
+ };
+ }
+
+ #endregion
+
#region Comparision Methods
public override bool Equals(DatItem other)
diff --git a/SabreTools.Helper/Dats/Partials/DatFile.Bucketing.cs b/SabreTools.Helper/Dats/Partials/DatFile.Bucketing.cs
index 9ff80225..1a8d98e7 100644
--- a/SabreTools.Helper/Dats/Partials/DatFile.Bucketing.cs
+++ b/SabreTools.Helper/Dats/Partials/DatFile.Bucketing.cs
@@ -378,50 +378,42 @@ namespace SabreTools.Helper.Dats
/// True if the number of hashes counted is to be output (default), false otherwise
public void CreateFullyMergedSets(bool mergeroms, Logger logger, bool output = true)
{
+ // First, we try to add all device items first
+ /*
+ Here, we require that device_ref tags got read first, and then we can add them accordingly.
+ As of right now, those tags are NOT being read into the machine. We'd have to do this in
+ order to get this working correctly. At least this is a good placeholder for now.
+ */
+
// For sake of ease, the first thing we want to do is sort by game
- BucketByGame(mergeroms, false, logger, output);
+ BucketByGame(mergeroms, true, logger, output);
+ _sortedBy = SortedBy.Default;
// Now we want to loop through all of the games and set the correct information
List games = Keys.ToList();
foreach (string game in games)
{
- // First, we try to add all device items first
- /*
- Here, we require that device_ref tags got read first, and then we can add them accordingly.
- As of right now, those tags are NOT being read into the machine. We'd have to do this in
- order to get this working correctly. At least this is a good placeholder for now.
- */
-
// Determine if the game has a parent or not
string parent = null;
- if (this[game][0].Machine.CloneOf != null)
+ if (!String.IsNullOrEmpty(this[game][0].Machine.CloneOf))
{
parent = this[game][0].Machine.CloneOf;
}
- else if (this[game][0].Machine.RomOf != null)
- {
- parent = this[game][0].Machine.RomOf;
- }
// If there is no parent, then we continue
- if (parent == null)
- {
- continue;
- }
-
- // If the parent doesn't exist, then we continue
- if (this[parent].Count == 0)
+ if (String.IsNullOrEmpty(parent))
{
continue;
}
// Otherwise, move the items from the current game to a subfolder of the parent game
- Machine parentMachine = this[parent][0].Machine;
+ Machine parentMachine = this[parent].Count == 0 ? new Machine { Name = parent, Description = parent } : this[parent][0].Machine;
List items = this[game];
foreach (DatItem item in items)
{
item.Name = item.Machine.Name + "\\" + item.Name;
item.Machine = parentMachine;
+ this[parent].Add(item);
}
// Finally, remove the old game so it's not picked up by the writer
@@ -438,7 +430,8 @@ namespace SabreTools.Helper.Dats
public void CreateMergedSets(bool mergeroms, Logger logger, bool output = true)
{
// For sake of ease, the first thing we want to do is sort by game
- BucketByGame(mergeroms, false, logger, output);
+ BucketByGame(mergeroms, true, logger, output);
+ _sortedBy = SortedBy.Default;
// Now we want to loop through all of the games and set the correct information
List games = Keys.ToList();
@@ -446,34 +439,25 @@ namespace SabreTools.Helper.Dats
{
// Determine if the game has a parent or not
string parent = null;
- if (this[game][0].Machine.CloneOf != null)
+ if (!String.IsNullOrEmpty(this[game][0].Machine.CloneOf))
{
parent = this[game][0].Machine.CloneOf;
}
- else if (this[game][0].Machine.RomOf != null)
- {
- parent = this[game][0].Machine.RomOf;
- }
// If there is no parent, then we continue
- if (parent == null)
- {
- continue;
- }
-
- // If the parent doesn't exist, then we continue
- if (this[parent].Count == 0)
+ if (String.IsNullOrEmpty(parent))
{
continue;
}
// Otherwise, move the items from the current game to a subfolder of the parent game
- Machine parentMachine = this[parent][0].Machine;
+ Machine parentMachine = this[parent].Count == 0 ? new Machine { Name = parent, Description = parent } : this[parent][0].Machine;
List items = this[game];
foreach (DatItem item in items)
{
item.Name = item.Machine.Name + "\\" + item.Name;
item.Machine = parentMachine;
+ this[parent].Add(item);
}
// Finally, remove the old game so it's not picked up by the writer
@@ -482,15 +466,16 @@ namespace SabreTools.Helper.Dats
}
///
- /// Use cloneof tags to create split sets and remove the tags
+ /// Use cloneof tags to create non-merged sets and remove the tags
///
/// True if roms should be deduped, false otherwise
/// Logger object for file and console output
/// True if the number of hashes counted is to be output (default), false otherwise
- public void CreateSplitSets(bool mergeroms, Logger logger, bool output = true)
+ public void CreateNonMergedSets(bool mergeroms, Logger logger, bool output = true)
{
// For sake of ease, the first thing we want to do is sort by game
- BucketByGame(mergeroms, false, logger, output);
+ BucketByGame(mergeroms, true, logger, output);
+ _sortedBy = SortedBy.Default;
// Now we want to loop through all of the games and set the correct information
List games = Keys.ToList();
@@ -498,17 +483,17 @@ namespace SabreTools.Helper.Dats
{
// Determine if the game has a parent or not
string parent = null;
- if (this[game][0].Machine.CloneOf != null)
+ if (!String.IsNullOrEmpty(this[game][0].Machine.CloneOf))
{
parent = this[game][0].Machine.CloneOf;
}
- else if (this[game][0].Machine.RomOf != null)
+ else if (!String.IsNullOrEmpty(this[game][0].Machine.RomOf))
{
parent = this[game][0].Machine.RomOf;
}
// If there is no parent, then we continue
- if (parent == null)
+ if (String.IsNullOrEmpty(parent))
{
continue;
}
@@ -522,6 +507,7 @@ namespace SabreTools.Helper.Dats
item.Machine.CloneOf = null;
item.Machine.RomOf = null;
}
+
continue;
}
@@ -534,32 +520,32 @@ namespace SabreTools.Helper.Dats
switch (item.Type)
{
case ItemType.Archive:
- Archive archive = (Archive)item;
+ Archive archive = ((Archive)item).Clone() as Archive;
archive.Machine = currentMachine;
this[game].Add(archive);
break;
case ItemType.BiosSet:
- BiosSet biosSet = (BiosSet)item;
+ BiosSet biosSet = ((BiosSet)item).Clone() as BiosSet;
biosSet.Machine = currentMachine;
this[game].Add(biosSet);
break;
case ItemType.Disk:
- Disk disk = (Disk)item;
+ Disk disk = ((Disk)item).Clone() as Disk;
disk.Machine = currentMachine;
this[game].Add(disk);
break;
case ItemType.Release:
- Release release = (Release)item;
+ Release release = ((Release)item).Clone() as Release;
release.Machine = currentMachine;
this[game].Add(release);
break;
case ItemType.Rom:
- Rom rom = (Rom)item;
+ Rom rom = ((Rom)item).Clone() as Rom;
rom.Machine = currentMachine;
this[game].Add(rom);
break;
case ItemType.Sample:
- Sample sample = (Sample)item;
+ Sample sample = ((Sample)item).Clone() as Sample;
sample.Machine = currentMachine;
this[game].Add(sample);
break;
diff --git a/SabreTools.Helper/Dats/Partials/DatFile.Parsers.cs b/SabreTools.Helper/Dats/Partials/DatFile.Parsers.cs
index 1d84dae8..a9366ed5 100644
--- a/SabreTools.Helper/Dats/Partials/DatFile.Parsers.cs
+++ b/SabreTools.Helper/Dats/Partials/DatFile.Parsers.cs
@@ -129,7 +129,7 @@ namespace SabreTools.Helper.Dats
// Now we pre-process the DAT with the splitting/merging mode
if (splitType == SplitType.NonMerged)
{
- CreateSplitSets(false, logger, output: false);
+ CreateNonMergedSets(false, logger, output: false);
}
else if (splitType == SplitType.Merged)
{
diff --git a/SabreTools.Helper/Dats/Release.cs b/SabreTools.Helper/Dats/Release.cs
index e9433999..c3c6d560 100644
--- a/SabreTools.Helper/Dats/Release.cs
+++ b/SabreTools.Helper/Dats/Release.cs
@@ -1,8 +1,10 @@
-using SabreTools.Helper.Data;
+using System;
+
+using SabreTools.Helper.Data;
namespace SabreTools.Helper.Dats
{
- public class Release : DatItem
+ public class Release : DatItem, ICloneable
{
#region Private instance variables
@@ -55,6 +57,41 @@ namespace SabreTools.Helper.Dats
#endregion
+ #region Cloning Methods
+
+ public object Clone()
+ {
+ return new Release()
+ {
+ Name = this.Name,
+ Type = this.Type,
+ Dupe = this.Dupe,
+
+ Machine = this.Machine,
+
+ Supported = this.Supported,
+ Publisher = this.Publisher,
+ Infos = this.Infos,
+ PartName = this.PartName,
+ PartInterface = this.PartInterface,
+ Features = this.Features,
+ AreaName = this.AreaName,
+ AreaSize = this.AreaSize,
+
+ SystemID = this.SystemID,
+ System = this.System,
+ SourceID = this.SourceID,
+ Source = this.Source,
+
+ Region = this.Region,
+ Language = this.Language,
+ Date = this.Date,
+ Default = this.Default,
+ };
+ }
+
+ #endregion
+
#region Comparision Methods
public override bool Equals(DatItem other)
diff --git a/SabreTools.Helper/Dats/Rom.cs b/SabreTools.Helper/Dats/Rom.cs
index 26c51f52..aace1b4e 100644
--- a/SabreTools.Helper/Dats/Rom.cs
+++ b/SabreTools.Helper/Dats/Rom.cs
@@ -4,7 +4,7 @@ using SabreTools.Helper.Data;
namespace SabreTools.Helper.Dats
{
- public class Rom : Disk
+ public class Rom : Disk, ICloneable
{
#region Private instance variables
@@ -74,6 +74,43 @@ namespace SabreTools.Helper.Dats
#endregion
+ #region Cloning Methods
+
+ public new object Clone()
+ {
+ return new Rom()
+ {
+ Name = this.Name,
+ Type = this.Type,
+ Dupe = this.Dupe,
+
+ Machine = this.Machine,
+
+ Supported = this.Supported,
+ Publisher = this.Publisher,
+ Infos = this.Infos,
+ PartName = this.PartName,
+ PartInterface = this.PartInterface,
+ Features = this.Features,
+ AreaName = this.AreaName,
+ AreaSize = this.AreaSize,
+
+ SystemID = this.SystemID,
+ System = this.System,
+ SourceID = this.SourceID,
+ Source = this.Source,
+
+ MD5 = this.MD5,
+ SHA1 = this.SHA1,
+ ItemStatus = this.ItemStatus,
+ Size = this.Size,
+ CRC = this.CRC,
+ Date = this.Date,
+ };
+ }
+
+ #endregion
+
#region Comparision Methods
public override bool Equals(DatItem other)
diff --git a/SabreTools.Helper/Dats/Sample.cs b/SabreTools.Helper/Dats/Sample.cs
index 49c40b7a..c69f12ca 100644
--- a/SabreTools.Helper/Dats/Sample.cs
+++ b/SabreTools.Helper/Dats/Sample.cs
@@ -1,8 +1,10 @@
-using SabreTools.Helper.Data;
+using System;
+
+using SabreTools.Helper.Data;
namespace SabreTools.Helper.Dats
{
- public class Sample : DatItem
+ public class Sample : DatItem, ICloneable
{
#region Constructors
@@ -17,6 +19,36 @@ namespace SabreTools.Helper.Dats
#endregion
+ #region Cloning Methods
+
+ public object Clone()
+ {
+ return new Sample()
+ {
+ Name = this.Name,
+ Type = this.Type,
+ Dupe = this.Dupe,
+
+ Machine = this.Machine,
+
+ Supported = this.Supported,
+ Publisher = this.Publisher,
+ Infos = this.Infos,
+ PartName = this.PartName,
+ PartInterface = this.PartInterface,
+ Features = this.Features,
+ AreaName = this.AreaName,
+ AreaSize = this.AreaSize,
+
+ SystemID = this.SystemID,
+ System = this.System,
+ SourceID = this.SourceID,
+ Source = this.Source,
+ };
+ }
+
+ #endregion
+
#region Comparision Methods
public override bool Equals(DatItem other)
diff --git a/debug.log b/debug.log
new file mode 100644
index 00000000..c3383c7b
--- /dev/null
+++ b/debug.log
@@ -0,0 +1 @@
+[0109/130254.459:ERROR:exception_handler_server.cc(524)] ConnectNamedPipe: The pipe is being closed. (0xE8)