mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[DatFile, DatHeader, DatStats] Descriptors
This commit is contained in:
@@ -5,7 +5,6 @@ using System.Linq;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
|
|
||||||
using SabreTools.Library.Data;
|
using SabreTools.Library.Data;
|
||||||
using SabreTools.Library.FileTypes;
|
using SabreTools.Library.FileTypes;
|
||||||
using SabreTools.Library.DatItems;
|
using SabreTools.Library.DatItems;
|
||||||
@@ -41,8 +40,6 @@ namespace SabreTools.Library.DatFiles
|
|||||||
|
|
||||||
// DatItems dictionary
|
// DatItems dictionary
|
||||||
internal SortedDictionary<string, List<DatItem>> _items = new SortedDictionary<string, List<DatItem>>();
|
internal SortedDictionary<string, List<DatItem>> _items = new SortedDictionary<string, List<DatItem>>();
|
||||||
internal SortedBy _sortedBy;
|
|
||||||
internal DedupeType _mergedBy;
|
|
||||||
|
|
||||||
// Internal statistical data
|
// Internal statistical data
|
||||||
internal DatStats _datStats = new DatStats();
|
internal DatStats _datStats = new DatStats();
|
||||||
@@ -51,7 +48,11 @@ namespace SabreTools.Library.DatFiles
|
|||||||
|
|
||||||
#region Publicly facing variables
|
#region Publicly facing variables
|
||||||
|
|
||||||
// Data common to most DAT types
|
#region Data common to most DAT types
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// External name of the DAT
|
||||||
|
/// </summary>
|
||||||
public string FileName
|
public string FileName
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -65,6 +66,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
_datHeader.FileName = value;
|
_datHeader.FileName = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Internal name of the DAT
|
||||||
|
/// </summary>
|
||||||
public string Name
|
public string Name
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -78,6 +83,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
_datHeader.Name = value;
|
_datHeader.Name = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// DAT description
|
||||||
|
/// </summary>
|
||||||
public string Description
|
public string Description
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -91,6 +100,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
_datHeader.Description = value;
|
_datHeader.Description = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Root directory for the files; currently TruRip/EmuARC-exclusive
|
||||||
|
/// </summary>
|
||||||
public string RootDir
|
public string RootDir
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -104,6 +117,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
_datHeader.RootDir = value;
|
_datHeader.RootDir = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// General category of items found in the DAT
|
||||||
|
/// </summary>
|
||||||
public string Category
|
public string Category
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -117,6 +134,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
_datHeader.Category = value;
|
_datHeader.Category = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Version of the DAT
|
||||||
|
/// </summary>
|
||||||
public string Version
|
public string Version
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -130,6 +151,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
_datHeader.Version = value;
|
_datHeader.Version = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creation or modification date
|
||||||
|
/// </summary>
|
||||||
public string Date
|
public string Date
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -143,6 +168,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
_datHeader.Date = value;
|
_datHeader.Date = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// List of authors who contributed to the DAT
|
||||||
|
/// </summary>
|
||||||
public string Author
|
public string Author
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -156,6 +185,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
_datHeader.Author = value;
|
_datHeader.Author = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Email address for DAT author(s)
|
||||||
|
/// </summary>
|
||||||
public string Email
|
public string Email
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -169,6 +202,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
_datHeader.Email = value;
|
_datHeader.Email = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Author or distribution homepage name
|
||||||
|
/// </summary>
|
||||||
public string Homepage
|
public string Homepage
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -182,6 +219,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
_datHeader.Homepage = value;
|
_datHeader.Homepage = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Author or distribution URL
|
||||||
|
/// </summary>
|
||||||
public string Url
|
public string Url
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -195,6 +236,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
_datHeader.Url = value;
|
_datHeader.Url = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Any comment that does not already fit an existing field
|
||||||
|
/// </summary>
|
||||||
public string Comment
|
public string Comment
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -208,6 +253,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
_datHeader.Comment = value;
|
_datHeader.Comment = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Header skipper to be used when loading the DAT
|
||||||
|
/// </summary>
|
||||||
public string Header
|
public string Header
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -221,7 +270,11 @@ namespace SabreTools.Library.DatFiles
|
|||||||
_datHeader.Header = value;
|
_datHeader.Header = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public string Type // Generally only used for SuperDAT
|
|
||||||
|
/// <summary>
|
||||||
|
/// Classification of the DAT. Generally only used for SuperDAT
|
||||||
|
/// </summary>
|
||||||
|
public string Type
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
@@ -234,6 +287,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
_datHeader.Type = value;
|
_datHeader.Type = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Force a merging style when loaded
|
||||||
|
/// </summary>
|
||||||
public ForceMerging ForceMerging
|
public ForceMerging ForceMerging
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -247,6 +304,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
_datHeader.ForceMerging = value;
|
_datHeader.ForceMerging = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Force nodump handling when loaded
|
||||||
|
/// </summary>
|
||||||
public ForceNodump ForceNodump
|
public ForceNodump ForceNodump
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -260,6 +321,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
_datHeader.ForceNodump = value;
|
_datHeader.ForceNodump = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Force output packing when loaded
|
||||||
|
/// </summary>
|
||||||
public ForcePacking ForcePacking
|
public ForcePacking ForcePacking
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -273,6 +338,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
_datHeader.ForcePacking = value;
|
_datHeader.ForcePacking = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Read or write format
|
||||||
|
/// </summary>
|
||||||
public DatFormat DatFormat
|
public DatFormat DatFormat
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -286,6 +355,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
_datHeader.DatFormat = value;
|
_datHeader.DatFormat = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// List of fields in machine and items to exclude from writing
|
||||||
|
/// </summary>
|
||||||
public bool[] ExcludeFields
|
public bool[] ExcludeFields
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -299,6 +372,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
_datHeader.ExcludeFields = value;
|
_datHeader.ExcludeFields = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enable "One Rom, One Region (1G1R)" mode
|
||||||
|
/// </summary>
|
||||||
public bool OneRom
|
public bool OneRom
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -312,6 +389,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
_datHeader.OneRom = value;
|
_datHeader.OneRom = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Keep machines that don't contain any items
|
||||||
|
/// </summary>
|
||||||
public bool KeepEmptyGames
|
public bool KeepEmptyGames
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -325,6 +406,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
_datHeader.KeepEmptyGames = value;
|
_datHeader.KeepEmptyGames = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Remove scene dates from the beginning of machine names
|
||||||
|
/// </summary>
|
||||||
public bool SceneDateStrip
|
public bool SceneDateStrip
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -338,6 +423,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
_datHeader.SceneDateStrip = value;
|
_datHeader.SceneDateStrip = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Deduplicate items using the given method
|
||||||
|
/// </summary>
|
||||||
public DedupeType DedupeRoms
|
public DedupeType DedupeRoms
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -351,16 +440,36 @@ namespace SabreTools.Library.DatFiles
|
|||||||
_datHeader.DedupeRoms = value;
|
_datHeader.DedupeRoms = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public SortedBy SortedBy
|
|
||||||
|
/// <summary>
|
||||||
|
/// Strip hash types from items
|
||||||
|
/// </summary>
|
||||||
|
public Hash StripHash
|
||||||
{
|
{
|
||||||
get { return _sortedBy; }
|
get
|
||||||
|
{
|
||||||
|
EnsureDatHeader();
|
||||||
|
return _datHeader.StripHash;
|
||||||
}
|
}
|
||||||
public DedupeType MergedBy
|
|
||||||
{
|
|
||||||
get { return _mergedBy; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write pre-processing
|
/// <summary>
|
||||||
|
/// Determine the sorting key for all items
|
||||||
|
/// </summary>
|
||||||
|
public SortedBy SortedBy { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determine merging type for all items
|
||||||
|
/// </summary>
|
||||||
|
public DedupeType MergedBy { get; private set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Write pre-processing
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Text to prepend to all outputted lines
|
||||||
|
/// </summary>
|
||||||
public string Prefix
|
public string Prefix
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -374,6 +483,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
_datHeader.Prefix = value;
|
_datHeader.Prefix = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Text to append to all outputted lines
|
||||||
|
/// </summary>
|
||||||
public string Postfix
|
public string Postfix
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -387,6 +500,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
_datHeader.Postfix = value;
|
_datHeader.Postfix = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add a new extension to all items
|
||||||
|
/// </summary>
|
||||||
public string AddExtension
|
public string AddExtension
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -400,6 +517,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
_datHeader.AddExtension = value;
|
_datHeader.AddExtension = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Replace all item extensions
|
||||||
|
/// </summary>
|
||||||
public string ReplaceExtension
|
public string ReplaceExtension
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -413,6 +534,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
_datHeader.ReplaceExtension = value;
|
_datHeader.ReplaceExtension = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Remove all item extensions
|
||||||
|
/// </summary>
|
||||||
public bool RemoveExtension
|
public bool RemoveExtension
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -426,6 +551,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
_datHeader.RemoveExtension = value;
|
_datHeader.RemoveExtension = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Romba output mode
|
||||||
|
/// </summary>
|
||||||
public bool Romba
|
public bool Romba
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -439,6 +568,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
_datHeader.Romba = value;
|
_datHeader.Romba = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Output the machine name
|
||||||
|
/// </summary>
|
||||||
public bool GameName
|
public bool GameName
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -452,6 +585,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
_datHeader.GameName = value;
|
_datHeader.GameName = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Wrap quotes around the entire line, sans prefix and postfix
|
||||||
|
/// </summary>
|
||||||
public bool Quotes
|
public bool Quotes
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -466,7 +603,13 @@ namespace SabreTools.Library.DatFiles
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Data specific to the Miss DAT type
|
#endregion
|
||||||
|
|
||||||
|
#region Data specific to the Miss DAT type
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Output the item name
|
||||||
|
/// </summary>
|
||||||
public bool UseRomName
|
public bool UseRomName
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -481,7 +624,13 @@ namespace SabreTools.Library.DatFiles
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Statistical data related to the DAT
|
#endregion
|
||||||
|
|
||||||
|
#region Statistical data related to the DAT
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Statistics writing format
|
||||||
|
/// </summary>
|
||||||
public StatReportFormat ReportFormat
|
public StatReportFormat ReportFormat
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -495,6 +644,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
_datStats.ReportFormat = value;
|
_datStats.ReportFormat = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Overall item count
|
||||||
|
/// </summary>
|
||||||
public long Count
|
public long Count
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -508,6 +661,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
_datStats.Count = value;
|
_datStats.Count = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Number of Archive items
|
||||||
|
/// </summary>
|
||||||
public long ArchiveCount
|
public long ArchiveCount
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -521,6 +678,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
_datStats.ArchiveCount = value;
|
_datStats.ArchiveCount = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Number of BiosSet items
|
||||||
|
/// </summary>
|
||||||
public long BiosSetCount
|
public long BiosSetCount
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -534,6 +695,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
_datStats.BiosSetCount = value;
|
_datStats.BiosSetCount = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Number of Disk items
|
||||||
|
/// </summary>
|
||||||
public long DiskCount
|
public long DiskCount
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -547,6 +712,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
_datStats.DiskCount = value;
|
_datStats.DiskCount = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Number of Release items
|
||||||
|
/// </summary>
|
||||||
public long ReleaseCount
|
public long ReleaseCount
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -560,6 +729,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
_datStats.ReleaseCount = value;
|
_datStats.ReleaseCount = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Number of Rom items
|
||||||
|
/// </summary>
|
||||||
public long RomCount
|
public long RomCount
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -573,6 +746,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
_datStats.RomCount = value;
|
_datStats.RomCount = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Number of Sample items
|
||||||
|
/// </summary>
|
||||||
public long SampleCount
|
public long SampleCount
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -586,6 +763,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
_datStats.SampleCount = value;
|
_datStats.SampleCount = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Total uncompressed size
|
||||||
|
/// </summary>
|
||||||
public long TotalSize
|
public long TotalSize
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -599,6 +780,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
_datStats.TotalSize = value;
|
_datStats.TotalSize = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Number of items with a CRC hash
|
||||||
|
/// </summary>
|
||||||
public long CRCCount
|
public long CRCCount
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -612,6 +797,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
_datStats.CRCCount = value;
|
_datStats.CRCCount = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Number of items with an MD5 hash
|
||||||
|
/// </summary>
|
||||||
public long MD5Count
|
public long MD5Count
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -625,6 +814,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
_datStats.MD5Count = value;
|
_datStats.MD5Count = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Number of items with a SHA-1 hash
|
||||||
|
/// </summary>
|
||||||
public long SHA1Count
|
public long SHA1Count
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -638,6 +831,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
_datStats.SHA1Count = value;
|
_datStats.SHA1Count = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Number of items with a SHA-256 hash
|
||||||
|
/// </summary>
|
||||||
public long SHA256Count
|
public long SHA256Count
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -651,6 +848,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
_datStats.SHA256Count = value;
|
_datStats.SHA256Count = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Number of items with a SHA-384 hash
|
||||||
|
/// </summary>
|
||||||
public long SHA384Count
|
public long SHA384Count
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -664,6 +865,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
_datStats.SHA384Count = value;
|
_datStats.SHA384Count = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Number of items with a SHA-512 hash
|
||||||
|
/// </summary>
|
||||||
public long SHA512Count
|
public long SHA512Count
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -677,6 +882,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
_datStats.SHA512Count = value;
|
_datStats.SHA512Count = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Number of items with the baddump status
|
||||||
|
/// </summary>
|
||||||
public long BaddumpCount
|
public long BaddumpCount
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -690,6 +899,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
_datStats.BaddumpCount = value;
|
_datStats.BaddumpCount = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Number of items with the good status
|
||||||
|
/// </summary>
|
||||||
public long GoodCount
|
public long GoodCount
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -703,6 +916,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
_datStats.GoodCount = value;
|
_datStats.GoodCount = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Number of items with the nodump status
|
||||||
|
/// </summary>
|
||||||
public long NodumpCount
|
public long NodumpCount
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -716,6 +933,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
_datStats.NodumpCount = value;
|
_datStats.NodumpCount = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Number of items with the verified status
|
||||||
|
/// </summary>
|
||||||
public long VerifiedCount
|
public long VerifiedCount
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -732,6 +953,8 @@ namespace SabreTools.Library.DatFiles
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region Instance Methods
|
#region Instance Methods
|
||||||
|
|
||||||
#region Accessors
|
#region Accessors
|
||||||
@@ -1031,15 +1254,15 @@ namespace SabreTools.Library.DatFiles
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If the sorted type isn't the same, we want to sort the dictionary accordingly
|
// If the sorted type isn't the same, we want to sort the dictionary accordingly
|
||||||
if (_sortedBy != bucketBy)
|
if (this.SortedBy != bucketBy)
|
||||||
{
|
{
|
||||||
Globals.Logger.User("Organizing roms by {0}", bucketBy);
|
Globals.Logger.User("Organizing roms by {0}", bucketBy);
|
||||||
|
|
||||||
// Set the sorted type
|
// Set the sorted type
|
||||||
_sortedBy = bucketBy;
|
this.SortedBy = bucketBy;
|
||||||
|
|
||||||
// Reset the merged type since this might change the merge
|
// Reset the merged type since this might change the merge
|
||||||
_mergedBy = DedupeType.None;
|
this.MergedBy = DedupeType.None;
|
||||||
|
|
||||||
// First do the initial sort of all of the roms inplace
|
// First do the initial sort of all of the roms inplace
|
||||||
List<string> oldkeys = Keys;
|
List<string> oldkeys = Keys;
|
||||||
@@ -1076,12 +1299,12 @@ namespace SabreTools.Library.DatFiles
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If the merge type isn't the same, we want to merge the dictionary accordingly
|
// If the merge type isn't the same, we want to merge the dictionary accordingly
|
||||||
if (_mergedBy != deduperoms)
|
if (this.MergedBy != deduperoms)
|
||||||
{
|
{
|
||||||
Globals.Logger.User("Deduping roms by {0}", deduperoms);
|
Globals.Logger.User("Deduping roms by {0}", deduperoms);
|
||||||
|
|
||||||
// Set the sorted type
|
// Set the sorted type
|
||||||
_mergedBy = deduperoms;
|
this.MergedBy = deduperoms;
|
||||||
|
|
||||||
List<string> keys = Keys;
|
List<string> keys = Keys;
|
||||||
Parallel.ForEach(keys, Globals.ParallelOptions, key =>
|
Parallel.ForEach(keys, Globals.ParallelOptions, key =>
|
||||||
@@ -1208,8 +1431,8 @@ namespace SabreTools.Library.DatFiles
|
|||||||
{
|
{
|
||||||
this._datHeader = datFile._datHeader;
|
this._datHeader = datFile._datHeader;
|
||||||
this._items = datFile._items;
|
this._items = datFile._items;
|
||||||
this._sortedBy = datFile._sortedBy;
|
this.SortedBy = datFile.SortedBy;
|
||||||
this._mergedBy = datFile._mergedBy;
|
this.MergedBy = datFile.MergedBy;
|
||||||
this._datStats = datFile._datStats;
|
this._datStats = datFile._datStats;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2031,8 +2254,8 @@ namespace SabreTools.Library.DatFiles
|
|||||||
public void DeleteDictionary()
|
public void DeleteDictionary()
|
||||||
{
|
{
|
||||||
_items = null;
|
_items = null;
|
||||||
_sortedBy = SortedBy.Default;
|
this.SortedBy = SortedBy.Default;
|
||||||
_mergedBy = DedupeType.None;
|
this.MergedBy = DedupeType.None;
|
||||||
|
|
||||||
// Reset statistics
|
// Reset statistics
|
||||||
_datStats.Reset();
|
_datStats.Reset();
|
||||||
@@ -2044,8 +2267,8 @@ namespace SabreTools.Library.DatFiles
|
|||||||
public void ResetDictionary()
|
public void ResetDictionary()
|
||||||
{
|
{
|
||||||
_items = new SortedDictionary<string, List<DatItem>>();
|
_items = new SortedDictionary<string, List<DatItem>>();
|
||||||
_sortedBy = SortedBy.Default;
|
this.SortedBy = SortedBy.Default;
|
||||||
_mergedBy = DedupeType.None;
|
this.MergedBy = DedupeType.None;
|
||||||
|
|
||||||
// Reset statistics
|
// Reset statistics
|
||||||
_datStats.Reset();
|
_datStats.Reset();
|
||||||
@@ -2801,7 +3024,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
|
|
||||||
// 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 = (DatFormat == 0 ? Utilities.GetDatFormatFromFile(filename) : DatFormat);
|
DatFormat = (DatFormat == 0 ? Utilities.GetDatFormatFromFile(filename) : DatFormat);
|
||||||
_sortedBy = SortedBy.CRC; // Setting this because it can reduce issues later
|
this.SortedBy = SortedBy.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
|
||||||
|
|||||||
@@ -10,43 +10,183 @@ namespace SabreTools.Library.DatFiles
|
|||||||
{
|
{
|
||||||
#region Publicly facing variables
|
#region Publicly facing variables
|
||||||
|
|
||||||
// Data common to most DAT types
|
#region Data common to most DAT types
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// External name of the DAT
|
||||||
|
/// </summary>
|
||||||
public string FileName { get; set; }
|
public string FileName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Internal name of the DAT
|
||||||
|
/// </summary>
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// DAT description
|
||||||
|
/// </summary>
|
||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Root directory for the files; currently TruRip/EmuARC-exclusive
|
||||||
|
/// </summary>
|
||||||
public string RootDir { get; set; }
|
public string RootDir { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// General category of items found in the DAT
|
||||||
|
/// </summary>
|
||||||
public string Category { get; set; }
|
public string Category { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Version of the DAT
|
||||||
|
/// </summary>
|
||||||
public string Version { get; set; }
|
public string Version { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creation or modification date
|
||||||
|
/// </summary>
|
||||||
public string Date { get; set; }
|
public string Date { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// List of authors who contributed to the DAT
|
||||||
|
/// </summary>
|
||||||
public string Author { get; set; }
|
public string Author { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Email address for DAT author(s)
|
||||||
|
/// </summary>
|
||||||
public string Email { get; set; }
|
public string Email { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Author or distribution homepage name
|
||||||
|
/// </summary>
|
||||||
public string Homepage { get; set; }
|
public string Homepage { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Author or distribution URL
|
||||||
|
/// </summary>
|
||||||
public string Url { get; set; }
|
public string Url { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Any comment that does not already fit an existing field
|
||||||
|
/// </summary>
|
||||||
public string Comment { get; set; }
|
public string Comment { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Header skipper to be used when loading the DAT
|
||||||
|
/// </summary>
|
||||||
public string Header { get; set; }
|
public string Header { get; set; }
|
||||||
public string Type { get; set; } // Generally only used for SuperDAT
|
|
||||||
|
/// <summary>
|
||||||
|
/// Classification of the DAT. Generally only used for SuperDAT
|
||||||
|
/// </summary>
|
||||||
|
public string Type { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Force a merging style when loaded
|
||||||
|
/// </summary>
|
||||||
public ForceMerging ForceMerging { get; set; }
|
public ForceMerging ForceMerging { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Force nodump handling when loaded
|
||||||
|
/// </summary>
|
||||||
public ForceNodump ForceNodump { get; set; }
|
public ForceNodump ForceNodump { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Force output packing when loaded
|
||||||
|
/// </summary>
|
||||||
public ForcePacking ForcePacking { get; set; }
|
public ForcePacking ForcePacking { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Read or write format
|
||||||
|
/// </summary>
|
||||||
public DatFormat DatFormat { get; set; }
|
public DatFormat DatFormat { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// List of fields in machine and items to exclude from writing
|
||||||
|
/// </summary>
|
||||||
public bool[] ExcludeFields { get; set; } = new bool[Enum.GetNames(typeof(Field)).Length];
|
public bool[] ExcludeFields { get; set; } = new bool[Enum.GetNames(typeof(Field)).Length];
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enable "One Rom, One Region (1G1R)" mode
|
||||||
|
/// </summary>
|
||||||
public bool OneRom { get; set; }
|
public bool OneRom { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Keep machines that don't contain any items
|
||||||
|
/// </summary>
|
||||||
public bool KeepEmptyGames { get; set; }
|
public bool KeepEmptyGames { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Remove scene dates from the beginning of machine names
|
||||||
|
/// </summary>
|
||||||
public bool SceneDateStrip { get; set; }
|
public bool SceneDateStrip { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Deduplicate items using the given method
|
||||||
|
/// </summary>
|
||||||
public DedupeType DedupeRoms { get; set; }
|
public DedupeType DedupeRoms { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Strip hash types from items
|
||||||
|
/// </summary>
|
||||||
public Hash StripHash { get; private set; }
|
public Hash StripHash { get; private set; }
|
||||||
|
|
||||||
// Data specific to the Miss DAT type
|
#endregion
|
||||||
public bool UseRomName { get; set; }
|
|
||||||
|
#region Write pre-processing
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Text to prepend to all outputted lines
|
||||||
|
/// </summary>
|
||||||
public string Prefix { get; set; }
|
public string Prefix { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Text to append to all outputted lines
|
||||||
|
/// </summary>
|
||||||
public string Postfix { get; set; }
|
public string Postfix { get; set; }
|
||||||
public bool Quotes { get; set; }
|
|
||||||
public string ReplaceExtension { get; set; }
|
/// <summary>
|
||||||
|
/// Add a new extension to all items
|
||||||
|
/// </summary>
|
||||||
public string AddExtension { get; set; }
|
public string AddExtension { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Replace all item extensions
|
||||||
|
/// </summary>
|
||||||
|
public string ReplaceExtension { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Remove all item extensions
|
||||||
|
/// </summary>
|
||||||
public bool RemoveExtension { get; set; }
|
public bool RemoveExtension { get; set; }
|
||||||
public bool GameName { get; set; }
|
|
||||||
|
/// <summary>
|
||||||
|
/// Romba output mode
|
||||||
|
/// </summary>
|
||||||
public bool Romba { get; set; }
|
public bool Romba { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Output the machine name
|
||||||
|
/// </summary>
|
||||||
|
public bool GameName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Wrap quotes around the entire line, sans prefix and postfix
|
||||||
|
/// </summary>
|
||||||
|
public bool Quotes { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Data specific to the Miss DAT type
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Output the item name
|
||||||
|
/// </summary>
|
||||||
|
public bool UseRomName { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Instance Methods
|
#region Instance Methods
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
using SabreTools.Library.Data;
|
using SabreTools.Library.Data;
|
||||||
using SabreTools.Library.DatItems;
|
using SabreTools.Library.DatItems;
|
||||||
|
|
||||||
@@ -12,45 +11,114 @@ namespace SabreTools.Library.DatFiles
|
|||||||
{
|
{
|
||||||
#region Private instance variables
|
#region Private instance variables
|
||||||
|
|
||||||
// Object used to lock stats updates
|
/// <summary>
|
||||||
|
/// Object used to lock stats updates
|
||||||
|
/// </summary>
|
||||||
private object _lockObject = new object();
|
private object _lockObject = new object();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Publicly facing variables
|
#region Publicly facing variables
|
||||||
|
|
||||||
// Statistics report format
|
/// <summary>
|
||||||
|
/// Statistics writing format
|
||||||
|
/// </summary>
|
||||||
public StatReportFormat ReportFormat { get; set; } = StatReportFormat.None;
|
public StatReportFormat ReportFormat { get; set; } = StatReportFormat.None;
|
||||||
|
|
||||||
// Overall item count
|
/// <summary>
|
||||||
|
/// Overall item count
|
||||||
|
/// </summary>
|
||||||
public long Count { get; set; } = 0;
|
public long Count { get; set; } = 0;
|
||||||
|
|
||||||
// Individual DatItem type counts
|
/// <summary>
|
||||||
|
/// Number of Archive items
|
||||||
|
/// </summary>
|
||||||
public long ArchiveCount { get; set; } = 0;
|
public long ArchiveCount { get; set; } = 0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Number of BiosSet items
|
||||||
|
/// </summary>
|
||||||
public long BiosSetCount { get; set; } = 0;
|
public long BiosSetCount { get; set; } = 0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Number of Disk items
|
||||||
|
/// </summary>
|
||||||
public long DiskCount { get; set; } = 0;
|
public long DiskCount { get; set; } = 0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Number of Release items
|
||||||
|
/// </summary>
|
||||||
public long ReleaseCount { get; set; } = 0;
|
public long ReleaseCount { get; set; } = 0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Number of Rom items
|
||||||
|
/// </summary>
|
||||||
public long RomCount { get; set; } = 0;
|
public long RomCount { get; set; } = 0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Number of Sample items
|
||||||
|
/// </summary>
|
||||||
public long SampleCount { get; set; } = 0;
|
public long SampleCount { get; set; } = 0;
|
||||||
|
|
||||||
// Special count only used by statistics output
|
/// <summary>
|
||||||
|
/// Number of machines
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>Special count only used by statistics output</remarks>
|
||||||
public long GameCount { get; set; } = 0;
|
public long GameCount { get; set; } = 0;
|
||||||
|
|
||||||
// Total reported size
|
/// <summary>
|
||||||
|
/// Total uncompressed size
|
||||||
|
/// </summary>
|
||||||
public long TotalSize { get; set; } = 0;
|
public long TotalSize { get; set; } = 0;
|
||||||
|
|
||||||
// Individual hash counts
|
/// <summary>
|
||||||
|
/// Number of items with a CRC hash
|
||||||
|
/// </summary>
|
||||||
public long CRCCount { get; set; } = 0;
|
public long CRCCount { get; set; } = 0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Number of items with an MD5 hash
|
||||||
|
/// </summary>
|
||||||
public long MD5Count { get; set; } = 0;
|
public long MD5Count { get; set; } = 0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Number of items with a SHA-1 hash
|
||||||
|
/// </summary>
|
||||||
public long SHA1Count { get; set; } = 0;
|
public long SHA1Count { get; set; } = 0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Number of items with a SHA-256 hash
|
||||||
|
/// </summary>
|
||||||
public long SHA256Count { get; set; } = 0;
|
public long SHA256Count { get; set; } = 0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Number of items with a SHA-384 hash
|
||||||
|
/// </summary>
|
||||||
public long SHA384Count { get; set; } = 0;
|
public long SHA384Count { get; set; } = 0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Number of items with a SHA-512 hash
|
||||||
|
/// </summary>
|
||||||
public long SHA512Count { get; set; } = 0;
|
public long SHA512Count { get; set; } = 0;
|
||||||
|
|
||||||
// Individual status counts
|
/// <summary>
|
||||||
|
/// Number of items with the baddump status
|
||||||
|
/// </summary>
|
||||||
public long BaddumpCount { get; set; } = 0;
|
public long BaddumpCount { get; set; } = 0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Number of items with the good status
|
||||||
|
/// </summary>
|
||||||
public long GoodCount { get; set; } = 0;
|
public long GoodCount { get; set; } = 0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Number of items with the nodump status
|
||||||
|
/// </summary>
|
||||||
public long NodumpCount { get; set; } = 0;
|
public long NodumpCount { get; set; } = 0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Number of items with the verified status
|
||||||
|
/// </summary>
|
||||||
public long VerifiedCount { get; set; } = 0;
|
public long VerifiedCount { get; set; } = 0;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
Reference in New Issue
Block a user