mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[DatFile, DatItem] Enable merge tags and proper usage
This commit is contained in:
@@ -19,6 +19,7 @@ namespace SabreTools.Helper.Dats
|
|||||||
|
|
||||||
// Standard item information
|
// Standard item information
|
||||||
protected string _name;
|
protected string _name;
|
||||||
|
private string _merge;
|
||||||
protected ItemType _itemType;
|
protected ItemType _itemType;
|
||||||
protected DupeType _dupeType;
|
protected DupeType _dupeType;
|
||||||
|
|
||||||
@@ -51,6 +52,11 @@ namespace SabreTools.Helper.Dats
|
|||||||
get { return _name; }
|
get { return _name; }
|
||||||
set { _name = value; }
|
set { _name = value; }
|
||||||
}
|
}
|
||||||
|
public string MergeTag
|
||||||
|
{
|
||||||
|
get { return _merge; }
|
||||||
|
set { _merge = value; }
|
||||||
|
}
|
||||||
public ItemType Type
|
public ItemType Type
|
||||||
{
|
{
|
||||||
get { return _itemType; }
|
get { return _itemType; }
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ namespace SabreTools.Helper.Dats
|
|||||||
// Disk information
|
// Disk information
|
||||||
protected string _md5;
|
protected string _md5;
|
||||||
protected string _sha1;
|
protected string _sha1;
|
||||||
// private string _merge;
|
|
||||||
protected ItemStatus _itemStatus;
|
protected ItemStatus _itemStatus;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -809,6 +809,17 @@ namespace SabreTools.Helper.Dats
|
|||||||
List<DatItem> items = this[game];
|
List<DatItem> items = this[game];
|
||||||
foreach (DatItem item in items)
|
foreach (DatItem item in items)
|
||||||
{
|
{
|
||||||
|
// If the item doesn't have a valid merge tag OR the merged file doesn't exist in the parent, then add it
|
||||||
|
if (item.MergeTag == null || !this[parent].Select(i => i.Name).Contains(item.MergeTag))
|
||||||
|
{
|
||||||
|
// TODO: Remove hack for just disks at a later date
|
||||||
|
item.Name = (item.Type != ItemType.Disk ? item.Machine.Name + "\\" : "") + item.Name;
|
||||||
|
item.Machine = parentMachine;
|
||||||
|
|
||||||
|
this[parent].Add(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
// If the parent doesn't already contain the item, add it
|
// If the parent doesn't already contain the item, add it
|
||||||
if (!this[parent].Contains(item))
|
if (!this[parent].Contains(item))
|
||||||
{
|
{
|
||||||
@@ -818,6 +829,7 @@ namespace SabreTools.Helper.Dats
|
|||||||
|
|
||||||
this[parent].Add(item);
|
this[parent].Add(item);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
// Then, remove the old game so it's not picked up by the writer
|
// Then, remove the old game so it's not picked up by the writer
|
||||||
|
|||||||
@@ -1630,6 +1630,9 @@ namespace SabreTools.Helper.Dats
|
|||||||
case "disk":
|
case "disk":
|
||||||
empty = false;
|
empty = false;
|
||||||
|
|
||||||
|
// If the rom has a merge tag, add it
|
||||||
|
string merge = subreader.GetAttribute("merge");
|
||||||
|
|
||||||
// If the rom has a status, flag it
|
// If the rom has a status, flag it
|
||||||
its = ItemStatus.None;
|
its = ItemStatus.None;
|
||||||
if (subreader.GetAttribute("flags") == "good" || subreader.GetAttribute("status") == "good")
|
if (subreader.GetAttribute("flags") == "good" || subreader.GetAttribute("status") == "good")
|
||||||
@@ -1709,6 +1712,7 @@ namespace SabreTools.Helper.Dats
|
|||||||
Name = subreader.GetAttribute("name"),
|
Name = subreader.GetAttribute("name"),
|
||||||
MD5 = subreader.GetAttribute("md5")?.ToLowerInvariant(),
|
MD5 = subreader.GetAttribute("md5")?.ToLowerInvariant(),
|
||||||
SHA1 = subreader.GetAttribute("sha1")?.ToLowerInvariant(),
|
SHA1 = subreader.GetAttribute("sha1")?.ToLowerInvariant(),
|
||||||
|
MergeTag = merge,
|
||||||
ItemStatus = its,
|
ItemStatus = its,
|
||||||
|
|
||||||
Machine = machine,
|
Machine = machine,
|
||||||
@@ -1737,6 +1741,7 @@ namespace SabreTools.Helper.Dats
|
|||||||
MD5 = subreader.GetAttribute("md5")?.ToLowerInvariant(),
|
MD5 = subreader.GetAttribute("md5")?.ToLowerInvariant(),
|
||||||
SHA1 = subreader.GetAttribute("sha1")?.ToLowerInvariant(),
|
SHA1 = subreader.GetAttribute("sha1")?.ToLowerInvariant(),
|
||||||
ItemStatus = its,
|
ItemStatus = its,
|
||||||
|
MergeTag = merge,
|
||||||
Date = date,
|
Date = date,
|
||||||
|
|
||||||
Machine = machine,
|
Machine = machine,
|
||||||
|
|||||||
Reference in New Issue
Block a user