mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[ALL] Make Parse use the Dat as a ref
All cases where this was being used, it was being assigned back to the original datdata object. This is not necessary.
This commit is contained in:
@@ -358,7 +358,7 @@ namespace SabreTools
|
|||||||
{
|
{
|
||||||
// Parse the Dat if possible
|
// Parse the Dat if possible
|
||||||
Dat tempdat = new Dat();
|
Dat tempdat = new Dat();
|
||||||
tempdat = DatTools.Parse(toscan[key], 0, 0, tempdat, _logger);
|
DatTools.Parse(toscan[key], 0, 0, ref tempdat, _logger);
|
||||||
|
|
||||||
// If the Dat wasn't empty, add the information
|
// If the Dat wasn't empty, add the information
|
||||||
if (tempdat.Files.Count != 0)
|
if (tempdat.Files.Count != 0)
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ namespace SabreTools
|
|||||||
{
|
{
|
||||||
Int32.TryParse(sourcemap[hash], out tempSrcId);
|
Int32.TryParse(sourcemap[hash], out tempSrcId);
|
||||||
}
|
}
|
||||||
datdata = DatTools.Parse(file, 0, tempSrcId, datdata, _logger);
|
DatTools.Parse(file, 0, tempSrcId, ref datdata, _logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the dictionary is empty for any reason, tell the user and exit
|
// If the dictionary is empty for any reason, tell the user and exit
|
||||||
|
|||||||
@@ -367,7 +367,7 @@ namespace SabreTools
|
|||||||
|
|
||||||
// Get all roms that are found in the DAT to see what needs to be added
|
// Get all roms that are found in the DAT to see what needs to be added
|
||||||
Dat datdata = new Dat();
|
Dat datdata = new Dat();
|
||||||
datdata = DatTools.Parse(_filepath, sysid, srcid, datdata, _logger);
|
DatTools.Parse(_filepath, sysid, srcid, ref datdata, _logger);
|
||||||
|
|
||||||
// Sort inputted roms into games
|
// Sort inputted roms into games
|
||||||
SortedDictionary<string, List<Rom>> sortable = new SortedDictionary<string, List<Rom>>();
|
SortedDictionary<string, List<Rom>> sortable = new SortedDictionary<string, List<Rom>>();
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ namespace SabreTools.Helper
|
|||||||
_logger.Log("Beginning stat collection for '" + filename + "'");
|
_logger.Log("Beginning stat collection for '" + filename + "'");
|
||||||
List<String> games = new List<String>();
|
List<String> games = new List<String>();
|
||||||
Dat datdata = new Dat();
|
Dat datdata = new Dat();
|
||||||
datdata = DatTools.Parse(filename, 0, 0, datdata, _logger);
|
DatTools.Parse(filename, 0, 0, ref datdata, _logger);
|
||||||
SortedDictionary<string, List<Rom>> newroms = DatTools.BucketByGame(datdata.Files, false, true, _logger, false);
|
SortedDictionary<string, List<Rom>> newroms = DatTools.BucketByGame(datdata.Files, false, true, _logger, false);
|
||||||
|
|
||||||
// Output single DAT stats (if asked)
|
// Output single DAT stats (if asked)
|
||||||
|
|||||||
@@ -103,10 +103,9 @@ namespace SabreTools.Helper
|
|||||||
/// <param name="clean">True if game names are sanitized, false otherwise (default)</param>
|
/// <param name="clean">True if game names are sanitized, false otherwise (default)</param>
|
||||||
/// <param name="softlist">True if SL XML names should be kept, false otherwise (default)</param>
|
/// <param name="softlist">True if SL XML names should be kept, false otherwise (default)</param>
|
||||||
/// <param name="keepext">True if original extension should be kept, false otherwise (default)</param>
|
/// <param name="keepext">True if original extension should be kept, false otherwise (default)</param>
|
||||||
/// <returns>DatData object representing the read-in data</returns>
|
public static void Parse(string filename, int sysid, int srcid, ref Dat datdata, Logger logger, bool keep = false, bool clean = false, bool softlist = false, bool keepext = false)
|
||||||
public static Dat Parse(string filename, int sysid, int srcid, Dat datdata, Logger logger, bool keep = false, bool clean = false, bool softlist = false, bool keepext = false)
|
|
||||||
{
|
{
|
||||||
return Parse(filename, sysid, srcid, datdata, null, null, null, -1, -1, -1, null, null, null, null, false, false, "", logger, keep, clean, softlist, keepext);
|
Parse(filename, sysid, srcid, ref datdata, null, null, null, -1, -1, -1, null, null, null, null, false, false, "", logger, keep, clean, softlist, keepext);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -134,13 +133,12 @@ namespace SabreTools.Helper
|
|||||||
/// <param name="clean">True if game names are sanitized, false otherwise (default)</param>
|
/// <param name="clean">True if game names are sanitized, false otherwise (default)</param>
|
||||||
/// <param name="softlist">True if SL XML names should be kept, false otherwise (default)</param>
|
/// <param name="softlist">True if SL XML names should be kept, false otherwise (default)</param>
|
||||||
/// <param name="keepext">True if original extension should be kept, false otherwise (default)</param>
|
/// <param name="keepext">True if original extension should be kept, false otherwise (default)</param>
|
||||||
/// <returns>DatData object representing the read-in data</returns>
|
|
||||||
public static Dat Parse(
|
public static Dat Parse(
|
||||||
// Standard Dat parsing
|
// Standard Dat parsing
|
||||||
string filename,
|
string filename,
|
||||||
int sysid,
|
int sysid,
|
||||||
int srcid,
|
int srcid,
|
||||||
Dat datdata,
|
ref Dat datdata,
|
||||||
|
|
||||||
// Rom filtering
|
// Rom filtering
|
||||||
string gamename,
|
string gamename,
|
||||||
@@ -2271,7 +2269,7 @@ namespace SabreTools.Helper
|
|||||||
{
|
{
|
||||||
Dat innerDatdata = (Dat)datdata.CloneHeader();
|
Dat innerDatdata = (Dat)datdata.CloneHeader();
|
||||||
logger.User("Processing \"" + Path.GetFileName(inputFileName) + "\"");
|
logger.User("Processing \"" + Path.GetFileName(inputFileName) + "\"");
|
||||||
innerDatdata = Parse(inputFileName, 0, 0, innerDatdata, gamename, romname,
|
Parse(inputFileName, 0, 0, ref innerDatdata, gamename, romname,
|
||||||
romtype, sgt, slt, seq, crc, md5, sha1, nodump, trim, single,
|
romtype, sgt, slt, seq, crc, md5, sha1, nodump, trim, single,
|
||||||
root, logger, true, clean, softlist, keepext: (innerDatdata.XSV != null));
|
root, logger, true, clean, softlist, keepext: (innerDatdata.XSV != null));
|
||||||
|
|
||||||
@@ -2292,7 +2290,7 @@ namespace SabreTools.Helper
|
|||||||
logger.User("Processing \"" + Path.GetFullPath(file).Remove(0, inputFileName.Length) + "\"");
|
logger.User("Processing \"" + Path.GetFullPath(file).Remove(0, inputFileName.Length) + "\"");
|
||||||
Dat innerDatdata = (Dat)datdata.Clone();
|
Dat innerDatdata = (Dat)datdata.Clone();
|
||||||
innerDatdata.Files = null;
|
innerDatdata.Files = null;
|
||||||
innerDatdata = Parse(file, 0, 0, innerDatdata, gamename, romname, romtype, sgt,
|
Parse(file, 0, 0, ref innerDatdata, gamename, romname, romtype, sgt,
|
||||||
slt, seq, crc, md5, sha1, nodump, trim, single, root, logger, true, clean, keepext: (datdata.XSV != null));
|
slt, seq, crc, md5, sha1, nodump, trim, single, root, logger, true, clean, keepext: (datdata.XSV != null));
|
||||||
|
|
||||||
// If we have roms, output them
|
// If we have roms, output them
|
||||||
@@ -2357,7 +2355,7 @@ namespace SabreTools.Helper
|
|||||||
MergeRoms = inputDat.MergeRoms,
|
MergeRoms = inputDat.MergeRoms,
|
||||||
};
|
};
|
||||||
|
|
||||||
datHeaders[i] = Parse(input.Split('¬')[0], i, 0, datHeaders[i], gamename, romname, romtype, sgt, slt, seq,
|
Parse(input.Split('¬')[0], i, 0, ref datHeaders[i], gamename, romname, romtype, sgt, slt, seq,
|
||||||
crc, md5, sha1, nodump, trim, single, root, logger, true, clean, softlist);
|
crc, md5, sha1, nodump, trim, single, root, logger, true, clean, softlist);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -3417,7 +3415,7 @@ namespace SabreTools.Helper
|
|||||||
|
|
||||||
// Get the file data to be split
|
// Get the file data to be split
|
||||||
Dat datdata = new Dat();
|
Dat datdata = new Dat();
|
||||||
datdata = Parse(filename, 0, 0, datdata, logger, softlist:true);
|
Parse(filename, 0, 0, ref datdata, logger, softlist:true);
|
||||||
|
|
||||||
// Set all of the appropriate outputs for each of the subsets
|
// Set all of the appropriate outputs for each of the subsets
|
||||||
Dat datdataA = new Dat
|
Dat datdataA = new Dat
|
||||||
@@ -3555,7 +3553,7 @@ namespace SabreTools.Helper
|
|||||||
|
|
||||||
// Get the file data to be split
|
// Get the file data to be split
|
||||||
Dat datdata = new Dat();
|
Dat datdata = new Dat();
|
||||||
datdata = Parse(filename, 0, 0, datdata, logger, true, softlist:true);
|
Parse(filename, 0, 0, ref datdata, logger, true, softlist:true);
|
||||||
|
|
||||||
// Create each of the respective output DATs
|
// Create each of the respective output DATs
|
||||||
logger.User("Creating and populating new DATs");
|
logger.User("Creating and populating new DATs");
|
||||||
@@ -3769,7 +3767,7 @@ namespace SabreTools.Helper
|
|||||||
|
|
||||||
// Get the file data to be split
|
// Get the file data to be split
|
||||||
Dat datdata = new Dat();
|
Dat datdata = new Dat();
|
||||||
datdata = Parse(filename, 0, 0, datdata, logger, true, softlist:true);
|
Parse(filename, 0, 0, ref datdata, logger, true, softlist:true);
|
||||||
|
|
||||||
// Create each of the respective output DATs
|
// Create each of the respective output DATs
|
||||||
logger.User("Creating and populating new DATs");
|
logger.User("Creating and populating new DATs");
|
||||||
|
|||||||
@@ -387,7 +387,7 @@ namespace SabreTools
|
|||||||
Dat datdata = new Dat();
|
Dat datdata = new Dat();
|
||||||
foreach (string datfile in datfiles)
|
foreach (string datfile in datfiles)
|
||||||
{
|
{
|
||||||
datdata = DatTools.Parse(datfile, 99, 99, datdata, logger);
|
DatTools.Parse(datfile, 99, 99, ref datdata, logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
SimpleSort ss = new SimpleSort(datdata, inputs, outDir, tempDir, quickScan, toFolder, verify,
|
SimpleSort ss = new SimpleSort(datdata, inputs, outDir, tempDir, quickScan, toFolder, verify,
|
||||||
|
|||||||
@@ -254,7 +254,7 @@ namespace SabreTools
|
|||||||
Dat datdata = new Dat();
|
Dat datdata = new Dat();
|
||||||
foreach (string datfile in datfiles)
|
foreach (string datfile in datfiles)
|
||||||
{
|
{
|
||||||
datdata = DatTools.Parse(datfile, 99, 99, datdata, logger, keep: true, softlist: true);
|
DatTools.Parse(datfile, 99, 99, ref datdata, logger, keep: true, softlist: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
SimpleSort ss = new SimpleSort(datdata, inputs, outDir, tempDir, quickScan, toFolder, verify,
|
SimpleSort ss = new SimpleSort(datdata, inputs, outDir, tempDir, quickScan, toFolder, verify,
|
||||||
|
|||||||
Reference in New Issue
Block a user