mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Remove Field usage
This commit is contained in:
@@ -66,7 +66,7 @@ contents of any changed dats.";
|
|||||||
DatFile datroot = DatFile.Create();
|
DatFile datroot = DatFile.Create();
|
||||||
datroot.Header.Type = "SuperDAT";
|
datroot.Header.Type = "SuperDAT";
|
||||||
DatFromDir.PopulateFromDir(datroot, _dats, asFiles: TreatAsFile.NonArchive);
|
DatFromDir.PopulateFromDir(datroot, _dats, asFiles: TreatAsFile.NonArchive);
|
||||||
datroot.Items.BucketBy(Field.DatItem_SHA1, DedupeType.None);
|
datroot.Items.BucketBy(ItemKey.SHA1, DedupeType.None);
|
||||||
|
|
||||||
// Create a List of dat hashes in the database (SHA-1)
|
// Create a List of dat hashes in the database (SHA-1)
|
||||||
List<string> databaseDats = new List<string>();
|
List<string> databaseDats = new List<string>();
|
||||||
@@ -96,7 +96,7 @@ contents of any changed dats.";
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
datroot.Items.BucketBy(Field.Machine_Name, DedupeType.None, norename: true);
|
datroot.Items.BucketBy(ItemKey.Machine, DedupeType.None, norename: true);
|
||||||
|
|
||||||
watch.Stop();
|
watch.Stop();
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ namespace RombaSharp.Features
|
|||||||
// Now rescan the depot itself
|
// Now rescan the depot itself
|
||||||
DatFile depot = DatFile.Create();
|
DatFile depot = DatFile.Create();
|
||||||
DatFromDir.PopulateFromDir(depot, depotname, asFiles: TreatAsFile.NonArchive);
|
DatFromDir.PopulateFromDir(depot, depotname, asFiles: TreatAsFile.NonArchive);
|
||||||
depot.Items.BucketBy(Field.DatItem_SHA1, DedupeType.None);
|
depot.Items.BucketBy(ItemKey.SHA1, DedupeType.None);
|
||||||
|
|
||||||
// Set the base queries to use
|
// Set the base queries to use
|
||||||
string crcquery = "INSERT OR IGNORE INTO crc (crc) VALUES";
|
string crcquery = "INSERT OR IGNORE INTO crc (crc) VALUES";
|
||||||
|
|||||||
@@ -446,339 +446,6 @@ namespace SabreTools.Core
|
|||||||
|
|
||||||
#region Fields
|
#region Fields
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// List of valid field types within a DatFile
|
|
||||||
/// </summary>
|
|
||||||
/// TODO: Remove this in lieu of individual Field enums
|
|
||||||
public enum Field : int
|
|
||||||
{
|
|
||||||
NULL = 0,
|
|
||||||
|
|
||||||
#region DatHeader
|
|
||||||
|
|
||||||
#region Common
|
|
||||||
|
|
||||||
DatHeader_FileName,
|
|
||||||
DatHeader_Name,
|
|
||||||
DatHeader_Description,
|
|
||||||
DatHeader_RootDir,
|
|
||||||
DatHeader_Category,
|
|
||||||
DatHeader_Version,
|
|
||||||
DatHeader_Date,
|
|
||||||
DatHeader_Author,
|
|
||||||
DatHeader_Email,
|
|
||||||
DatHeader_Homepage,
|
|
||||||
DatHeader_Url,
|
|
||||||
DatHeader_Comment,
|
|
||||||
DatHeader_HeaderSkipper,
|
|
||||||
DatHeader_Type,
|
|
||||||
DatHeader_ForceMerging,
|
|
||||||
DatHeader_ForceNodump,
|
|
||||||
DatHeader_ForcePacking,
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region ListXML
|
|
||||||
|
|
||||||
DatHeader_Debug,
|
|
||||||
DatHeader_MameConfig,
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Logiqx
|
|
||||||
|
|
||||||
DatHeader_Build,
|
|
||||||
DatHeader_RomMode,
|
|
||||||
DatHeader_BiosMode,
|
|
||||||
DatHeader_SampleMode,
|
|
||||||
DatHeader_LockRomMode,
|
|
||||||
DatHeader_LockBiosMode,
|
|
||||||
DatHeader_LockSampleMode,
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region OfflineList
|
|
||||||
|
|
||||||
DatHeader_System,
|
|
||||||
DatHeader_ScreenshotsWidth,
|
|
||||||
DatHeader_ScreenshotsHeight,
|
|
||||||
DatHeader_CanOpen,
|
|
||||||
DatHeader_RomTitle,
|
|
||||||
|
|
||||||
// Infos
|
|
||||||
DatHeader_Info_Name,
|
|
||||||
DatHeader_Info_Visible,
|
|
||||||
DatHeader_Info_IsNamingOption,
|
|
||||||
DatHeader_Info_Default,
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region RomCenter
|
|
||||||
|
|
||||||
DatHeader_RomCenterVersion,
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#endregion // DatHeader
|
|
||||||
|
|
||||||
#region Machine
|
|
||||||
|
|
||||||
#region Common
|
|
||||||
|
|
||||||
Machine_Name,
|
|
||||||
Machine_Comment,
|
|
||||||
Machine_Description,
|
|
||||||
Machine_Year,
|
|
||||||
Machine_Manufacturer,
|
|
||||||
Machine_Publisher,
|
|
||||||
Machine_Category,
|
|
||||||
Machine_RomOf,
|
|
||||||
Machine_CloneOf,
|
|
||||||
Machine_SampleOf,
|
|
||||||
Machine_Type,
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region AttractMode
|
|
||||||
|
|
||||||
Machine_Players,
|
|
||||||
Machine_Rotation,
|
|
||||||
Machine_Control,
|
|
||||||
Machine_Status,
|
|
||||||
Machine_DisplayCount,
|
|
||||||
Machine_DisplayType,
|
|
||||||
Machine_Buttons,
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region ListXML
|
|
||||||
|
|
||||||
Machine_SourceFile,
|
|
||||||
Machine_Runnable,
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Logiqx
|
|
||||||
|
|
||||||
Machine_Board,
|
|
||||||
Machine_RebuildTo,
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Logiqx EmuArc
|
|
||||||
|
|
||||||
Machine_TitleID,
|
|
||||||
Machine_Developer,
|
|
||||||
Machine_Genre,
|
|
||||||
Machine_Subgenre,
|
|
||||||
Machine_Ratings,
|
|
||||||
Machine_Score,
|
|
||||||
Machine_Enabled,
|
|
||||||
Machine_CRC,
|
|
||||||
Machine_RelatedTo,
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region OpenMSX
|
|
||||||
|
|
||||||
Machine_GenMSXID,
|
|
||||||
Machine_System,
|
|
||||||
Machine_Country,
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region SoftwareList
|
|
||||||
|
|
||||||
Machine_Supported,
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#endregion // Machine
|
|
||||||
|
|
||||||
#region DatItem
|
|
||||||
|
|
||||||
#region Common
|
|
||||||
|
|
||||||
DatItem_Type,
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Item-Specific
|
|
||||||
|
|
||||||
#region Actionable
|
|
||||||
|
|
||||||
// Rom
|
|
||||||
DatItem_Name,
|
|
||||||
DatItem_Bios,
|
|
||||||
DatItem_Size,
|
|
||||||
DatItem_CRC,
|
|
||||||
DatItem_MD5,
|
|
||||||
DatItem_SHA1,
|
|
||||||
DatItem_SHA256,
|
|
||||||
DatItem_SHA384,
|
|
||||||
DatItem_SHA512,
|
|
||||||
DatItem_SpamSum,
|
|
||||||
DatItem_Merge,
|
|
||||||
DatItem_Region,
|
|
||||||
DatItem_Offset,
|
|
||||||
DatItem_Date,
|
|
||||||
DatItem_Status,
|
|
||||||
DatItem_Optional,
|
|
||||||
DatItem_Inverted,
|
|
||||||
|
|
||||||
// Rom (AttractMode)
|
|
||||||
DatItem_AltName,
|
|
||||||
DatItem_AltTitle,
|
|
||||||
|
|
||||||
// Rom (OpenMSX)
|
|
||||||
DatItem_Original,
|
|
||||||
DatItem_OpenMSXSubType,
|
|
||||||
DatItem_OpenMSXType,
|
|
||||||
DatItem_Remark,
|
|
||||||
DatItem_Boot,
|
|
||||||
|
|
||||||
// Rom (SoftwareList)
|
|
||||||
DatItem_LoadFlag,
|
|
||||||
DatItem_Value,
|
|
||||||
|
|
||||||
// Disk
|
|
||||||
DatItem_Index,
|
|
||||||
DatItem_Writable,
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Auxiliary
|
|
||||||
|
|
||||||
// Adjuster
|
|
||||||
DatItem_Default,
|
|
||||||
|
|
||||||
// Analog
|
|
||||||
DatItem_Analog_Mask,
|
|
||||||
|
|
||||||
// BiosSet
|
|
||||||
DatItem_Description,
|
|
||||||
|
|
||||||
// Chip
|
|
||||||
DatItem_Tag,
|
|
||||||
DatItem_ChipType,
|
|
||||||
DatItem_Clock,
|
|
||||||
|
|
||||||
// Condition
|
|
||||||
DatItem_Mask,
|
|
||||||
DatItem_Relation,
|
|
||||||
DatItem_Condition_Tag,
|
|
||||||
DatItem_Condition_Mask,
|
|
||||||
DatItem_Condition_Relation,
|
|
||||||
DatItem_Condition_Value,
|
|
||||||
|
|
||||||
// Control
|
|
||||||
DatItem_Control_Type,
|
|
||||||
DatItem_Control_Player,
|
|
||||||
DatItem_Control_Buttons,
|
|
||||||
DatItem_Control_RequiredButtons,
|
|
||||||
DatItem_Control_Minimum,
|
|
||||||
DatItem_Control_Maximum,
|
|
||||||
DatItem_Control_Sensitivity,
|
|
||||||
DatItem_Control_KeyDelta,
|
|
||||||
DatItem_Control_Reverse,
|
|
||||||
DatItem_Control_Ways,
|
|
||||||
DatItem_Control_Ways2,
|
|
||||||
DatItem_Control_Ways3,
|
|
||||||
|
|
||||||
// DataArea
|
|
||||||
DatItem_AreaName,
|
|
||||||
DatItem_AreaSize,
|
|
||||||
DatItem_AreaWidth,
|
|
||||||
DatItem_AreaEndianness,
|
|
||||||
|
|
||||||
// Device
|
|
||||||
DatItem_DeviceType,
|
|
||||||
DatItem_FixedImage,
|
|
||||||
DatItem_Mandatory,
|
|
||||||
DatItem_Interface,
|
|
||||||
|
|
||||||
// Display
|
|
||||||
DatItem_DisplayType,
|
|
||||||
DatItem_Rotate,
|
|
||||||
DatItem_FlipX,
|
|
||||||
DatItem_Width,
|
|
||||||
DatItem_Height,
|
|
||||||
DatItem_Refresh,
|
|
||||||
DatItem_PixClock,
|
|
||||||
DatItem_HTotal,
|
|
||||||
DatItem_HBEnd,
|
|
||||||
DatItem_HBStart,
|
|
||||||
DatItem_VTotal,
|
|
||||||
DatItem_VBEnd,
|
|
||||||
DatItem_VBStart,
|
|
||||||
|
|
||||||
// Driver
|
|
||||||
DatItem_SupportStatus,
|
|
||||||
DatItem_EmulationStatus,
|
|
||||||
DatItem_CocktailStatus,
|
|
||||||
DatItem_SaveStateStatus,
|
|
||||||
|
|
||||||
// Extension
|
|
||||||
DatItem_Extension_Name,
|
|
||||||
|
|
||||||
// Feature
|
|
||||||
DatItem_FeatureType,
|
|
||||||
DatItem_FeatureStatus,
|
|
||||||
DatItem_FeatureOverall,
|
|
||||||
|
|
||||||
// Input
|
|
||||||
DatItem_Service,
|
|
||||||
DatItem_Tilt,
|
|
||||||
DatItem_Players,
|
|
||||||
DatItem_Coins,
|
|
||||||
|
|
||||||
// Instance
|
|
||||||
DatItem_Instance_Name,
|
|
||||||
DatItem_Instance_BriefName,
|
|
||||||
|
|
||||||
// Location
|
|
||||||
DatItem_Location_Name,
|
|
||||||
DatItem_Location_Number,
|
|
||||||
DatItem_Location_Inverted,
|
|
||||||
|
|
||||||
// Part
|
|
||||||
DatItem_Part_Name,
|
|
||||||
DatItem_Part_Interface,
|
|
||||||
|
|
||||||
// PartFeature
|
|
||||||
DatItem_Part_Feature_Name,
|
|
||||||
DatItem_Part_Feature_Value,
|
|
||||||
|
|
||||||
// RamOption
|
|
||||||
DatItem_Content,
|
|
||||||
|
|
||||||
// Release
|
|
||||||
DatItem_Language,
|
|
||||||
|
|
||||||
// Setting
|
|
||||||
DatItem_Setting_Name,
|
|
||||||
DatItem_Setting_Value,
|
|
||||||
DatItem_Setting_Default,
|
|
||||||
|
|
||||||
// SlotOption
|
|
||||||
DatItem_SlotOption_Name,
|
|
||||||
DatItem_SlotOption_DeviceName,
|
|
||||||
DatItem_SlotOption_Default,
|
|
||||||
|
|
||||||
// SoftwareList
|
|
||||||
DatItem_SoftwareListStatus,
|
|
||||||
DatItem_Filter,
|
|
||||||
|
|
||||||
// Sound
|
|
||||||
DatItem_Channels,
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#endregion // Item-Specific
|
|
||||||
|
|
||||||
#endregion // DatItem
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// List of valid field types within a DatHeader
|
/// List of valid field types within a DatHeader
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -44,8 +44,8 @@ namespace SabreTools.DatTools
|
|||||||
if (datItemFields.Any())
|
if (datItemFields.Any())
|
||||||
{
|
{
|
||||||
// For comparison's sake, we want to use CRC as the base bucketing
|
// For comparison's sake, we want to use CRC as the base bucketing
|
||||||
datFile.Items.BucketBy(Field.DatItem_CRC, DedupeType.Full);
|
datFile.Items.BucketBy(ItemKey.CRC, DedupeType.Full);
|
||||||
intDat.Items.BucketBy(Field.DatItem_CRC, DedupeType.None);
|
intDat.Items.BucketBy(ItemKey.CRC, DedupeType.None);
|
||||||
|
|
||||||
// Then we do a hashwise comparison against the base DAT
|
// Then we do a hashwise comparison against the base DAT
|
||||||
Parallel.ForEach(intDat.Items.Keys, Globals.ParallelOptions, key =>
|
Parallel.ForEach(intDat.Items.Keys, Globals.ParallelOptions, key =>
|
||||||
@@ -74,8 +74,8 @@ namespace SabreTools.DatTools
|
|||||||
if (machineFields.Any())
|
if (machineFields.Any())
|
||||||
{
|
{
|
||||||
// For comparison's sake, we want to use Machine Name as the base bucketing
|
// For comparison's sake, we want to use Machine Name as the base bucketing
|
||||||
datFile.Items.BucketBy(Field.Machine_Name, DedupeType.Full);
|
datFile.Items.BucketBy(ItemKey.Machine, DedupeType.Full);
|
||||||
intDat.Items.BucketBy(Field.Machine_Name, DedupeType.None);
|
intDat.Items.BucketBy(ItemKey.Machine, DedupeType.None);
|
||||||
|
|
||||||
// Then we do a namewise comparison against the base DAT
|
// Then we do a namewise comparison against the base DAT
|
||||||
Parallel.ForEach(intDat.Items.Keys, Globals.ParallelOptions, key =>
|
Parallel.ForEach(intDat.Items.Keys, Globals.ParallelOptions, key =>
|
||||||
@@ -108,17 +108,17 @@ namespace SabreTools.DatTools
|
|||||||
{
|
{
|
||||||
// For comparison's sake, we want to use a base ordering
|
// For comparison's sake, we want to use a base ordering
|
||||||
if (useGames)
|
if (useGames)
|
||||||
datFile.Items.BucketBy(Field.Machine_Name, DedupeType.None);
|
datFile.Items.BucketBy(ItemKey.Machine, DedupeType.None);
|
||||||
else
|
else
|
||||||
datFile.Items.BucketBy(Field.DatItem_CRC, DedupeType.None);
|
datFile.Items.BucketBy(ItemKey.CRC, DedupeType.None);
|
||||||
|
|
||||||
logger.User($"Comparing '{intDat.Header.FileName}' to base DAT");
|
logger.User($"Comparing '{intDat.Header.FileName}' to base DAT");
|
||||||
|
|
||||||
// For comparison's sake, we want to a the base bucketing
|
// For comparison's sake, we want to a the base bucketing
|
||||||
if (useGames)
|
if (useGames)
|
||||||
intDat.Items.BucketBy(Field.Machine_Name, DedupeType.None);
|
intDat.Items.BucketBy(ItemKey.Machine, DedupeType.None);
|
||||||
else
|
else
|
||||||
intDat.Items.BucketBy(Field.DatItem_CRC, DedupeType.Full);
|
intDat.Items.BucketBy(ItemKey.CRC, DedupeType.Full);
|
||||||
|
|
||||||
// Then we compare against the base DAT
|
// Then we compare against the base DAT
|
||||||
List<string> keys = intDat.Items.Keys.ToList();
|
List<string> keys = intDat.Items.Keys.ToList();
|
||||||
@@ -182,7 +182,7 @@ namespace SabreTools.DatTools
|
|||||||
List<DatFile> outDats = new List<DatFile>();
|
List<DatFile> outDats = new List<DatFile>();
|
||||||
|
|
||||||
// Ensure the current DatFile is sorted optimally
|
// Ensure the current DatFile is sorted optimally
|
||||||
datFile.Items.BucketBy(Field.DatItem_CRC, DedupeType.None);
|
datFile.Items.BucketBy(ItemKey.CRC, DedupeType.None);
|
||||||
|
|
||||||
// Loop through each of the inputs and get or create a new DatData object
|
// Loop through each of the inputs and get or create a new DatData object
|
||||||
InternalStopwatch watch = new InternalStopwatch("Initializing and filling all output DATs");
|
InternalStopwatch watch = new InternalStopwatch("Initializing and filling all output DATs");
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ namespace SabreTools.DatTools
|
|||||||
{
|
{
|
||||||
// Add the list if it doesn't exist already
|
// Add the list if it doesn't exist already
|
||||||
Rom rom = new Rom(baseFile);
|
Rom rom = new Rom(baseFile);
|
||||||
datFile.Items.Add(rom.GetKey(Field.DatItem_CRC), rom);
|
datFile.Items.Add(rom.GetKey(ItemKey.CRC), rom);
|
||||||
logger.Verbose($"File added: {Path.GetFileNameWithoutExtension(item)}");
|
logger.Verbose($"File added: {Path.GetFileNameWithoutExtension(item)}");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -43,9 +43,9 @@ namespace SabreTools.DatTools
|
|||||||
|
|
||||||
// Bucket and dedupe according to the flag
|
// Bucket and dedupe according to the flag
|
||||||
if (cleaner?.DedupeRoms == DedupeType.Full)
|
if (cleaner?.DedupeRoms == DedupeType.Full)
|
||||||
datFile.Items.BucketBy(Field.DatItem_CRC, cleaner.DedupeRoms);
|
datFile.Items.BucketBy(ItemKey.CRC, cleaner.DedupeRoms);
|
||||||
else if (cleaner?.DedupeRoms == DedupeType.Game)
|
else if (cleaner?.DedupeRoms == DedupeType.Game)
|
||||||
datFile.Items.BucketBy(Field.Machine_Name, cleaner.DedupeRoms);
|
datFile.Items.BucketBy(ItemKey.Machine, cleaner.DedupeRoms);
|
||||||
|
|
||||||
// Process description to machine name
|
// Process description to machine name
|
||||||
if (cleaner?.DescriptionAsName == true)
|
if (cleaner?.DescriptionAsName == true)
|
||||||
@@ -99,7 +99,7 @@ namespace SabreTools.DatTools
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Bucket by game first
|
// Bucket by game first
|
||||||
datFile.Items.BucketBy(Field.Machine_Name, DedupeType.None);
|
datFile.Items.BucketBy(ItemKey.Machine, DedupeType.None);
|
||||||
|
|
||||||
// Create a new set of mappings based on the items
|
// Create a new set of mappings based on the items
|
||||||
var machineMap = new Dictionary<string, Dictionary<MachineField, string>>();
|
var machineMap = new Dictionary<string, Dictionary<MachineField, string>>();
|
||||||
@@ -192,7 +192,7 @@ namespace SabreTools.DatTools
|
|||||||
|
|
||||||
// If we're filtering per machine, bucket by machine first
|
// If we're filtering per machine, bucket by machine first
|
||||||
if (perMachine)
|
if (perMachine)
|
||||||
datFile.Items.BucketBy(Field.Machine_Name, DedupeType.None);
|
datFile.Items.BucketBy(ItemKey.Machine, DedupeType.None);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -415,7 +415,7 @@ namespace SabreTools.DatTools
|
|||||||
regions = new List<string>();
|
regions = new List<string>();
|
||||||
|
|
||||||
// For sake of ease, the first thing we want to do is bucket by game
|
// For sake of ease, the first thing we want to do is bucket by game
|
||||||
datFile.Items.BucketBy(Field.Machine_Name, DedupeType.None, norename: true);
|
datFile.Items.BucketBy(ItemKey.Machine, DedupeType.None, norename: true);
|
||||||
|
|
||||||
// Then we want to get a mapping of all machines to parents
|
// Then we want to get a mapping of all machines to parents
|
||||||
Dictionary<string, List<string>> parents = new Dictionary<string, List<string>>();
|
Dictionary<string, List<string>> parents = new Dictionary<string, List<string>>();
|
||||||
@@ -610,7 +610,7 @@ namespace SabreTools.DatTools
|
|||||||
logger.User("Creating device non-merged sets from the DAT");
|
logger.User("Creating device non-merged sets from the DAT");
|
||||||
|
|
||||||
// For sake of ease, the first thing we want to do is bucket by game
|
// For sake of ease, the first thing we want to do is bucket by game
|
||||||
datFile.Items.BucketBy(Field.Machine_Name, mergeroms, norename: true);
|
datFile.Items.BucketBy(ItemKey.Machine, mergeroms, norename: true);
|
||||||
|
|
||||||
// Now we want to loop through all of the games and set the correct information
|
// Now we want to loop through all of the games and set the correct information
|
||||||
while (AddRomsFromDevices(datFile, false, false)) ;
|
while (AddRomsFromDevices(datFile, false, false)) ;
|
||||||
@@ -630,7 +630,7 @@ namespace SabreTools.DatTools
|
|||||||
logger.User("Creating fully non-merged sets from the DAT");
|
logger.User("Creating fully non-merged sets from the DAT");
|
||||||
|
|
||||||
// For sake of ease, the first thing we want to do is bucket by game
|
// For sake of ease, the first thing we want to do is bucket by game
|
||||||
datFile.Items.BucketBy(Field.Machine_Name, mergeroms, norename: true);
|
datFile.Items.BucketBy(ItemKey.Machine, mergeroms, norename: true);
|
||||||
|
|
||||||
// Now we want to loop through all of the games and set the correct information
|
// Now we want to loop through all of the games and set the correct information
|
||||||
while (AddRomsFromDevices(datFile, true, true)) ;
|
while (AddRomsFromDevices(datFile, true, true)) ;
|
||||||
@@ -654,7 +654,7 @@ namespace SabreTools.DatTools
|
|||||||
logger.User("Creating merged sets from the DAT");
|
logger.User("Creating merged sets from the DAT");
|
||||||
|
|
||||||
// For sake of ease, the first thing we want to do is bucket by game
|
// For sake of ease, the first thing we want to do is bucket by game
|
||||||
datFile.Items.BucketBy(Field.Machine_Name, mergeroms, norename: true);
|
datFile.Items.BucketBy(ItemKey.Machine, mergeroms, norename: true);
|
||||||
|
|
||||||
// Now we want to loop through all of the games and set the correct information
|
// Now we want to loop through all of the games and set the correct information
|
||||||
AddRomsFromChildren(datFile);
|
AddRomsFromChildren(datFile);
|
||||||
@@ -677,7 +677,7 @@ namespace SabreTools.DatTools
|
|||||||
logger.User("Creating non-merged sets from the DAT");
|
logger.User("Creating non-merged sets from the DAT");
|
||||||
|
|
||||||
// For sake of ease, the first thing we want to do is bucket by game
|
// For sake of ease, the first thing we want to do is bucket by game
|
||||||
datFile.Items.BucketBy(Field.Machine_Name, mergeroms, norename: true);
|
datFile.Items.BucketBy(ItemKey.Machine, mergeroms, norename: true);
|
||||||
|
|
||||||
// Now we want to loop through all of the games and set the correct information
|
// Now we want to loop through all of the games and set the correct information
|
||||||
AddRomsFromParent(datFile);
|
AddRomsFromParent(datFile);
|
||||||
@@ -700,7 +700,7 @@ namespace SabreTools.DatTools
|
|||||||
logger.User("Creating split sets from the DAT");
|
logger.User("Creating split sets from the DAT");
|
||||||
|
|
||||||
// For sake of ease, the first thing we want to do is bucket by game
|
// For sake of ease, the first thing we want to do is bucket by game
|
||||||
datFile.Items.BucketBy(Field.Machine_Name, mergeroms, norename: true);
|
datFile.Items.BucketBy(ItemKey.Machine, mergeroms, norename: true);
|
||||||
|
|
||||||
// Now we want to loop through all of the games and set the correct information
|
// Now we want to loop through all of the games and set the correct information
|
||||||
RemoveRomsFromChild(datFile);
|
RemoveRomsFromChild(datFile);
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ using System;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
using SabreTools.Core;
|
|
||||||
using SabreTools.Core.Tools;
|
using SabreTools.Core.Tools;
|
||||||
using SabreTools.DatFiles;
|
using SabreTools.DatFiles;
|
||||||
|
using SabreTools.DatItems;
|
||||||
using SabreTools.IO;
|
using SabreTools.IO;
|
||||||
using SabreTools.Logging;
|
using SabreTools.Logging;
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@ namespace SabreTools.DatTools
|
|||||||
// If the output type isn't set already, get the internal output type
|
// If the output type isn't set already, get the internal output type
|
||||||
DatFormat currentPathFormat = GetDatFormat(currentPath);
|
DatFormat currentPathFormat = GetDatFormat(currentPath);
|
||||||
datFile.Header.DatFormat = datFile.Header.DatFormat == 0 ? currentPathFormat : datFile.Header.DatFormat;
|
datFile.Header.DatFormat = datFile.Header.DatFormat == 0 ? currentPathFormat : datFile.Header.DatFormat;
|
||||||
datFile.Items.SetBucketedBy(Field.DatItem_CRC); // Setting this because it can reduce issues later
|
datFile.Items.SetBucketedBy(ItemKey.CRC); // Setting this because it can reduce issues later
|
||||||
|
|
||||||
// Now parse the correct type of DAT
|
// Now parse the correct type of DAT
|
||||||
try
|
try
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ namespace SabreTools.DatTools
|
|||||||
return success;
|
return success;
|
||||||
|
|
||||||
// Now that we have a list of depots, we want to bucket the input DAT by SHA-1
|
// Now that we have a list of depots, we want to bucket the input DAT by SHA-1
|
||||||
datFile.Items.BucketBy(Field.DatItem_SHA1, DedupeType.None);
|
datFile.Items.BucketBy(ItemKey.SHA1, DedupeType.None);
|
||||||
|
|
||||||
// Then we want to loop through each of the hashes and see if we can rebuild
|
// Then we want to loop through each of the hashes and see if we can rebuild
|
||||||
var keys = datFile.Items.SortedKeys.ToList();
|
var keys = datFile.Items.SortedKeys.ToList();
|
||||||
@@ -131,7 +131,7 @@ namespace SabreTools.DatTools
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Ensure we are sorted correctly (some other calls can change this)
|
// Ensure we are sorted correctly (some other calls can change this)
|
||||||
datFile.Items.BucketBy(Field.DatItem_SHA1, DedupeType.None);
|
datFile.Items.BucketBy(ItemKey.SHA1, DedupeType.None);
|
||||||
|
|
||||||
// If there are no items in the hash, we continue
|
// If there are no items in the hash, we continue
|
||||||
if (datFile.Items[hash] == null || datFile.Items[hash].Count == 0)
|
if (datFile.Items[hash] == null || datFile.Items[hash].Count == 0)
|
||||||
@@ -390,7 +390,7 @@ namespace SabreTools.DatTools
|
|||||||
if (outputFormat == OutputFormat.Folder && datFile.Header.ForcePacking == PackingFlag.Partial)
|
if (outputFormat == OutputFormat.Folder && datFile.Header.ForcePacking == PackingFlag.Partial)
|
||||||
{
|
{
|
||||||
shouldCheck = true;
|
shouldCheck = true;
|
||||||
datFile.Items.BucketBy(Field.Machine_Name, DedupeType.None, lower: false);
|
datFile.Items.BucketBy(ItemKey.Machine, DedupeType.None, lower: false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now loop through the list and rebuild accordingly
|
// Now loop through the list and rebuild accordingly
|
||||||
|
|||||||
@@ -89,54 +89,54 @@ namespace SabreTools.DatTools
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="datFile">Current DatFile object to split</param>
|
/// <param name="datFile">Current DatFile object to split</param>
|
||||||
/// <returns>Dictionary of Field to DatFile mappings</returns>
|
/// <returns>Dictionary of Field to DatFile mappings</returns>
|
||||||
public static Dictionary<Field, DatFile> SplitByHash(DatFile datFile)
|
public static Dictionary<DatItemField, DatFile> SplitByHash(DatFile datFile)
|
||||||
{
|
{
|
||||||
// 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");
|
||||||
|
|
||||||
// Create the set of field-to-dat mappings
|
// Create the set of field-to-dat mappings
|
||||||
Dictionary<Field, DatFile> fieldDats = new Dictionary<Field, DatFile>();
|
Dictionary<DatItemField, DatFile> fieldDats = new Dictionary<DatItemField, DatFile>();
|
||||||
|
|
||||||
// TODO: Can this be made into a loop?
|
// TODO: Can this be made into a loop?
|
||||||
fieldDats[Field.DatItem_Status] = DatFile.Create(datFile.Header.CloneStandard());
|
fieldDats[DatItemField.Status] = DatFile.Create(datFile.Header.CloneStandard());
|
||||||
fieldDats[Field.DatItem_Status].Header.FileName += " (Nodump)";
|
fieldDats[DatItemField.Status].Header.FileName += " (Nodump)";
|
||||||
fieldDats[Field.DatItem_Status].Header.Name += " (Nodump)";
|
fieldDats[DatItemField.Status].Header.Name += " (Nodump)";
|
||||||
fieldDats[Field.DatItem_Status].Header.Description += " (Nodump)";
|
fieldDats[DatItemField.Status].Header.Description += " (Nodump)";
|
||||||
|
|
||||||
fieldDats[Field.DatItem_SHA512] = DatFile.Create(datFile.Header.CloneStandard());
|
fieldDats[DatItemField.SHA512] = DatFile.Create(datFile.Header.CloneStandard());
|
||||||
fieldDats[Field.DatItem_SHA512].Header.FileName += " (SHA-512)";
|
fieldDats[DatItemField.SHA512].Header.FileName += " (SHA-512)";
|
||||||
fieldDats[Field.DatItem_SHA512].Header.Name += " (SHA-512)";
|
fieldDats[DatItemField.SHA512].Header.Name += " (SHA-512)";
|
||||||
fieldDats[Field.DatItem_SHA512].Header.Description += " (SHA-512)";
|
fieldDats[DatItemField.SHA512].Header.Description += " (SHA-512)";
|
||||||
|
|
||||||
fieldDats[Field.DatItem_SHA384] = DatFile.Create(datFile.Header.CloneStandard());
|
fieldDats[DatItemField.SHA384] = DatFile.Create(datFile.Header.CloneStandard());
|
||||||
fieldDats[Field.DatItem_SHA384].Header.FileName += " (SHA-384)";
|
fieldDats[DatItemField.SHA384].Header.FileName += " (SHA-384)";
|
||||||
fieldDats[Field.DatItem_SHA384].Header.Name += " (SHA-384)";
|
fieldDats[DatItemField.SHA384].Header.Name += " (SHA-384)";
|
||||||
fieldDats[Field.DatItem_SHA384].Header.Description += " (SHA-384)";
|
fieldDats[DatItemField.SHA384].Header.Description += " (SHA-384)";
|
||||||
|
|
||||||
fieldDats[Field.DatItem_SHA256] = DatFile.Create(datFile.Header.CloneStandard());
|
fieldDats[DatItemField.SHA256] = DatFile.Create(datFile.Header.CloneStandard());
|
||||||
fieldDats[Field.DatItem_SHA256].Header.FileName += " (SHA-256)";
|
fieldDats[DatItemField.SHA256].Header.FileName += " (SHA-256)";
|
||||||
fieldDats[Field.DatItem_SHA256].Header.Name += " (SHA-256)";
|
fieldDats[DatItemField.SHA256].Header.Name += " (SHA-256)";
|
||||||
fieldDats[Field.DatItem_SHA256].Header.Description += " (SHA-256)";
|
fieldDats[DatItemField.SHA256].Header.Description += " (SHA-256)";
|
||||||
|
|
||||||
fieldDats[Field.DatItem_SHA1] = DatFile.Create(datFile.Header.CloneStandard());
|
fieldDats[DatItemField.SHA1] = DatFile.Create(datFile.Header.CloneStandard());
|
||||||
fieldDats[Field.DatItem_SHA1].Header.FileName += " (SHA-1)";
|
fieldDats[DatItemField.SHA1].Header.FileName += " (SHA-1)";
|
||||||
fieldDats[Field.DatItem_SHA1].Header.Name += " (SHA-1)";
|
fieldDats[DatItemField.SHA1].Header.Name += " (SHA-1)";
|
||||||
fieldDats[Field.DatItem_SHA1].Header.Description += " (SHA-1)";
|
fieldDats[DatItemField.SHA1].Header.Description += " (SHA-1)";
|
||||||
|
|
||||||
fieldDats[Field.DatItem_MD5] = DatFile.Create(datFile.Header.CloneStandard());
|
fieldDats[DatItemField.MD5] = DatFile.Create(datFile.Header.CloneStandard());
|
||||||
fieldDats[Field.DatItem_MD5].Header.FileName += " (MD5)";
|
fieldDats[DatItemField.MD5].Header.FileName += " (MD5)";
|
||||||
fieldDats[Field.DatItem_MD5].Header.Name += " (MD5)";
|
fieldDats[DatItemField.MD5].Header.Name += " (MD5)";
|
||||||
fieldDats[Field.DatItem_MD5].Header.Description += " (MD5)";
|
fieldDats[DatItemField.MD5].Header.Description += " (MD5)";
|
||||||
|
|
||||||
fieldDats[Field.DatItem_CRC] = DatFile.Create(datFile.Header.CloneStandard());
|
fieldDats[DatItemField.CRC] = DatFile.Create(datFile.Header.CloneStandard());
|
||||||
fieldDats[Field.DatItem_CRC].Header.FileName += " (CRC)";
|
fieldDats[DatItemField.CRC].Header.FileName += " (CRC)";
|
||||||
fieldDats[Field.DatItem_CRC].Header.Name += " (CRC)";
|
fieldDats[DatItemField.CRC].Header.Name += " (CRC)";
|
||||||
fieldDats[Field.DatItem_CRC].Header.Description += " (CRC)";
|
fieldDats[DatItemField.CRC].Header.Description += " (CRC)";
|
||||||
|
|
||||||
fieldDats[Field.NULL] = DatFile.Create(datFile.Header.CloneStandard());
|
fieldDats[DatItemField.NULL] = DatFile.Create(datFile.Header.CloneStandard());
|
||||||
fieldDats[Field.NULL].Header.FileName += " (Other)";
|
fieldDats[DatItemField.NULL].Header.FileName += " (Other)";
|
||||||
fieldDats[Field.NULL].Header.Name += " (Other)";
|
fieldDats[DatItemField.NULL].Header.Name += " (Other)";
|
||||||
fieldDats[Field.NULL].Header.Description += " (Other)";
|
fieldDats[DatItemField.NULL].Header.Description += " (Other)";
|
||||||
|
|
||||||
// Now populate each of the DAT objects in turn
|
// Now populate each of the DAT objects in turn
|
||||||
Parallel.ForEach(datFile.Items.Keys, Globals.ParallelOptions, key =>
|
Parallel.ForEach(datFile.Items.Keys, Globals.ParallelOptions, key =>
|
||||||
@@ -152,26 +152,26 @@ namespace SabreTools.DatTools
|
|||||||
if ((item.ItemType == ItemType.Rom && (item as Rom).ItemStatus == ItemStatus.Nodump)
|
if ((item.ItemType == ItemType.Rom && (item as Rom).ItemStatus == ItemStatus.Nodump)
|
||||||
|| (item.ItemType == ItemType.Disk && (item as Disk).ItemStatus == ItemStatus.Nodump))
|
|| (item.ItemType == ItemType.Disk && (item as Disk).ItemStatus == ItemStatus.Nodump))
|
||||||
{
|
{
|
||||||
fieldDats[Field.DatItem_Status].Items.Add(key, item);
|
fieldDats[DatItemField.Status].Items.Add(key, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the file has a SHA-512
|
// If the file has a SHA-512
|
||||||
else if ((item.ItemType == ItemType.Rom && !string.IsNullOrWhiteSpace((item as Rom).SHA512)))
|
else if ((item.ItemType == ItemType.Rom && !string.IsNullOrWhiteSpace((item as Rom).SHA512)))
|
||||||
{
|
{
|
||||||
fieldDats[Field.DatItem_SHA512].Items.Add(key, item);
|
fieldDats[DatItemField.SHA512].Items.Add(key, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the file has a SHA-384
|
// If the file has a SHA-384
|
||||||
else if ((item.ItemType == ItemType.Rom && !string.IsNullOrWhiteSpace((item as Rom).SHA384)))
|
else if ((item.ItemType == ItemType.Rom && !string.IsNullOrWhiteSpace((item as Rom).SHA384)))
|
||||||
{
|
{
|
||||||
fieldDats[Field.DatItem_SHA384].Items.Add(key, item);
|
fieldDats[DatItemField.SHA384].Items.Add(key, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the file has a SHA-256
|
// If the file has a SHA-256
|
||||||
else if ((item.ItemType == ItemType.Media && !string.IsNullOrWhiteSpace((item as Media).SHA256))
|
else if ((item.ItemType == ItemType.Media && !string.IsNullOrWhiteSpace((item as Media).SHA256))
|
||||||
|| (item.ItemType == ItemType.Rom && !string.IsNullOrWhiteSpace((item as Rom).SHA256)))
|
|| (item.ItemType == ItemType.Rom && !string.IsNullOrWhiteSpace((item as Rom).SHA256)))
|
||||||
{
|
{
|
||||||
fieldDats[Field.DatItem_SHA256].Items.Add(key, item);
|
fieldDats[DatItemField.SHA256].Items.Add(key, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the file has a SHA-1
|
// If the file has a SHA-1
|
||||||
@@ -179,7 +179,7 @@ namespace SabreTools.DatTools
|
|||||||
|| (item.ItemType == ItemType.Media && !string.IsNullOrWhiteSpace((item as Media).SHA1))
|
|| (item.ItemType == ItemType.Media && !string.IsNullOrWhiteSpace((item as Media).SHA1))
|
||||||
|| (item.ItemType == ItemType.Rom && !string.IsNullOrWhiteSpace((item as Rom).SHA1)))
|
|| (item.ItemType == ItemType.Rom && !string.IsNullOrWhiteSpace((item as Rom).SHA1)))
|
||||||
{
|
{
|
||||||
fieldDats[Field.DatItem_SHA1].Items.Add(key, item);
|
fieldDats[DatItemField.SHA1].Items.Add(key, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the file has an MD5
|
// If the file has an MD5
|
||||||
@@ -187,18 +187,18 @@ namespace SabreTools.DatTools
|
|||||||
|| (item.ItemType == ItemType.Media && !string.IsNullOrWhiteSpace((item as Media).MD5))
|
|| (item.ItemType == ItemType.Media && !string.IsNullOrWhiteSpace((item as Media).MD5))
|
||||||
|| (item.ItemType == ItemType.Rom && !string.IsNullOrWhiteSpace((item as Rom).MD5)))
|
|| (item.ItemType == ItemType.Rom && !string.IsNullOrWhiteSpace((item as Rom).MD5)))
|
||||||
{
|
{
|
||||||
fieldDats[Field.DatItem_MD5].Items.Add(key, item);
|
fieldDats[DatItemField.MD5].Items.Add(key, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the file has a CRC
|
// If the file has a CRC
|
||||||
else if ((item.ItemType == ItemType.Rom && !string.IsNullOrWhiteSpace((item as Rom).CRC)))
|
else if ((item.ItemType == ItemType.Rom && !string.IsNullOrWhiteSpace((item as Rom).CRC)))
|
||||||
{
|
{
|
||||||
fieldDats[Field.DatItem_CRC].Items.Add(key, item);
|
fieldDats[DatItemField.CRC].Items.Add(key, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fieldDats[Field.NULL].Items.Add(key, item);
|
fieldDats[DatItemField.NULL].Items.Add(key, item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -217,7 +217,7 @@ namespace SabreTools.DatTools
|
|||||||
public static bool SplitByLevel(DatFile datFile, string outDir, bool shortname, bool basedat)
|
public static bool SplitByLevel(DatFile datFile, string outDir, bool shortname, bool basedat)
|
||||||
{
|
{
|
||||||
// First, bucket by games so that we can do the right thing
|
// First, bucket by games so that we can do the right thing
|
||||||
datFile.Items.BucketBy(Field.Machine_Name, DedupeType.None, lower: false, norename: true);
|
datFile.Items.BucketBy(ItemKey.Machine, DedupeType.None, lower: false, norename: true);
|
||||||
|
|
||||||
// Create a temporary DAT to add things to
|
// Create a temporary DAT to add things to
|
||||||
DatFile tempDat = DatFile.Create(datFile.Header);
|
DatFile tempDat = DatFile.Create(datFile.Header);
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ using System.IO;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
|
||||||
using SabreTools.Core;
|
|
||||||
using SabreTools.DatFiles;
|
using SabreTools.DatFiles;
|
||||||
|
using SabreTools.DatItems;
|
||||||
using SabreTools.IO;
|
using SabreTools.IO;
|
||||||
using SabreTools.Logging;
|
using SabreTools.Logging;
|
||||||
using SabreTools.Reports;
|
using SabreTools.Reports;
|
||||||
@@ -107,7 +107,7 @@ namespace SabreTools.DatTools
|
|||||||
logger.Verbose($"Beginning stat collection for '{file.CurrentPath}'");
|
logger.Verbose($"Beginning stat collection for '{file.CurrentPath}'");
|
||||||
List<string> games = new List<string>();
|
List<string> games = new List<string>();
|
||||||
DatFile datdata = Parser.CreateAndParse(file.CurrentPath);
|
DatFile datdata = Parser.CreateAndParse(file.CurrentPath);
|
||||||
datdata.Items.BucketBy(Field.Machine_Name, DedupeType.None, norename: true);
|
datdata.Items.BucketBy(ItemKey.Machine, DedupeType.None, norename: true);
|
||||||
|
|
||||||
// Output single DAT stats (if asked)
|
// Output single DAT stats (if asked)
|
||||||
logger.User($"Adding stats for file '{file.CurrentPath}'\n");
|
logger.User($"Adding stats for file '{file.CurrentPath}'\n");
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ namespace SabreTools.DatTools
|
|||||||
return success;
|
return success;
|
||||||
|
|
||||||
// Now that we have a list of depots, we want to bucket the input DAT by SHA-1
|
// Now that we have a list of depots, we want to bucket the input DAT by SHA-1
|
||||||
datFile.Items.BucketBy(Field.DatItem_SHA1, DedupeType.None);
|
datFile.Items.BucketBy(ItemKey.SHA1, DedupeType.None);
|
||||||
|
|
||||||
// Then we want to loop through each of the hashes and see if we can rebuild
|
// Then we want to loop through each of the hashes and see if we can rebuild
|
||||||
var keys = datFile.Items.SortedKeys.ToList();
|
var keys = datFile.Items.SortedKeys.ToList();
|
||||||
@@ -118,11 +118,11 @@ namespace SabreTools.DatTools
|
|||||||
bool success = true;
|
bool success = true;
|
||||||
|
|
||||||
// Force bucketing according to the flags
|
// Force bucketing according to the flags
|
||||||
datFile.Items.SetBucketedBy(Field.NULL);
|
datFile.Items.SetBucketedBy(ItemKey.NULL);
|
||||||
if (hashOnly)
|
if (hashOnly)
|
||||||
datFile.Items.BucketBy(Field.DatItem_CRC, DedupeType.Full);
|
datFile.Items.BucketBy(ItemKey.CRC, DedupeType.Full);
|
||||||
else
|
else
|
||||||
datFile.Items.BucketBy(Field.Machine_Name, DedupeType.Full);
|
datFile.Items.BucketBy(ItemKey.Machine, DedupeType.Full);
|
||||||
|
|
||||||
// Then mark items for removal
|
// Then mark items for removal
|
||||||
var keys = datFile.Items.SortedKeys.ToList();
|
var keys = datFile.Items.SortedKeys.ToList();
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
using SabreTools.Core;
|
using SabreTools.Core;
|
||||||
using SabreTools.DatFiles;
|
using SabreTools.DatFiles;
|
||||||
|
using SabreTools.DatItems;
|
||||||
using SabreTools.IO;
|
using SabreTools.IO;
|
||||||
using SabreTools.Logging;
|
using SabreTools.Logging;
|
||||||
using SabreTools.Reports;
|
using SabreTools.Reports;
|
||||||
@@ -62,7 +63,7 @@ namespace SabreTools.DatTools
|
|||||||
EnsureHeaderFields(datFile);
|
EnsureHeaderFields(datFile);
|
||||||
|
|
||||||
// Bucket roms by game name, if not already
|
// Bucket roms by game name, if not already
|
||||||
datFile.Items.BucketBy(Field.Machine_Name, DedupeType.None);
|
datFile.Items.BucketBy(ItemKey.Machine, DedupeType.None);
|
||||||
|
|
||||||
// Output the number of items we're going to be writing
|
// Output the number of items we're going to be writing
|
||||||
logger.User($"A total of {datFile.Items.TotalCount - datFile.Items.RemovedCount} items will be written out to '{datFile.Header.FileName}'");
|
logger.User($"A total of {datFile.Items.TotalCount - datFile.Items.RemovedCount} items will be written out to '{datFile.Header.FileName}'");
|
||||||
@@ -107,7 +108,7 @@ namespace SabreTools.DatTools
|
|||||||
if (datFile.Items.RomCount + datFile.Items.DiskCount == 0)
|
if (datFile.Items.RomCount + datFile.Items.DiskCount == 0)
|
||||||
datFile.Items.RecalculateStats();
|
datFile.Items.RecalculateStats();
|
||||||
|
|
||||||
datFile.Items.BucketBy(Field.Machine_Name, DedupeType.None, norename: true);
|
datFile.Items.BucketBy(ItemKey.Machine, DedupeType.None, norename: true);
|
||||||
|
|
||||||
var consoleOutput = BaseReport.Create(StatReportFormat.None, null, true, true);
|
var consoleOutput = BaseReport.Create(StatReportFormat.None, null, true, true);
|
||||||
consoleOutput.ReplaceStatistics(datFile.Header.FileName, datFile.Items.Keys.Count(), datFile.Items);
|
consoleOutput.ReplaceStatistics(datFile.Header.FileName, datFile.Items.Keys.Count(), datFile.Items);
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ namespace SabreTools.Features
|
|||||||
// Hash splitting
|
// Hash splitting
|
||||||
if (splittingMode.HasFlag(SplittingMode.Hash))
|
if (splittingMode.HasFlag(SplittingMode.Hash))
|
||||||
{
|
{
|
||||||
Dictionary<Field, DatFile> typeDats = Splitter.SplitByHash(internalDat);
|
Dictionary<DatItemField, DatFile> typeDats = Splitter.SplitByHash(internalDat);
|
||||||
|
|
||||||
InternalStopwatch watch = new InternalStopwatch("Outputting hash-split DATs");
|
InternalStopwatch watch = new InternalStopwatch("Outputting hash-split DATs");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user