mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[DatFile] Make Machine a struct for memory usage
This commit is contained in:
@@ -28,7 +28,7 @@ namespace SabreTools.Library.Dats
|
|||||||
Type = this.Type,
|
Type = this.Type,
|
||||||
Dupe = this.Dupe,
|
Dupe = this.Dupe,
|
||||||
|
|
||||||
Machine = (Machine)this.Machine.Clone(),
|
Machine = this.Machine,
|
||||||
|
|
||||||
Supported = this.Supported,
|
Supported = this.Supported,
|
||||||
Publisher = this.Publisher,
|
Publisher = this.Publisher,
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ namespace SabreTools.Library.Dats
|
|||||||
Type = this.Type,
|
Type = this.Type,
|
||||||
Dupe = this.Dupe,
|
Dupe = this.Dupe,
|
||||||
|
|
||||||
Machine = (Machine)this.Machine.Clone(),
|
Machine = this.Machine,
|
||||||
|
|
||||||
Supported = this.Supported,
|
Supported = this.Supported,
|
||||||
Publisher = this.Publisher,
|
Publisher = this.Publisher,
|
||||||
|
|||||||
217
SabreTools.Library/Dats/DatHeader.cs
Normal file
217
SabreTools.Library/Dats/DatHeader.cs
Normal file
@@ -0,0 +1,217 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
using SabreTools.Library.Data;
|
||||||
|
|
||||||
|
namespace SabreTools.Library.Dats
|
||||||
|
{
|
||||||
|
public struct DatHeader
|
||||||
|
{
|
||||||
|
#region Private instance variables
|
||||||
|
|
||||||
|
// Data common to most DAT types
|
||||||
|
private string _fileName;
|
||||||
|
private string _name;
|
||||||
|
private string _description;
|
||||||
|
private string _rootDir;
|
||||||
|
private string _category;
|
||||||
|
private string _version;
|
||||||
|
private string _date;
|
||||||
|
private string _author;
|
||||||
|
private string _email;
|
||||||
|
private string _homepage;
|
||||||
|
private string _url;
|
||||||
|
private string _comment;
|
||||||
|
private string _header;
|
||||||
|
private string _type; // Generally only used for SuperDAT
|
||||||
|
private ForceMerging _forceMerging;
|
||||||
|
private ForceNodump _forceNodump;
|
||||||
|
private ForcePacking _forcePacking;
|
||||||
|
private DatFormat _datFormat;
|
||||||
|
private bool _excludeOf;
|
||||||
|
private bool _mergeRoms;
|
||||||
|
private Hash _stripHash;
|
||||||
|
private bool _oneGameOneRegion;
|
||||||
|
private List<string> _regions;
|
||||||
|
|
||||||
|
// Data specific to the Miss DAT type
|
||||||
|
private bool _useGame;
|
||||||
|
private string _prefix;
|
||||||
|
private string _postfix;
|
||||||
|
private bool _quotes;
|
||||||
|
private string _repExt;
|
||||||
|
private string _addExt;
|
||||||
|
private bool _remExt;
|
||||||
|
private bool _gameName;
|
||||||
|
private bool _romba;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Publicly facing variables
|
||||||
|
|
||||||
|
// Data common to most DAT types
|
||||||
|
public string FileName
|
||||||
|
{
|
||||||
|
get { return _fileName; }
|
||||||
|
set { _fileName = value; }
|
||||||
|
}
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get { return _name; }
|
||||||
|
set { _name = value; }
|
||||||
|
}
|
||||||
|
public string Description
|
||||||
|
{
|
||||||
|
get { return _description; }
|
||||||
|
set { _description = value; }
|
||||||
|
}
|
||||||
|
public string RootDir
|
||||||
|
{
|
||||||
|
get { return _rootDir; }
|
||||||
|
set { _rootDir = value; }
|
||||||
|
}
|
||||||
|
public string Category
|
||||||
|
{
|
||||||
|
get { return _category; }
|
||||||
|
set { _category = value; }
|
||||||
|
}
|
||||||
|
public string Version
|
||||||
|
{
|
||||||
|
get { return _version; }
|
||||||
|
set { _version = value; }
|
||||||
|
}
|
||||||
|
public string Date
|
||||||
|
{
|
||||||
|
get { return _date; }
|
||||||
|
set { _date = value; }
|
||||||
|
}
|
||||||
|
public string Author
|
||||||
|
{
|
||||||
|
get { return _author; }
|
||||||
|
set { _author = value; }
|
||||||
|
}
|
||||||
|
public string Email
|
||||||
|
{
|
||||||
|
get { return _email; }
|
||||||
|
set { _email = value; }
|
||||||
|
}
|
||||||
|
public string Homepage
|
||||||
|
{
|
||||||
|
get { return _homepage; }
|
||||||
|
set { _homepage = value; }
|
||||||
|
}
|
||||||
|
public string Url
|
||||||
|
{
|
||||||
|
get { return _url; }
|
||||||
|
set { _url = value; }
|
||||||
|
}
|
||||||
|
public string Comment
|
||||||
|
{
|
||||||
|
get { return _comment; }
|
||||||
|
set { _comment = value; }
|
||||||
|
}
|
||||||
|
public string Header
|
||||||
|
{
|
||||||
|
get { return _header; }
|
||||||
|
set { _header = value; }
|
||||||
|
}
|
||||||
|
public string Type // Generally only used for SuperDAT
|
||||||
|
{
|
||||||
|
get { return _type; }
|
||||||
|
set { _type = value; }
|
||||||
|
}
|
||||||
|
public ForceMerging ForceMerging
|
||||||
|
{
|
||||||
|
get { return _forceMerging; }
|
||||||
|
set { _forceMerging = value; }
|
||||||
|
}
|
||||||
|
public ForceNodump ForceNodump
|
||||||
|
{
|
||||||
|
get { return _forceNodump; }
|
||||||
|
set { _forceNodump = value; }
|
||||||
|
}
|
||||||
|
public ForcePacking ForcePacking
|
||||||
|
{
|
||||||
|
get { return _forcePacking; }
|
||||||
|
set { _forcePacking = value; }
|
||||||
|
}
|
||||||
|
public DatFormat DatFormat
|
||||||
|
{
|
||||||
|
get { return _datFormat; }
|
||||||
|
set { _datFormat = value; }
|
||||||
|
}
|
||||||
|
public bool ExcludeOf
|
||||||
|
{
|
||||||
|
get { return _excludeOf; }
|
||||||
|
set { _excludeOf = value; }
|
||||||
|
}
|
||||||
|
public bool MergeRoms
|
||||||
|
{
|
||||||
|
get { return _mergeRoms; }
|
||||||
|
set { _mergeRoms = value; }
|
||||||
|
}
|
||||||
|
public Hash StripHash
|
||||||
|
{
|
||||||
|
get { return _stripHash; }
|
||||||
|
set { _stripHash = value; }
|
||||||
|
}
|
||||||
|
public bool OneGameOneRegion
|
||||||
|
{
|
||||||
|
get { return _oneGameOneRegion; }
|
||||||
|
set { _oneGameOneRegion = value; }
|
||||||
|
}
|
||||||
|
public List<string> Regions
|
||||||
|
{
|
||||||
|
get { return _regions; }
|
||||||
|
set { _regions = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
// Data specific to the Miss DAT type
|
||||||
|
public bool UseGame
|
||||||
|
{
|
||||||
|
get { return _useGame; }
|
||||||
|
set { _useGame = value; }
|
||||||
|
}
|
||||||
|
public string Prefix
|
||||||
|
{
|
||||||
|
get { return _prefix; }
|
||||||
|
set { _prefix = value; }
|
||||||
|
}
|
||||||
|
public string Postfix
|
||||||
|
{
|
||||||
|
get { return _postfix; }
|
||||||
|
set { _postfix = value; }
|
||||||
|
}
|
||||||
|
public bool Quotes
|
||||||
|
{
|
||||||
|
get { return _quotes; }
|
||||||
|
set { _quotes = value; }
|
||||||
|
}
|
||||||
|
public string RepExt
|
||||||
|
{
|
||||||
|
get { return _repExt; }
|
||||||
|
set { _repExt = value; }
|
||||||
|
}
|
||||||
|
public string AddExt
|
||||||
|
{
|
||||||
|
get { return _addExt; }
|
||||||
|
set { _addExt = value; }
|
||||||
|
}
|
||||||
|
public bool RemExt
|
||||||
|
{
|
||||||
|
get { return _remExt; }
|
||||||
|
set { _remExt = value; }
|
||||||
|
}
|
||||||
|
public bool GameName
|
||||||
|
{
|
||||||
|
get { return _gameName; }
|
||||||
|
set { _gameName = value; }
|
||||||
|
}
|
||||||
|
public bool Romba
|
||||||
|
{
|
||||||
|
get { return _romba; }
|
||||||
|
set { _romba = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -608,7 +608,7 @@ namespace SabreTools.Library.Dats
|
|||||||
{
|
{
|
||||||
saveditem.SystemID = file.SystemID;
|
saveditem.SystemID = file.SystemID;
|
||||||
saveditem.System = file.System;
|
saveditem.System = file.System;
|
||||||
saveditem.Machine = (Machine)file.Machine.Clone();
|
saveditem.Machine = file.Machine;
|
||||||
saveditem.Name = file.Name;
|
saveditem.Name = file.Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -617,7 +617,7 @@ namespace SabreTools.Library.Dats
|
|||||||
{
|
{
|
||||||
saveditem.SourceID = file.SourceID;
|
saveditem.SourceID = file.SourceID;
|
||||||
saveditem.Source = file.Source;
|
saveditem.Source = file.Source;
|
||||||
saveditem.Machine = (Machine)file.Machine.Clone();
|
saveditem.Machine = file.Machine;
|
||||||
saveditem.Name = file.Name;
|
saveditem.Name = file.Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ namespace SabreTools.Library.Dats
|
|||||||
Type = this.Type,
|
Type = this.Type,
|
||||||
Dupe = this.Dupe,
|
Dupe = this.Dupe,
|
||||||
|
|
||||||
Machine = (Machine)this.Machine.Clone(),
|
Machine = this.Machine,
|
||||||
|
|
||||||
Supported = this.Supported,
|
Supported = this.Supported,
|
||||||
Publisher = this.Publisher,
|
Publisher = this.Publisher,
|
||||||
|
|||||||
@@ -5,25 +5,26 @@ using SabreTools.Library.Data;
|
|||||||
|
|
||||||
namespace SabreTools.Library.Dats
|
namespace SabreTools.Library.Dats
|
||||||
{
|
{
|
||||||
public class Machine : ICloneable
|
public struct Machine
|
||||||
{
|
{
|
||||||
#region Protected instance variables
|
#region Protected instance variables
|
||||||
|
|
||||||
// Machine information
|
// Machine information
|
||||||
protected string _name;
|
private string _name;
|
||||||
protected string _comment;
|
private string _comment;
|
||||||
protected string _description;
|
private string _description;
|
||||||
protected string _year;
|
private string _year;
|
||||||
protected string _manufacturer;
|
private string _manufacturer;
|
||||||
protected string _romOf;
|
private string _romOf;
|
||||||
protected string _cloneOf;
|
private string _cloneOf;
|
||||||
protected string _sampleOf;
|
private string _sampleOf;
|
||||||
protected string _sourceFile;
|
private string _sourceFile;
|
||||||
protected bool? _runnable;
|
private bool? _runnable;
|
||||||
protected string _board;
|
private string _board;
|
||||||
protected string _rebuildTo;
|
private string _rebuildTo;
|
||||||
protected List<string> _devices;
|
private List<string> _devices;
|
||||||
protected MachineType _machineType;
|
private MachineType _machineType;
|
||||||
|
private Guid _guid;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -105,16 +106,6 @@ namespace SabreTools.Library.Dats
|
|||||||
|
|
||||||
#region Constructors
|
#region Constructors
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Create a default, empty Machine object
|
|
||||||
/// </summary>
|
|
||||||
public Machine()
|
|
||||||
{
|
|
||||||
_name = "";
|
|
||||||
_description = "";
|
|
||||||
_runnable = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a new Machine object with the included information
|
/// Create a new Machine object with the included information
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -123,33 +114,134 @@ namespace SabreTools.Library.Dats
|
|||||||
public Machine(string name, string description)
|
public Machine(string name, string description)
|
||||||
{
|
{
|
||||||
_name = name;
|
_name = name;
|
||||||
|
_comment = null;
|
||||||
_description = description;
|
_description = description;
|
||||||
|
_year = null;
|
||||||
|
_manufacturer = null;
|
||||||
|
_romOf = null;
|
||||||
|
_cloneOf = null;
|
||||||
|
_sampleOf = null;
|
||||||
|
_sourceFile = null;
|
||||||
_runnable = null;
|
_runnable = null;
|
||||||
|
_board = null;
|
||||||
|
_rebuildTo = null;
|
||||||
|
_devices = null;
|
||||||
|
_machineType = MachineType.NULL;
|
||||||
|
_guid = new Guid();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Cloneing
|
#region Equality comparerers
|
||||||
|
|
||||||
public object Clone()
|
/// <summary>
|
||||||
|
/// Override the equality comparer
|
||||||
|
/// </summary>
|
||||||
|
public static bool operator ==(Machine a, Machine b)
|
||||||
{
|
{
|
||||||
return new Machine()
|
return (a.Name == b.Name
|
||||||
|
&& a.Comment == b.Comment
|
||||||
|
&& a.Description == b.Description
|
||||||
|
&& a.Year == b.Year
|
||||||
|
&& a.Manufacturer == b.Manufacturer
|
||||||
|
&& a.RomOf == b.RomOf
|
||||||
|
&& a.CloneOf == b.CloneOf
|
||||||
|
&& a.SampleOf == b.SampleOf
|
||||||
|
&& a.SourceFile == b.SourceFile
|
||||||
|
&& a.Runnable == b.Runnable
|
||||||
|
&& a.Board == b.Board
|
||||||
|
&& a.RebuildTo == b.RebuildTo
|
||||||
|
&& a.Devices == b.Devices
|
||||||
|
&& a.MachineType == b.MachineType);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Override the inequality comparer
|
||||||
|
/// </summary>
|
||||||
|
public static bool operator !=(Machine a, Machine b)
|
||||||
{
|
{
|
||||||
Name = _name,
|
return !(a == b);
|
||||||
Comment = _comment,
|
}
|
||||||
Description = _description,
|
|
||||||
Year = _year,
|
/// <summary>
|
||||||
Manufacturer = _manufacturer,
|
/// Override the Equals method
|
||||||
RomOf = _romOf,
|
/// </summary>
|
||||||
CloneOf = _cloneOf,
|
public override bool Equals(object o)
|
||||||
SampleOf = _sampleOf,
|
{
|
||||||
SourceFile = _sourceFile,
|
if (o.GetType() != typeof(Machine))
|
||||||
Runnable = _runnable,
|
{
|
||||||
Board = _board,
|
return false;
|
||||||
RebuildTo = _rebuildTo,
|
}
|
||||||
Devices = _devices,
|
|
||||||
MachineType = _machineType,
|
return this == (Machine)o;
|
||||||
};
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Override the GetHashCode method
|
||||||
|
/// </summary>
|
||||||
|
public override int GetHashCode()
|
||||||
|
{
|
||||||
|
return OCRC.OptimizedCRC.Compute(_guid.ToByteArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Update fields
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Append a string to the description
|
||||||
|
/// </summary>
|
||||||
|
public void AppendDescription(string append)
|
||||||
|
{
|
||||||
|
UpdateDescription(this.Description + append);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Append a string to the name
|
||||||
|
/// </summary>
|
||||||
|
public void AppendName(string append)
|
||||||
|
{
|
||||||
|
UpdateName(this.Name + append);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Update the cloneof
|
||||||
|
/// </summary>
|
||||||
|
public void UpdateCloneOf(string update)
|
||||||
|
{
|
||||||
|
_cloneOf = update;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Update the description
|
||||||
|
/// </summary>
|
||||||
|
public void UpdateDescription(string update)
|
||||||
|
{
|
||||||
|
_description = update;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Update the romof
|
||||||
|
/// </summary>
|
||||||
|
public void UpdateRomOf(string update)
|
||||||
|
{
|
||||||
|
_romOf = update;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Update the sampleof
|
||||||
|
/// </summary>
|
||||||
|
public void UpdateSampleOf(string update)
|
||||||
|
{
|
||||||
|
_sampleOf = update;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Update the name
|
||||||
|
/// </summary>
|
||||||
|
public void UpdateName(string update)
|
||||||
|
{
|
||||||
|
_name = update;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -251,8 +251,8 @@ namespace SabreTools.Library.Dats
|
|||||||
intDat.WriteToFile(interOutDir);
|
intDat.WriteToFile(interOutDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Due to possible memory requirements, each DAT, after written, will be nulled out
|
// Due to possible memory requirements, we force a garbage collection
|
||||||
intDat = null;
|
GC.Collect();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -467,7 +467,7 @@ namespace SabreTools.Library.Dats
|
|||||||
if ((diff & DiffMode.NoDupes) != 0)
|
if ((diff & DiffMode.NoDupes) != 0)
|
||||||
{
|
{
|
||||||
DatItem newrom = item.Clone() as DatItem;
|
DatItem newrom = item.Clone() as DatItem;
|
||||||
newrom.Machine.Name += " (" + Path.GetFileNameWithoutExtension(inputs[newrom.SystemID].Split('¬')[0]) + ")";
|
newrom.Machine.AppendName(" (" + Path.GetFileNameWithoutExtension(inputs[newrom.SystemID].Split('¬')[0]) + ")");
|
||||||
|
|
||||||
outerDiffData.Add(key, newrom);
|
outerDiffData.Add(key, newrom);
|
||||||
}
|
}
|
||||||
@@ -480,7 +480,7 @@ namespace SabreTools.Library.Dats
|
|||||||
if ((item.Dupe & DupeType.External) != 0)
|
if ((item.Dupe & DupeType.External) != 0)
|
||||||
{
|
{
|
||||||
DatItem newrom = item.Clone() as DatItem;
|
DatItem newrom = item.Clone() as DatItem;
|
||||||
newrom.Machine.Name += " (" + Path.GetFileNameWithoutExtension(inputs[newrom.SystemID].Split('¬')[0]) + ")";
|
newrom.Machine.AppendName(" (" + Path.GetFileNameWithoutExtension(inputs[newrom.SystemID].Split('¬')[0]) + ")");
|
||||||
|
|
||||||
dupeData.Add(key, newrom);
|
dupeData.Add(key, newrom);
|
||||||
}
|
}
|
||||||
@@ -549,9 +549,9 @@ namespace SabreTools.Library.Dats
|
|||||||
|
|
||||||
rootpath += (rootpath == "" ? "" : Path.DirectorySeparatorChar.ToString());
|
rootpath += (rootpath == "" ? "" : Path.DirectorySeparatorChar.ToString());
|
||||||
filename = filename.Remove(0, rootpath.Length);
|
filename = filename.Remove(0, rootpath.Length);
|
||||||
newItem.Machine.Name = Path.GetDirectoryName(filename) + Path.DirectorySeparatorChar
|
newItem.Machine.UpdateName(Path.GetDirectoryName(filename) + Path.DirectorySeparatorChar
|
||||||
+ Path.GetFileNameWithoutExtension(filename) + Path.DirectorySeparatorChar
|
+ Path.GetFileNameWithoutExtension(filename) + Path.DirectorySeparatorChar
|
||||||
+ newItem.Machine.Name;
|
+ newItem.Machine.Name);
|
||||||
|
|
||||||
newItems.Add(newItem);
|
newItems.Add(newItem);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -402,7 +402,7 @@ namespace SabreTools.Library.Dats
|
|||||||
|
|
||||||
// Update rom information
|
// Update rom information
|
||||||
datItem.Name = romname;
|
datItem.Name = romname;
|
||||||
if (datItem.Machine == null)
|
if (datItem.Machine == default(Machine))
|
||||||
{
|
{
|
||||||
datItem.Machine = new Machine
|
datItem.Machine = new Machine
|
||||||
{
|
{
|
||||||
@@ -412,8 +412,8 @@ namespace SabreTools.Library.Dats
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
datItem.Machine.Name = gamename;
|
datItem.Machine.UpdateName(gamename);
|
||||||
datItem.Machine.Description = gamename;
|
datItem.Machine.UpdateDescription(gamename);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the file information to the DAT
|
// Add the file information to the DAT
|
||||||
|
|||||||
@@ -36,6 +36,12 @@ namespace SabreTools.Library.Dats
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If we have a situation where there's no dictionary or no keys at all, we skip
|
||||||
|
if (_files == null || _files.Count == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Set the sorted type
|
// Set the sorted type
|
||||||
_sortedBy = bucketBy;
|
_sortedBy = bucketBy;
|
||||||
|
|
||||||
@@ -190,7 +196,7 @@ namespace SabreTools.Library.Dats
|
|||||||
// If we are in single game mode, rename all games
|
// If we are in single game mode, rename all games
|
||||||
if (single)
|
if (single)
|
||||||
{
|
{
|
||||||
item.Machine.Name = "!";
|
item.Machine.UpdateName("!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we are in NTFS trim mode, trim the game name
|
// If we are in NTFS trim mode, trim the game name
|
||||||
@@ -253,25 +259,25 @@ namespace SabreTools.Library.Dats
|
|||||||
// Update machine name
|
// Update machine name
|
||||||
if (!String.IsNullOrEmpty(item.Machine.Name) && mapping.ContainsKey(item.Machine.Name))
|
if (!String.IsNullOrEmpty(item.Machine.Name) && mapping.ContainsKey(item.Machine.Name))
|
||||||
{
|
{
|
||||||
item.Machine.Name = mapping[item.Machine.Name];
|
item.Machine.UpdateName(mapping[item.Machine.Name]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update cloneof
|
// Update cloneof
|
||||||
if (!String.IsNullOrEmpty(item.Machine.CloneOf) && mapping.ContainsKey(item.Machine.CloneOf))
|
if (!String.IsNullOrEmpty(item.Machine.CloneOf) && mapping.ContainsKey(item.Machine.CloneOf))
|
||||||
{
|
{
|
||||||
item.Machine.CloneOf = mapping[item.Machine.CloneOf];
|
item.Machine.UpdateCloneOf(mapping[item.Machine.CloneOf]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update romof
|
// Update romof
|
||||||
if (!String.IsNullOrEmpty(item.Machine.RomOf) && mapping.ContainsKey(item.Machine.RomOf))
|
if (!String.IsNullOrEmpty(item.Machine.RomOf) && mapping.ContainsKey(item.Machine.RomOf))
|
||||||
{
|
{
|
||||||
item.Machine.RomOf = mapping[item.Machine.RomOf];
|
item.Machine.UpdateRomOf(mapping[item.Machine.RomOf]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update sampleof
|
// Update sampleof
|
||||||
if (!String.IsNullOrEmpty(item.Machine.SampleOf) && mapping.ContainsKey(item.Machine.SampleOf))
|
if (!String.IsNullOrEmpty(item.Machine.SampleOf) && mapping.ContainsKey(item.Machine.SampleOf))
|
||||||
{
|
{
|
||||||
item.Machine.SampleOf = mapping[item.Machine.SampleOf];
|
item.Machine.UpdateSampleOf(mapping[item.Machine.SampleOf]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the new item to the output list
|
// Add the new item to the output list
|
||||||
@@ -759,7 +765,7 @@ namespace SabreTools.Library.Dats
|
|||||||
string romof = this[parent][0].Machine.RomOf;
|
string romof = this[parent][0].Machine.RomOf;
|
||||||
foreach (DatItem item in items)
|
foreach (DatItem item in items)
|
||||||
{
|
{
|
||||||
item.Machine.RomOf = romof;
|
item.Machine.UpdateRomOf(romof);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1025,7 +1031,7 @@ namespace SabreTools.Library.Dats
|
|||||||
string romof = this[parent][0].Machine.RomOf;
|
string romof = this[parent][0].Machine.RomOf;
|
||||||
foreach (DatItem item in items)
|
foreach (DatItem item in items)
|
||||||
{
|
{
|
||||||
item.Machine.RomOf = romof;
|
item.Machine.UpdateRomOf(romof);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1041,8 +1047,8 @@ namespace SabreTools.Library.Dats
|
|||||||
List<DatItem> items = this[game];
|
List<DatItem> items = this[game];
|
||||||
foreach (DatItem item in items)
|
foreach (DatItem item in items)
|
||||||
{
|
{
|
||||||
item.Machine.CloneOf = null;
|
item.Machine.UpdateCloneOf(null);
|
||||||
item.Machine.RomOf = null;
|
item.Machine.UpdateRomOf(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3018,14 +3018,14 @@ namespace SabreTools.Library.Dats
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If we're in cleaning mode, sanitize the game name
|
// If we're in cleaning mode, sanitize the game name
|
||||||
item.Machine.Name = (clean ? Style.CleanGameName(item.Machine.Name) : item.Machine.Name);
|
item.Machine.UpdateName((clean ? Style.CleanGameName(item.Machine.Name) : item.Machine.Name));
|
||||||
|
|
||||||
// If we're stripping unicode characters, do so from all relevant things
|
// If we're stripping unicode characters, do so from all relevant things
|
||||||
if (remUnicode)
|
if (remUnicode)
|
||||||
{
|
{
|
||||||
item.Name = Style.RemoveUnicodeCharacters(item.Name);
|
item.Name = Style.RemoveUnicodeCharacters(item.Name);
|
||||||
item.Machine.Name = Style.RemoveUnicodeCharacters(item.Machine.Name);
|
item.Machine.UpdateName(Style.RemoveUnicodeCharacters(item.Machine.Name));
|
||||||
item.Machine.Description = Style.RemoveUnicodeCharacters(item.Machine.Description);
|
item.Machine.UpdateDescription(Style.RemoveUnicodeCharacters(item.Machine.Description));
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we have a Rom or a Disk, clean the hash data
|
// If we have a Rom or a Disk, clean the hash data
|
||||||
|
|||||||
@@ -645,8 +645,8 @@ namespace SabreTools.Library.Dats
|
|||||||
// If we are coming from an archive, set the correct machine name
|
// If we are coming from an archive, set the correct machine name
|
||||||
if (machinename != null)
|
if (machinename != null)
|
||||||
{
|
{
|
||||||
item.Machine.Name = machinename;
|
item.Machine.UpdateName(machinename);
|
||||||
item.Machine.Description = machinename;
|
item.Machine.UpdateDescription(machinename);
|
||||||
}
|
}
|
||||||
|
|
||||||
Globals.Logger.User("No matches found for '" + Style.GetFileName(rom.Name) + "', rebuilding accordingly from inverse flag...");
|
Globals.Logger.User("No matches found for '" + Style.GetFileName(rom.Name) + "', rebuilding accordingly from inverse flag...");
|
||||||
|
|||||||
@@ -435,8 +435,8 @@ namespace SabreTools.Library.Dats
|
|||||||
|
|
||||||
// Clean the input list and set all games to be pathless
|
// Clean the input list and set all games to be pathless
|
||||||
List<DatItem> items = this[key];
|
List<DatItem> items = this[key];
|
||||||
items.ForEach(item => item.Machine.Name = Style.GetFileName(item.Machine.Name));
|
items.ForEach(item => item.Machine.UpdateName(Style.GetFileName(item.Machine.Name)));
|
||||||
items.ForEach(item => item.Machine.Description = Style.GetFileName(item.Machine.Description));
|
items.ForEach(item => item.Machine.UpdateDescription(Style.GetFileName(item.Machine.Description)));
|
||||||
|
|
||||||
// Now add the game to the output DAT
|
// Now add the game to the output DAT
|
||||||
tempDat.AddRange(key, items);
|
tempDat.AddRange(key, items);
|
||||||
|
|||||||
@@ -474,7 +474,7 @@ namespace SabreTools.Library.Dats
|
|||||||
// No game should start with a path separator
|
// No game should start with a path separator
|
||||||
if (rom.Machine.Name.StartsWith(Path.DirectorySeparatorChar.ToString()))
|
if (rom.Machine.Name.StartsWith(Path.DirectorySeparatorChar.ToString()))
|
||||||
{
|
{
|
||||||
rom.Machine.Name = rom.Machine.Name.Substring(1);
|
rom.Machine.UpdateName(rom.Machine.Name.Substring(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
string state = "";
|
string state = "";
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ namespace SabreTools.Library.Dats
|
|||||||
Type = this.Type,
|
Type = this.Type,
|
||||||
Dupe = this.Dupe,
|
Dupe = this.Dupe,
|
||||||
|
|
||||||
Machine = (Machine)this.Machine.Clone(),
|
Machine = this.Machine,
|
||||||
|
|
||||||
Supported = this.Supported,
|
Supported = this.Supported,
|
||||||
Publisher = this.Publisher,
|
Publisher = this.Publisher,
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ namespace SabreTools.Library.Dats
|
|||||||
Type = this.Type,
|
Type = this.Type,
|
||||||
Dupe = this.Dupe,
|
Dupe = this.Dupe,
|
||||||
|
|
||||||
Machine = (Machine)this.Machine.Clone(),
|
Machine = this.Machine,
|
||||||
|
|
||||||
Supported = this.Supported,
|
Supported = this.Supported,
|
||||||
Publisher = this.Publisher,
|
Publisher = this.Publisher,
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ namespace SabreTools.Library.Dats
|
|||||||
Type = this.Type,
|
Type = this.Type,
|
||||||
Dupe = this.Dupe,
|
Dupe = this.Dupe,
|
||||||
|
|
||||||
Machine = (Machine)this.Machine.Clone(),
|
Machine = this.Machine,
|
||||||
|
|
||||||
Supported = this.Supported,
|
Supported = this.Supported,
|
||||||
Publisher = this.Publisher,
|
Publisher = this.Publisher,
|
||||||
|
|||||||
@@ -115,6 +115,7 @@
|
|||||||
<Compile Include="Data\Constants.cs" />
|
<Compile Include="Data\Constants.cs" />
|
||||||
<Compile Include="Data\Flags.cs" />
|
<Compile Include="Data\Flags.cs" />
|
||||||
<Compile Include="Data\Globals.cs" />
|
<Compile Include="Data\Globals.cs" />
|
||||||
|
<Compile Include="Dats\DatHeader.cs" />
|
||||||
<Compile Include="Dats\Partials\DatFile.Manipulate.cs" />
|
<Compile Include="Dats\Partials\DatFile.Manipulate.cs" />
|
||||||
<Compile Include="Dats\Partials\DatFile.ConvertUpdate.cs" />
|
<Compile Include="Dats\Partials\DatFile.ConvertUpdate.cs" />
|
||||||
<Compile Include="Dats\Partials\DatFile.DFD.cs" />
|
<Compile Include="Dats\Partials\DatFile.DFD.cs" />
|
||||||
|
|||||||
Reference in New Issue
Block a user