mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[DatTools] Filtering updates
Instead of filtering as a post-process to a DAT, have it filter when the DATs are being parsed into the internal structure. This ends up with less memory used off the bat and it should make things quicker. This has not shown any issues in testing, so if this needs to be reverted, it will. Other small changes are also included in this. Some DFD issues might be lingering from this.
This commit is contained in:
@@ -129,7 +129,7 @@ namespace SabreTools
|
||||
basepath = (basepath.EndsWith(Path.DirectorySeparatorChar.ToString()) ? basepath : basepath + Path.DirectorySeparatorChar);
|
||||
|
||||
// Get the file data to be split
|
||||
OutputFormat outputFormat = DatTools.GetOutputFormat(filename);
|
||||
OutputFormat outputFormat = DatTools.GetOutputFormat(filename, _logger);
|
||||
Dat datdata = new Dat();
|
||||
datdata = DatTools.Parse(filename, 0, 0, datdata, _logger, true);
|
||||
|
||||
@@ -337,7 +337,7 @@ namespace SabreTools
|
||||
datdata = DatTools.Parse(filename, 0, 0, datdata, _logger);
|
||||
|
||||
// Set all of the appropriate outputs for each of the subsets
|
||||
OutputFormat outputFormat = DatTools.GetOutputFormat(filename);
|
||||
OutputFormat outputFormat = DatTools.GetOutputFormat(filename, _logger);
|
||||
Dat datdataA = new Dat
|
||||
{
|
||||
FileName = datdata.FileName + " (" + string.Join(",", _extA) + ")",
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -10,6 +10,7 @@ namespace SabreTools.Helper
|
||||
/// <summary>
|
||||
/// DAT manipulation tools that rely on HashData and related structs
|
||||
/// </summary>
|
||||
/// <remarks>THIS IS NOT IN SYNC WITH THE MAIN DATTOOLS CLASS, WILL NEED AN UPDATE BEFORE THAT IS POSSIBLE</remarks>
|
||||
public class DatToolsHash
|
||||
{
|
||||
#region DAT Parsing
|
||||
@@ -38,7 +39,7 @@ namespace SabreTools.Helper
|
||||
datdata.FileName = (String.IsNullOrEmpty(datdata.FileName) ? (keepext ? Path.GetFileName(filename) : Path.GetFileNameWithoutExtension(filename)) : datdata.FileName);
|
||||
|
||||
// If the output type isn't set already, get the internal output type
|
||||
datdata.OutputFormat = (datdata.OutputFormat == OutputFormat.None ? DatTools.GetOutputFormat(filename) : datdata.OutputFormat);
|
||||
datdata.OutputFormat = (datdata.OutputFormat == OutputFormat.None ? DatTools.GetOutputFormat(filename, logger) : datdata.OutputFormat);
|
||||
|
||||
// Make sure there's a dictionary to read to
|
||||
if (datdata.Hashes == null)
|
||||
@@ -47,7 +48,7 @@ namespace SabreTools.Helper
|
||||
}
|
||||
|
||||
// Now parse the correct type of DAT
|
||||
switch (DatTools.GetOutputFormat(filename))
|
||||
switch (DatTools.GetOutputFormat(filename, logger))
|
||||
{
|
||||
case OutputFormat.ClrMamePro:
|
||||
return ParseCMP(filename, sysid, srcid, datdata, logger, keep, clean);
|
||||
@@ -74,17 +75,7 @@ namespace SabreTools.Helper
|
||||
/// <returns>DatData object representing the read-in data</returns>
|
||||
public static DatData ParseCMP(string filename, int sysid, int srcid, DatData datdata, Logger logger, bool keep, bool clean)
|
||||
{
|
||||
// Read the input file, if possible
|
||||
logger.Log("Attempting to read file: \"" + filename + "\"");
|
||||
|
||||
// Check if file exists
|
||||
if (!File.Exists(filename))
|
||||
{
|
||||
logger.Warning("File '" + filename + "' could not read from!");
|
||||
return datdata;
|
||||
}
|
||||
|
||||
// If it does, open a file reader
|
||||
// Open a file reader
|
||||
StreamReader sr = new StreamReader(File.OpenRead(filename));
|
||||
|
||||
bool block = false, superdat = false;
|
||||
|
||||
Reference in New Issue
Block a user