mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[DatFile] Move DAT processing to different level
This commit is contained in:
@@ -102,13 +102,13 @@ namespace SabreTools.Helper.Dats
|
|||||||
break;
|
break;
|
||||||
case DatFormat.ClrMamePro:
|
case DatFormat.ClrMamePro:
|
||||||
case DatFormat.DOSCenter:
|
case DatFormat.DOSCenter:
|
||||||
ParseCMP(filename, sysid, srcid, filter, splitType, trim, single, root, logger, keep, clean);
|
ParseCMP(filename, sysid, srcid, filter, trim, single, root, logger, keep, clean);
|
||||||
break;
|
break;
|
||||||
case DatFormat.Logiqx:
|
case DatFormat.Logiqx:
|
||||||
case DatFormat.OfflineList:
|
case DatFormat.OfflineList:
|
||||||
case DatFormat.SabreDat:
|
case DatFormat.SabreDat:
|
||||||
case DatFormat.SoftwareList:
|
case DatFormat.SoftwareList:
|
||||||
ParseGenericXML(filename, sysid, srcid, filter, splitType, trim, single, root, logger, keep, clean, softlist);
|
ParseGenericXML(filename, sysid, srcid, filter, trim, single, root, logger, keep, clean, softlist);
|
||||||
break;
|
break;
|
||||||
case DatFormat.RedumpMD5:
|
case DatFormat.RedumpMD5:
|
||||||
ParseRedumpMD5(filename, sysid, srcid, filter, trim, single, root, logger, clean);
|
ParseRedumpMD5(filename, sysid, srcid, filter, trim, single, root, logger, clean);
|
||||||
@@ -120,11 +120,25 @@ namespace SabreTools.Helper.Dats
|
|||||||
ParseRedumpSHA1(filename, sysid, srcid, filter, trim, single, root, logger, clean);
|
ParseRedumpSHA1(filename, sysid, srcid, filter, trim, single, root, logger, clean);
|
||||||
break;
|
break;
|
||||||
case DatFormat.RomCenter:
|
case DatFormat.RomCenter:
|
||||||
ParseRC(filename, sysid, srcid, filter, splitType, trim, single, root, logger, clean);
|
ParseRC(filename, sysid, srcid, filter, trim, single, root, logger, clean);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Now we pre-process the DAT with the splitting/merging mode
|
||||||
|
if (splitType == SplitType.Split)
|
||||||
|
{
|
||||||
|
CreateSplitSets(false, logger, output: false);
|
||||||
|
}
|
||||||
|
else if (splitType == SplitType.Merged)
|
||||||
|
{
|
||||||
|
CreateMergedSets(false, logger, output: false);
|
||||||
|
}
|
||||||
|
else if (splitType == SplitType.MergedWithDevice)
|
||||||
|
{
|
||||||
|
logger.User("Full merging is not yet available. Sorry for the inconvenience");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -213,7 +227,7 @@ namespace SabreTools.Helper.Dats
|
|||||||
|
|
||||||
// Now process and add the rom
|
// Now process and add the rom
|
||||||
string key = "";
|
string key = "";
|
||||||
ParseAddHelper(rom, filter, SplitType.None, trim, single, root, clean, logger, out key);
|
ParseAddHelper(rom, filter, trim, single, root, clean, logger, out key);
|
||||||
}
|
}
|
||||||
|
|
||||||
sr.Dispose();
|
sr.Dispose();
|
||||||
@@ -226,7 +240,6 @@ namespace SabreTools.Helper.Dats
|
|||||||
/// <param name="sysid">System ID for the DAT</param>
|
/// <param name="sysid">System ID for the DAT</param>
|
||||||
/// <param name="srcid">Source ID for the DAT</param>
|
/// <param name="srcid">Source ID for the DAT</param>
|
||||||
/// <param name="filter">Filter object for passing to the DatItem level</param>
|
/// <param name="filter">Filter object for passing to the DatItem level</param>
|
||||||
/// <param name="splitType">Type of the split that should be performed (split, merged, fully merged)</param>
|
|
||||||
/// <param name="trim">True if we are supposed to trim names to NTFS length, false otherwise</param>
|
/// <param name="trim">True if we are supposed to trim names to NTFS length, false otherwise</param>
|
||||||
/// <param name="single">True if all games should be replaced by '!', false otherwise</param>
|
/// <param name="single">True if all games should be replaced by '!', false otherwise</param>
|
||||||
/// <param name="root">String representing root directory to compare against for length calculation</param>
|
/// <param name="root">String representing root directory to compare against for length calculation</param>
|
||||||
@@ -243,7 +256,6 @@ namespace SabreTools.Helper.Dats
|
|||||||
Filter filter,
|
Filter filter,
|
||||||
|
|
||||||
// Rom renaming
|
// Rom renaming
|
||||||
SplitType splitType,
|
|
||||||
bool trim,
|
bool trim,
|
||||||
bool single,
|
bool single,
|
||||||
string root,
|
string root,
|
||||||
@@ -359,7 +371,7 @@ namespace SabreTools.Helper.Dats
|
|||||||
|
|
||||||
// Now process and add the sample
|
// Now process and add the sample
|
||||||
key = "";
|
key = "";
|
||||||
ParseAddHelper(item, filter, splitType, trim, single, root, clean, logger, out key);
|
ParseAddHelper(item, filter, trim, single, root, clean, logger, out key);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -420,7 +432,7 @@ namespace SabreTools.Helper.Dats
|
|||||||
|
|
||||||
// Now process and add the rom
|
// Now process and add the rom
|
||||||
key = "";
|
key = "";
|
||||||
ParseAddHelper(item, filter, splitType, trim, single, root, clean, logger, out key);
|
ParseAddHelper(item, filter, trim, single, root, clean, logger, out key);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -595,7 +607,7 @@ namespace SabreTools.Helper.Dats
|
|||||||
|
|
||||||
// Now process and add the rom
|
// Now process and add the rom
|
||||||
key = "";
|
key = "";
|
||||||
ParseAddHelper(item, filter, splitType, trim, single, root, clean, logger, out key);
|
ParseAddHelper(item, filter, trim, single, root, clean, logger, out key);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the line is anything but a rom or disk and we're in a block
|
// If the line is anything but a rom or disk and we're in a block
|
||||||
@@ -768,7 +780,6 @@ namespace SabreTools.Helper.Dats
|
|||||||
/// <param name="sysid">System ID for the DAT</param>
|
/// <param name="sysid">System ID for the DAT</param>
|
||||||
/// <param name="srcid">Source ID for the DAT</param>
|
/// <param name="srcid">Source ID for the DAT</param>
|
||||||
/// <param name="filter">Filter object for passing to the DatItem level</param>
|
/// <param name="filter">Filter object for passing to the DatItem level</param>
|
||||||
/// <param name="splitType">Type of the split that should be performed (split, merged, fully merged)</param>
|
|
||||||
/// <param name="trim">True if we are supposed to trim names to NTFS length, false otherwise</param>
|
/// <param name="trim">True if we are supposed to trim names to NTFS length, false otherwise</param>
|
||||||
/// <param name="single">True if all games should be replaced by '!', false otherwise</param>
|
/// <param name="single">True if all games should be replaced by '!', false otherwise</param>
|
||||||
/// <param name="root">String representing root directory to compare against for length calculation</param>
|
/// <param name="root">String representing root directory to compare against for length calculation</param>
|
||||||
@@ -786,7 +797,6 @@ namespace SabreTools.Helper.Dats
|
|||||||
Filter filter,
|
Filter filter,
|
||||||
|
|
||||||
// Rom renaming
|
// Rom renaming
|
||||||
SplitType splitType,
|
|
||||||
bool trim,
|
bool trim,
|
||||||
bool single,
|
bool single,
|
||||||
string root,
|
string root,
|
||||||
@@ -830,7 +840,7 @@ namespace SabreTools.Helper.Dats
|
|||||||
Rom rom = new Rom("null", tempgame);
|
Rom rom = new Rom("null", tempgame);
|
||||||
|
|
||||||
// Now process and add the rom
|
// Now process and add the rom
|
||||||
ParseAddHelper(rom, filter, splitType, trim, single, root, clean, logger, out key);
|
ParseAddHelper(rom, filter, trim, single, root, clean, logger, out key);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Regardless, end the current folder
|
// Regardless, end the current folder
|
||||||
@@ -1350,7 +1360,7 @@ namespace SabreTools.Helper.Dats
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Now process and add the rom
|
// Now process and add the rom
|
||||||
ParseAddHelper(olrom, filter, splitType, trim, single, root, clean, logger, out key);
|
ParseAddHelper(olrom, filter, trim, single, root, clean, logger, out key);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// For Software List only
|
// For Software List only
|
||||||
@@ -1432,7 +1442,7 @@ namespace SabreTools.Helper.Dats
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Now process and add the rom
|
// Now process and add the rom
|
||||||
ParseAddHelper(relrom, filter, splitType, trim, single, root, clean, logger, out key);
|
ParseAddHelper(relrom, filter, trim, single, root, clean, logger, out key);
|
||||||
|
|
||||||
subreader.Read();
|
subreader.Read();
|
||||||
break;
|
break;
|
||||||
@@ -1475,7 +1485,7 @@ namespace SabreTools.Helper.Dats
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Now process and add the rom
|
// Now process and add the rom
|
||||||
ParseAddHelper(biosrom, filter, splitType, trim, single, root, clean, logger, out key);
|
ParseAddHelper(biosrom, filter, trim, single, root, clean, logger, out key);
|
||||||
|
|
||||||
subreader.Read();
|
subreader.Read();
|
||||||
break;
|
break;
|
||||||
@@ -1503,7 +1513,7 @@ namespace SabreTools.Helper.Dats
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Now process and add the rom
|
// Now process and add the rom
|
||||||
ParseAddHelper(archiverom, filter, splitType, trim, single, root, clean, logger, out key);
|
ParseAddHelper(archiverom, filter, trim, single, root, clean, logger, out key);
|
||||||
|
|
||||||
subreader.Read();
|
subreader.Read();
|
||||||
break;
|
break;
|
||||||
@@ -1531,7 +1541,7 @@ namespace SabreTools.Helper.Dats
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Now process and add the rom
|
// Now process and add the rom
|
||||||
ParseAddHelper(samplerom, filter, splitType, trim, single, root, clean, logger, out key);
|
ParseAddHelper(samplerom, filter, trim, single, root, clean, logger, out key);
|
||||||
|
|
||||||
subreader.Read();
|
subreader.Read();
|
||||||
break;
|
break;
|
||||||
@@ -1667,7 +1677,7 @@ namespace SabreTools.Helper.Dats
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Now process and add the rom
|
// Now process and add the rom
|
||||||
ParseAddHelper(inrom, filter, splitType, trim, single, root, clean, logger, out key);
|
ParseAddHelper(inrom, filter, trim, single, root, clean, logger, out key);
|
||||||
|
|
||||||
subreader.Read();
|
subreader.Read();
|
||||||
break;
|
break;
|
||||||
@@ -1839,7 +1849,7 @@ namespace SabreTools.Helper.Dats
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Now process and add the rom
|
// Now process and add the rom
|
||||||
ParseAddHelper(rom, filter, splitType, trim, single, root, clean, logger, out key);
|
ParseAddHelper(rom, filter, trim, single, root, clean, logger, out key);
|
||||||
|
|
||||||
xtr.Read();
|
xtr.Read();
|
||||||
break;
|
break;
|
||||||
@@ -1916,7 +1926,7 @@ namespace SabreTools.Helper.Dats
|
|||||||
|
|
||||||
// Now process and add the rom
|
// Now process and add the rom
|
||||||
string key = "";
|
string key = "";
|
||||||
ParseAddHelper(rom, filter, SplitType.None, trim, single, root, clean, logger, out key);
|
ParseAddHelper(rom, filter, trim, single, root, clean, logger, out key);
|
||||||
}
|
}
|
||||||
|
|
||||||
sr.Dispose();
|
sr.Dispose();
|
||||||
@@ -1978,7 +1988,7 @@ namespace SabreTools.Helper.Dats
|
|||||||
|
|
||||||
// Now process and add the rom
|
// Now process and add the rom
|
||||||
string key = "";
|
string key = "";
|
||||||
ParseAddHelper(rom, filter, SplitType.None, trim, single, root, clean, logger, out key);
|
ParseAddHelper(rom, filter, trim, single, root, clean, logger, out key);
|
||||||
}
|
}
|
||||||
|
|
||||||
sr.Dispose();
|
sr.Dispose();
|
||||||
@@ -2040,7 +2050,7 @@ namespace SabreTools.Helper.Dats
|
|||||||
|
|
||||||
// Now process and add the rom
|
// Now process and add the rom
|
||||||
string key = "";
|
string key = "";
|
||||||
ParseAddHelper(rom, filter, SplitType.None, trim, single, root, clean, logger, out key);
|
ParseAddHelper(rom, filter, trim, single, root, clean, logger, out key);
|
||||||
}
|
}
|
||||||
|
|
||||||
sr.Dispose();
|
sr.Dispose();
|
||||||
@@ -2053,7 +2063,6 @@ namespace SabreTools.Helper.Dats
|
|||||||
/// <param name="sysid">System ID for the DAT</param>
|
/// <param name="sysid">System ID for the DAT</param>
|
||||||
/// <param name="srcid">Source ID for the DAT</param>
|
/// <param name="srcid">Source ID for the DAT</param>
|
||||||
/// <param name="filter">Filter object for passing to the DatItem level</param>
|
/// <param name="filter">Filter object for passing to the DatItem level</param>
|
||||||
/// <param name="splitType">Type of the split that should be performed (split, merged, fully merged)</param>
|
|
||||||
/// <param name="trim">True if we are supposed to trim names to NTFS length, false otherwise</param>
|
/// <param name="trim">True if we are supposed to trim names to NTFS length, false otherwise</param>
|
||||||
/// <param name="single">True if all games should be replaced by '!', false otherwise</param>
|
/// <param name="single">True if all games should be replaced by '!', false otherwise</param>
|
||||||
/// <param name="root">String representing root directory to compare against for length calculation</param>
|
/// <param name="root">String representing root directory to compare against for length calculation</param>
|
||||||
@@ -2069,7 +2078,6 @@ namespace SabreTools.Helper.Dats
|
|||||||
Filter filter,
|
Filter filter,
|
||||||
|
|
||||||
// Rom renaming
|
// Rom renaming
|
||||||
SplitType splitType,
|
|
||||||
bool trim,
|
bool trim,
|
||||||
bool single,
|
bool single,
|
||||||
string root,
|
string root,
|
||||||
@@ -2218,7 +2226,7 @@ namespace SabreTools.Helper.Dats
|
|||||||
|
|
||||||
// Now process and add the rom
|
// Now process and add the rom
|
||||||
string key = "";
|
string key = "";
|
||||||
ParseAddHelper(rom, filter, splitType, trim, single, root, clean, logger, out key);
|
ParseAddHelper(rom, filter, trim, single, root, clean, logger, out key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2231,12 +2239,11 @@ namespace SabreTools.Helper.Dats
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="item">Item data to check against</param>
|
/// <param name="item">Item data to check against</param>
|
||||||
/// <param name="filter">Filter object for passing to the DatItem level</param>
|
/// <param name="filter">Filter object for passing to the DatItem level</param>
|
||||||
/// <param name="splitType">Type of the split that should be performed (split, merged, fully merged)</param>
|
|
||||||
/// <param name="trim">True if we are supposed to trim names to NTFS length, false otherwise</param>
|
/// <param name="trim">True if we are supposed to trim names to NTFS length, false otherwise</param>
|
||||||
/// <param name="single">True if all games should be replaced by '!', false otherwise</param>
|
/// <param name="single">True if all games should be replaced by '!', false otherwise</param>
|
||||||
/// <param name="root">String representing root directory to compare against for length calculation</param>
|
/// <param name="root">String representing root directory to compare against for length calculation</param>
|
||||||
/// <param name="logger">Logger object for console and/or file output</param>
|
/// <param name="logger">Logger object for console and/or file output</param>
|
||||||
private void ParseAddHelper(DatItem item, Filter filter, SplitType splitType, bool trim, bool single, string root, bool clean, Logger logger, out string key)
|
private void ParseAddHelper(DatItem item, Filter filter, bool trim, bool single, string root, bool clean, Logger logger, out string key)
|
||||||
{
|
{
|
||||||
key = "";
|
key = "";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user