mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[DatHeader, DatStats] Round 1 cleanup
This commit is contained in:
@@ -1,6 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
using SabreTools.Library.Data;
|
using SabreTools.Library.Data;
|
||||||
|
|
||||||
namespace SabreTools.Library.DatFiles
|
namespace SabreTools.Library.DatFiles
|
||||||
@@ -10,212 +8,44 @@ namespace SabreTools.Library.DatFiles
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class DatHeader : ICloneable
|
public class DatHeader : ICloneable
|
||||||
{
|
{
|
||||||
#region Private instance variables
|
|
||||||
|
|
||||||
// Data common to most DAT types
|
|
||||||
private string _fileName;
|
|
||||||
private string _name;
|
|
||||||
private string _description;
|
|
||||||
private string _rootDir;
|
|
||||||
private string _category;
|
|
||||||
private string _version;
|
|
||||||
private string _date;
|
|
||||||
private string _author;
|
|
||||||
private string _email;
|
|
||||||
private string _homepage;
|
|
||||||
private string _url;
|
|
||||||
private string _comment;
|
|
||||||
private string _header;
|
|
||||||
private string _type; // Generally only used for SuperDAT
|
|
||||||
private ForceMerging _forceMerging;
|
|
||||||
private ForceNodump _forceNodump;
|
|
||||||
private ForcePacking _forcePacking;
|
|
||||||
private DatFormat _datFormat;
|
|
||||||
private bool[] _excludeFields = new bool[Enum.GetNames(typeof(Field)).Length];
|
|
||||||
private bool _oneRom;
|
|
||||||
private bool _keepEmptyGames;
|
|
||||||
private bool _sceneDateStrip;
|
|
||||||
private DedupeType _dedupeRoms;
|
|
||||||
private Hash _stripHash;
|
|
||||||
|
|
||||||
// Data (mostly) specific to the Miss DAT type
|
|
||||||
private bool _useRomName;
|
|
||||||
private string _prefix;
|
|
||||||
private string _postfix;
|
|
||||||
private bool _quotes;
|
|
||||||
private string _repExt;
|
|
||||||
private string _addExt;
|
|
||||||
private bool _remExt;
|
|
||||||
private bool _gameName;
|
|
||||||
private bool _romba;
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Publicly facing variables
|
#region Publicly facing variables
|
||||||
|
|
||||||
// Data common to most DAT types
|
// Data common to most DAT types
|
||||||
public string FileName
|
public string FileName { get; set; }
|
||||||
{
|
public string Name { get; set; }
|
||||||
get { return _fileName; }
|
public string Description { get; set; }
|
||||||
set { _fileName = value; }
|
public string RootDir { get; set; }
|
||||||
}
|
public string Category { get; set; }
|
||||||
public string Name
|
public string Version { get; set; }
|
||||||
{
|
public string Date { get; set; }
|
||||||
get { return _name; }
|
public string Author { get; set; }
|
||||||
set { _name = value; }
|
public string Email { get; set; }
|
||||||
}
|
public string Homepage { get; set; }
|
||||||
public string Description
|
public string Url { get; set; }
|
||||||
{
|
public string Comment { get; set; }
|
||||||
get { return _description; }
|
public string Header { get; set; }
|
||||||
set { _description = value; }
|
public string Type { get; set; } // Generally only used for SuperDAT
|
||||||
}
|
public ForceMerging ForceMerging { get; set; }
|
||||||
public string RootDir
|
public ForceNodump ForceNodump { get; set; }
|
||||||
{
|
public ForcePacking ForcePacking { get; set; }
|
||||||
get { return _rootDir; }
|
public DatFormat DatFormat { get; set; }
|
||||||
set { _rootDir = value; }
|
public bool[] ExcludeFields { get; set; } = new bool[Enum.GetNames(typeof(Field)).Length];
|
||||||
}
|
public bool OneRom { get; set; }
|
||||||
public string Category
|
public bool KeepEmptyGames { get; set; }
|
||||||
{
|
public bool SceneDateStrip { get; set; }
|
||||||
get { return _category; }
|
public DedupeType DedupeRoms { get; set; }
|
||||||
set { _category = value; }
|
public Hash StripHash { get; private set; }
|
||||||
}
|
|
||||||
public string Version
|
|
||||||
{
|
|
||||||
get { return _version; }
|
|
||||||
set { _version = value; }
|
|
||||||
}
|
|
||||||
public string Date
|
|
||||||
{
|
|
||||||
get { return _date; }
|
|
||||||
set { _date = value; }
|
|
||||||
}
|
|
||||||
public string Author
|
|
||||||
{
|
|
||||||
get { return _author; }
|
|
||||||
set { _author = value; }
|
|
||||||
}
|
|
||||||
public string Email
|
|
||||||
{
|
|
||||||
get { return _email; }
|
|
||||||
set { _email = value; }
|
|
||||||
}
|
|
||||||
public string Homepage
|
|
||||||
{
|
|
||||||
get { return _homepage; }
|
|
||||||
set { _homepage = value; }
|
|
||||||
}
|
|
||||||
public string Url
|
|
||||||
{
|
|
||||||
get { return _url; }
|
|
||||||
set { _url = value; }
|
|
||||||
}
|
|
||||||
public string Comment
|
|
||||||
{
|
|
||||||
get { return _comment; }
|
|
||||||
set { _comment = value; }
|
|
||||||
}
|
|
||||||
public string Header
|
|
||||||
{
|
|
||||||
get { return _header; }
|
|
||||||
set { _header = value; }
|
|
||||||
}
|
|
||||||
public string Type // Generally only used for SuperDAT
|
|
||||||
{
|
|
||||||
get { return _type; }
|
|
||||||
set { _type = value; }
|
|
||||||
}
|
|
||||||
public ForceMerging ForceMerging
|
|
||||||
{
|
|
||||||
get { return _forceMerging; }
|
|
||||||
set { _forceMerging = value; }
|
|
||||||
}
|
|
||||||
public ForceNodump ForceNodump
|
|
||||||
{
|
|
||||||
get { return _forceNodump; }
|
|
||||||
set { _forceNodump = value; }
|
|
||||||
}
|
|
||||||
public ForcePacking ForcePacking
|
|
||||||
{
|
|
||||||
get { return _forcePacking; }
|
|
||||||
set { _forcePacking = value; }
|
|
||||||
}
|
|
||||||
public DatFormat DatFormat
|
|
||||||
{
|
|
||||||
get { return _datFormat; }
|
|
||||||
set { _datFormat = value; }
|
|
||||||
}
|
|
||||||
public bool[] ExcludeFields
|
|
||||||
{
|
|
||||||
get { return _excludeFields; }
|
|
||||||
set { _excludeFields = value; }
|
|
||||||
}
|
|
||||||
public bool OneRom
|
|
||||||
{
|
|
||||||
get { return _oneRom; }
|
|
||||||
set { _oneRom = value; }
|
|
||||||
}
|
|
||||||
public bool KeepEmptyGames
|
|
||||||
{
|
|
||||||
get { return _keepEmptyGames; }
|
|
||||||
set { _keepEmptyGames = value; }
|
|
||||||
}
|
|
||||||
public bool SceneDateStrip
|
|
||||||
{
|
|
||||||
get { return _sceneDateStrip; }
|
|
||||||
set { _sceneDateStrip = value; }
|
|
||||||
}
|
|
||||||
public DedupeType DedupeRoms
|
|
||||||
{
|
|
||||||
get { return _dedupeRoms; }
|
|
||||||
set { _dedupeRoms = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
// Data specific to the Miss DAT type
|
// Data specific to the Miss DAT type
|
||||||
public bool UseRomName
|
public bool UseRomName { get; set; }
|
||||||
{
|
public string Prefix { get; set; }
|
||||||
get { return _useRomName; }
|
public string Postfix { get; set; }
|
||||||
set { _useRomName = value; }
|
public bool Quotes { get; set; }
|
||||||
}
|
public string ReplaceExtension { get; set; }
|
||||||
public string Prefix
|
public string AddExtension { get; set; }
|
||||||
{
|
public bool RemoveExtension { get; set; }
|
||||||
get { return _prefix; }
|
public bool GameName { get; set; }
|
||||||
set { _prefix = value; }
|
public bool Romba { get; set; }
|
||||||
}
|
|
||||||
public string Postfix
|
|
||||||
{
|
|
||||||
get { return _postfix; }
|
|
||||||
set { _postfix = value; }
|
|
||||||
}
|
|
||||||
public bool Quotes
|
|
||||||
{
|
|
||||||
get { return _quotes; }
|
|
||||||
set { _quotes = value; }
|
|
||||||
}
|
|
||||||
public string ReplaceExtension
|
|
||||||
{
|
|
||||||
get { return _repExt; }
|
|
||||||
set { _repExt = value; }
|
|
||||||
}
|
|
||||||
public string AddExtension
|
|
||||||
{
|
|
||||||
get { return _addExt; }
|
|
||||||
set { _addExt = value; }
|
|
||||||
}
|
|
||||||
public bool RemoveExtension
|
|
||||||
{
|
|
||||||
get { return _remExt; }
|
|
||||||
set { _remExt = value; }
|
|
||||||
}
|
|
||||||
public bool GameName
|
|
||||||
{
|
|
||||||
get { return _gameName; }
|
|
||||||
set { _gameName = value; }
|
|
||||||
}
|
|
||||||
public bool Romba
|
|
||||||
{
|
|
||||||
get { return _romba; }
|
|
||||||
set { _romba = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -231,40 +61,40 @@ namespace SabreTools.Library.DatFiles
|
|||||||
{
|
{
|
||||||
return new DatHeader()
|
return new DatHeader()
|
||||||
{
|
{
|
||||||
_fileName = this._fileName,
|
FileName = this.FileName,
|
||||||
_name = this._name,
|
Name = this.Name,
|
||||||
_description = this._description,
|
Description = this.Description,
|
||||||
_rootDir = this._rootDir,
|
RootDir = this.RootDir,
|
||||||
_category = this._category,
|
Category = this.Category,
|
||||||
_version = this._version,
|
Version = this.Version,
|
||||||
_date = this._date,
|
Date = this.Date,
|
||||||
_author = this._author,
|
Author = this.Author,
|
||||||
_email = this._email,
|
Email = this.Email,
|
||||||
_homepage = this._homepage,
|
Homepage = this.Homepage,
|
||||||
_url = this._url,
|
Url = this.Url,
|
||||||
_comment = this._comment,
|
Comment = this.Comment,
|
||||||
_header = this._header,
|
Header = this.Header,
|
||||||
_type = this._type,
|
Type = this.Type,
|
||||||
_forceMerging = this._forceMerging,
|
ForceMerging = this.ForceMerging,
|
||||||
_forceNodump = this._forceNodump,
|
ForceNodump = this.ForceNodump,
|
||||||
_forcePacking = this._forcePacking,
|
ForcePacking = this.ForcePacking,
|
||||||
_datFormat = this._datFormat,
|
DatFormat = this.DatFormat,
|
||||||
_excludeFields = this._excludeFields,
|
ExcludeFields = this.ExcludeFields,
|
||||||
_oneRom = this._oneRom,
|
OneRom = this.OneRom,
|
||||||
_keepEmptyGames = this._keepEmptyGames,
|
KeepEmptyGames = this.KeepEmptyGames,
|
||||||
_sceneDateStrip = this._sceneDateStrip,
|
SceneDateStrip = this.SceneDateStrip,
|
||||||
_dedupeRoms = this._dedupeRoms,
|
DedupeRoms = this.DedupeRoms,
|
||||||
_stripHash = this._stripHash,
|
StripHash = this.StripHash,
|
||||||
|
|
||||||
_useRomName = this._useRomName,
|
UseRomName = this.UseRomName,
|
||||||
_prefix = this._prefix,
|
Prefix = this.Prefix,
|
||||||
_postfix = this._postfix,
|
Postfix = this.Postfix,
|
||||||
_quotes = this._quotes,
|
Quotes = this.Quotes,
|
||||||
_repExt = this._repExt,
|
ReplaceExtension = this.ReplaceExtension,
|
||||||
_addExt = this._addExt,
|
AddExtension = this.AddExtension,
|
||||||
_remExt = this._remExt,
|
RemoveExtension = this.RemoveExtension,
|
||||||
_gameName = this._gameName,
|
GameName = this.GameName,
|
||||||
_romba = this._romba,
|
Romba = this.Romba,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,160 +12,46 @@ namespace SabreTools.Library.DatFiles
|
|||||||
{
|
{
|
||||||
#region Private instance variables
|
#region Private instance variables
|
||||||
|
|
||||||
// Statistics report format
|
|
||||||
private StatReportFormat _reportFormat = StatReportFormat.None;
|
|
||||||
|
|
||||||
// Object used to lock stats updates
|
// Object used to lock stats updates
|
||||||
private object _lockObject = new object();
|
private object _lockObject = new object();
|
||||||
|
|
||||||
// Overall item count
|
|
||||||
private long _count = 0;
|
|
||||||
|
|
||||||
// Individual DatItem type counts
|
|
||||||
private long _archiveCount = 0;
|
|
||||||
private long _biosSetCount = 0;
|
|
||||||
private long _diskCount = 0;
|
|
||||||
private long _releaseCount = 0;
|
|
||||||
private long _romCount = 0;
|
|
||||||
private long _sampleCount = 0;
|
|
||||||
|
|
||||||
// Special count only used by statistics output
|
|
||||||
private long _gameCount = 0;
|
|
||||||
|
|
||||||
// Total reported size
|
|
||||||
private long _totalSize = 0;
|
|
||||||
|
|
||||||
// Individual hash counts
|
|
||||||
private long _crcCount = 0;
|
|
||||||
private long _md5Count = 0;
|
|
||||||
private long _sha1Count = 0;
|
|
||||||
private long _sha256Count = 0;
|
|
||||||
private long _sha384Count = 0;
|
|
||||||
private long _sha512Count = 0;
|
|
||||||
|
|
||||||
// Individual status counts
|
|
||||||
private long _baddumpCount = 0;
|
|
||||||
private long _goodCount = 0;
|
|
||||||
private long _nodumpCount = 0;
|
|
||||||
private long _verifiedCount = 0;
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Publicly facing variables
|
#region Publicly facing variables
|
||||||
|
|
||||||
// Statistics report format
|
// Statistics report format
|
||||||
public StatReportFormat ReportFormat
|
public StatReportFormat ReportFormat { get; set; } = StatReportFormat.None;
|
||||||
{
|
|
||||||
get { return _reportFormat; }
|
|
||||||
set { _reportFormat = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
// Overall item count
|
// Overall item count
|
||||||
public long Count
|
public long Count { get; set; } = 0;
|
||||||
{
|
|
||||||
get { return _count; }
|
|
||||||
set { _count = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
// Individual DatItem type counts
|
// Individual DatItem type counts
|
||||||
public long ArchiveCount
|
public long ArchiveCount { get; set; } = 0;
|
||||||
{
|
public long BiosSetCount { get; set; } = 0;
|
||||||
get { return _archiveCount; }
|
public long DiskCount { get; set; } = 0;
|
||||||
set { _archiveCount = value; }
|
public long ReleaseCount { get; set; } = 0;
|
||||||
}
|
public long RomCount { get; set; } = 0;
|
||||||
public long BiosSetCount
|
public long SampleCount { get; set; } = 0;
|
||||||
{
|
|
||||||
get { return _biosSetCount; }
|
|
||||||
set { _biosSetCount = value; }
|
|
||||||
}
|
|
||||||
public long DiskCount
|
|
||||||
{
|
|
||||||
get { return _diskCount; }
|
|
||||||
set { _diskCount = value; }
|
|
||||||
}
|
|
||||||
public long ReleaseCount
|
|
||||||
{
|
|
||||||
get { return _releaseCount; }
|
|
||||||
set { _releaseCount = value; }
|
|
||||||
}
|
|
||||||
public long RomCount
|
|
||||||
{
|
|
||||||
get { return _romCount; }
|
|
||||||
set { _romCount = value; }
|
|
||||||
}
|
|
||||||
public long SampleCount
|
|
||||||
{
|
|
||||||
get { return _sampleCount; }
|
|
||||||
set { _sampleCount = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
// Special count only used by statistics output
|
// Special count only used by statistics output
|
||||||
public long GameCount
|
public long GameCount { get; set; } = 0;
|
||||||
{
|
|
||||||
get { return _gameCount; }
|
|
||||||
set { _gameCount = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
// Total reported size
|
// Total reported size
|
||||||
public long TotalSize
|
public long TotalSize { get; set; } = 0;
|
||||||
{
|
|
||||||
get { return _totalSize; }
|
|
||||||
set { _totalSize = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
// Individual hash counts
|
// Individual hash counts
|
||||||
public long CRCCount
|
public long CRCCount { get; set; } = 0;
|
||||||
{
|
public long MD5Count { get; set; } = 0;
|
||||||
get { return _crcCount; }
|
public long SHA1Count { get; set; } = 0;
|
||||||
set { _crcCount = value; }
|
public long SHA256Count { get; set; } = 0;
|
||||||
}
|
public long SHA384Count { get; set; } = 0;
|
||||||
public long MD5Count
|
public long SHA512Count { get; set; } = 0;
|
||||||
{
|
|
||||||
get { return _md5Count; }
|
|
||||||
set { _md5Count = value; }
|
|
||||||
}
|
|
||||||
public long SHA1Count
|
|
||||||
{
|
|
||||||
get { return _sha1Count; }
|
|
||||||
set { _sha1Count = value; }
|
|
||||||
}
|
|
||||||
public long SHA256Count
|
|
||||||
{
|
|
||||||
get { return _sha256Count; }
|
|
||||||
set { _sha256Count = value; }
|
|
||||||
}
|
|
||||||
public long SHA384Count
|
|
||||||
{
|
|
||||||
get { return _sha384Count; }
|
|
||||||
set { _sha384Count = value; }
|
|
||||||
}
|
|
||||||
public long SHA512Count
|
|
||||||
{
|
|
||||||
get { return _sha512Count; }
|
|
||||||
set { _sha512Count = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
// Individual status counts
|
// Individual status counts
|
||||||
public long BaddumpCount
|
public long BaddumpCount { get; set; } = 0;
|
||||||
{
|
public long GoodCount { get; set; } = 0;
|
||||||
get { return _baddumpCount; }
|
public long NodumpCount { get; set; } = 0;
|
||||||
set { _baddumpCount = value; }
|
public long VerifiedCount { get; set; } = 0;
|
||||||
}
|
|
||||||
public long GoodCount
|
|
||||||
{
|
|
||||||
get { return _goodCount; }
|
|
||||||
set { _goodCount = value; }
|
|
||||||
}
|
|
||||||
public long NodumpCount
|
|
||||||
{
|
|
||||||
get { return _nodumpCount; }
|
|
||||||
set { _nodumpCount = value; }
|
|
||||||
}
|
|
||||||
public long VerifiedCount
|
|
||||||
{
|
|
||||||
get { return _verifiedCount; }
|
|
||||||
set { _verifiedCount = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -180,57 +66,57 @@ namespace SabreTools.Library.DatFiles
|
|||||||
// No matter what the item is, we increate the count
|
// No matter what the item is, we increate the count
|
||||||
lock (_lockObject)
|
lock (_lockObject)
|
||||||
{
|
{
|
||||||
_count += 1;
|
this.Count += 1;
|
||||||
|
|
||||||
// Now we do different things for each item type
|
// Now we do different things for each item type
|
||||||
|
|
||||||
switch (item.Type)
|
switch (item.Type)
|
||||||
{
|
{
|
||||||
case ItemType.Archive:
|
case ItemType.Archive:
|
||||||
_archiveCount += 1;
|
this.ArchiveCount += 1;
|
||||||
break;
|
break;
|
||||||
case ItemType.BiosSet:
|
case ItemType.BiosSet:
|
||||||
_biosSetCount += 1;
|
this.BiosSetCount += 1;
|
||||||
break;
|
break;
|
||||||
case ItemType.Disk:
|
case ItemType.Disk:
|
||||||
_diskCount += 1;
|
this.DiskCount += 1;
|
||||||
if (((Disk)item).ItemStatus != ItemStatus.Nodump)
|
if (((Disk)item).ItemStatus != ItemStatus.Nodump)
|
||||||
{
|
{
|
||||||
_md5Count += (String.IsNullOrWhiteSpace(((Disk)item).MD5) ? 0 : 1);
|
this.MD5Count += (String.IsNullOrWhiteSpace(((Disk)item).MD5) ? 0 : 1);
|
||||||
_sha1Count += (String.IsNullOrWhiteSpace(((Disk)item).SHA1) ? 0 : 1);
|
this.SHA1Count += (String.IsNullOrWhiteSpace(((Disk)item).SHA1) ? 0 : 1);
|
||||||
_sha256Count += (String.IsNullOrWhiteSpace(((Disk)item).SHA256) ? 0 : 1);
|
this.SHA256Count += (String.IsNullOrWhiteSpace(((Disk)item).SHA256) ? 0 : 1);
|
||||||
_sha384Count += (String.IsNullOrWhiteSpace(((Disk)item).SHA384) ? 0 : 1);
|
this.SHA384Count += (String.IsNullOrWhiteSpace(((Disk)item).SHA384) ? 0 : 1);
|
||||||
_sha512Count += (String.IsNullOrWhiteSpace(((Disk)item).SHA512) ? 0 : 1);
|
this.SHA512Count += (String.IsNullOrWhiteSpace(((Disk)item).SHA512) ? 0 : 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
_baddumpCount += (((Disk)item).ItemStatus == ItemStatus.BadDump ? 1 : 0);
|
this.BaddumpCount += (((Disk)item).ItemStatus == ItemStatus.BadDump ? 1 : 0);
|
||||||
_goodCount += (((Disk)item).ItemStatus == ItemStatus.Good ? 1 : 0);
|
this.GoodCount += (((Disk)item).ItemStatus == ItemStatus.Good ? 1 : 0);
|
||||||
_nodumpCount += (((Disk)item).ItemStatus == ItemStatus.Nodump ? 1 : 0);
|
this.NodumpCount += (((Disk)item).ItemStatus == ItemStatus.Nodump ? 1 : 0);
|
||||||
_verifiedCount += (((Disk)item).ItemStatus == ItemStatus.Verified ? 1 : 0);
|
this.VerifiedCount += (((Disk)item).ItemStatus == ItemStatus.Verified ? 1 : 0);
|
||||||
break;
|
break;
|
||||||
case ItemType.Release:
|
case ItemType.Release:
|
||||||
_releaseCount += 1;
|
this.ReleaseCount += 1;
|
||||||
break;
|
break;
|
||||||
case ItemType.Rom:
|
case ItemType.Rom:
|
||||||
_romCount += 1;
|
this.RomCount += 1;
|
||||||
if (((Rom)item).ItemStatus != ItemStatus.Nodump)
|
if (((Rom)item).ItemStatus != ItemStatus.Nodump)
|
||||||
{
|
{
|
||||||
_totalSize += ((Rom)item).Size;
|
this.TotalSize += ((Rom)item).Size;
|
||||||
_crcCount += (String.IsNullOrWhiteSpace(((Rom)item).CRC) ? 0 : 1);
|
this.CRCCount += (String.IsNullOrWhiteSpace(((Rom)item).CRC) ? 0 : 1);
|
||||||
_md5Count += (String.IsNullOrWhiteSpace(((Rom)item).MD5) ? 0 : 1);
|
this.MD5Count += (String.IsNullOrWhiteSpace(((Rom)item).MD5) ? 0 : 1);
|
||||||
_sha1Count += (String.IsNullOrWhiteSpace(((Rom)item).SHA1) ? 0 : 1);
|
this.SHA1Count += (String.IsNullOrWhiteSpace(((Rom)item).SHA1) ? 0 : 1);
|
||||||
_sha256Count += (String.IsNullOrWhiteSpace(((Rom)item).SHA256) ? 0 : 1);
|
this.SHA256Count += (String.IsNullOrWhiteSpace(((Rom)item).SHA256) ? 0 : 1);
|
||||||
_sha384Count += (String.IsNullOrWhiteSpace(((Rom)item).SHA384) ? 0 : 1);
|
this.SHA384Count += (String.IsNullOrWhiteSpace(((Rom)item).SHA384) ? 0 : 1);
|
||||||
_sha512Count += (String.IsNullOrWhiteSpace(((Rom)item).SHA512) ? 0 : 1);
|
this.SHA512Count += (String.IsNullOrWhiteSpace(((Rom)item).SHA512) ? 0 : 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
_baddumpCount += (((Rom)item).ItemStatus == ItemStatus.BadDump ? 1 : 0);
|
this.BaddumpCount += (((Rom)item).ItemStatus == ItemStatus.BadDump ? 1 : 0);
|
||||||
_goodCount += (((Rom)item).ItemStatus == ItemStatus.Good ? 1 : 0);
|
this.GoodCount += (((Rom)item).ItemStatus == ItemStatus.Good ? 1 : 0);
|
||||||
_nodumpCount += (((Rom)item).ItemStatus == ItemStatus.Nodump ? 1 : 0);
|
this.NodumpCount += (((Rom)item).ItemStatus == ItemStatus.Nodump ? 1 : 0);
|
||||||
_verifiedCount += (((Rom)item).ItemStatus == ItemStatus.Verified ? 1 : 0);
|
this.VerifiedCount += (((Rom)item).ItemStatus == ItemStatus.Verified ? 1 : 0);
|
||||||
break;
|
break;
|
||||||
case ItemType.Sample:
|
case ItemType.Sample:
|
||||||
_sampleCount += 1;
|
this.SampleCount += 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -242,32 +128,32 @@ namespace SabreTools.Library.DatFiles
|
|||||||
/// <param name="stats">DatStats object to add from</param>
|
/// <param name="stats">DatStats object to add from</param>
|
||||||
public void AddStats(DatStats stats)
|
public void AddStats(DatStats stats)
|
||||||
{
|
{
|
||||||
_count += stats.Count;
|
this.Count += stats.Count;
|
||||||
|
|
||||||
_archiveCount += stats.ArchiveCount;
|
this.ArchiveCount += stats.ArchiveCount;
|
||||||
_biosSetCount += stats.BiosSetCount;
|
this.BiosSetCount += stats.BiosSetCount;
|
||||||
_diskCount += stats.DiskCount;
|
this.DiskCount += stats.DiskCount;
|
||||||
_releaseCount += stats.ReleaseCount;
|
this.ReleaseCount += stats.ReleaseCount;
|
||||||
_romCount += stats.RomCount;
|
this.RomCount += stats.RomCount;
|
||||||
_sampleCount += stats.SampleCount;
|
this.SampleCount += stats.SampleCount;
|
||||||
|
|
||||||
_gameCount += stats.GameCount;
|
this.GameCount += stats.GameCount;
|
||||||
|
|
||||||
_totalSize += stats.TotalSize;
|
this.TotalSize += stats.TotalSize;
|
||||||
|
|
||||||
// Individual hash counts
|
// Individual hash counts
|
||||||
_crcCount += stats.CRCCount;
|
this.CRCCount += stats.CRCCount;
|
||||||
_md5Count += stats.MD5Count;
|
this.MD5Count += stats.MD5Count;
|
||||||
_sha1Count += stats.SHA1Count;
|
this.SHA1Count += stats.SHA1Count;
|
||||||
_sha256Count += stats.SHA256Count;
|
this.SHA256Count += stats.SHA256Count;
|
||||||
_sha384Count += stats.SHA384Count;
|
this.SHA384Count += stats.SHA384Count;
|
||||||
_sha512Count += stats.SHA512Count;
|
this.SHA512Count += stats.SHA512Count;
|
||||||
|
|
||||||
// Individual status counts
|
// Individual status counts
|
||||||
_baddumpCount += stats.BaddumpCount;
|
this.BaddumpCount += stats.BaddumpCount;
|
||||||
_goodCount += stats.GoodCount;
|
this.GoodCount += stats.GoodCount;
|
||||||
_nodumpCount += stats.NodumpCount;
|
this.NodumpCount += stats.NodumpCount;
|
||||||
_verifiedCount += stats.VerifiedCount;
|
this.VerifiedCount += stats.VerifiedCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -279,57 +165,57 @@ namespace SabreTools.Library.DatFiles
|
|||||||
// No matter what the item is, we increate the count
|
// No matter what the item is, we increate the count
|
||||||
lock (_lockObject)
|
lock (_lockObject)
|
||||||
{
|
{
|
||||||
_count -= 1;
|
this.Count -= 1;
|
||||||
|
|
||||||
// Now we do different things for each item type
|
// Now we do different things for each item type
|
||||||
|
|
||||||
switch (item.Type)
|
switch (item.Type)
|
||||||
{
|
{
|
||||||
case ItemType.Archive:
|
case ItemType.Archive:
|
||||||
_archiveCount -= 1;
|
this.ArchiveCount -= 1;
|
||||||
break;
|
break;
|
||||||
case ItemType.BiosSet:
|
case ItemType.BiosSet:
|
||||||
_biosSetCount -= 1;
|
this.BiosSetCount -= 1;
|
||||||
break;
|
break;
|
||||||
case ItemType.Disk:
|
case ItemType.Disk:
|
||||||
_diskCount -= 1;
|
this.DiskCount -= 1;
|
||||||
if (((Disk)item).ItemStatus != ItemStatus.Nodump)
|
if (((Disk)item).ItemStatus != ItemStatus.Nodump)
|
||||||
{
|
{
|
||||||
_md5Count -= (String.IsNullOrWhiteSpace(((Disk)item).MD5) ? 0 : 1);
|
this.MD5Count -= (String.IsNullOrWhiteSpace(((Disk)item).MD5) ? 0 : 1);
|
||||||
_sha1Count -= (String.IsNullOrWhiteSpace(((Disk)item).SHA1) ? 0 : 1);
|
this.SHA1Count -= (String.IsNullOrWhiteSpace(((Disk)item).SHA1) ? 0 : 1);
|
||||||
_sha256Count -= (String.IsNullOrWhiteSpace(((Disk)item).SHA256) ? 0 : 1);
|
this.SHA256Count -= (String.IsNullOrWhiteSpace(((Disk)item).SHA256) ? 0 : 1);
|
||||||
_sha384Count -= (String.IsNullOrWhiteSpace(((Disk)item).SHA384) ? 0 : 1);
|
this.SHA384Count -= (String.IsNullOrWhiteSpace(((Disk)item).SHA384) ? 0 : 1);
|
||||||
_sha512Count -= (String.IsNullOrWhiteSpace(((Disk)item).SHA512) ? 0 : 1);
|
this.SHA512Count -= (String.IsNullOrWhiteSpace(((Disk)item).SHA512) ? 0 : 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
_baddumpCount -= (((Disk)item).ItemStatus == ItemStatus.BadDump ? 1 : 0);
|
this.BaddumpCount -= (((Disk)item).ItemStatus == ItemStatus.BadDump ? 1 : 0);
|
||||||
_goodCount -= (((Disk)item).ItemStatus == ItemStatus.Good ? 1 : 0);
|
this.GoodCount -= (((Disk)item).ItemStatus == ItemStatus.Good ? 1 : 0);
|
||||||
_nodumpCount -= (((Disk)item).ItemStatus == ItemStatus.Nodump ? 1 : 0);
|
this.NodumpCount -= (((Disk)item).ItemStatus == ItemStatus.Nodump ? 1 : 0);
|
||||||
_verifiedCount -= (((Disk)item).ItemStatus == ItemStatus.Verified ? 1 : 0);
|
this.VerifiedCount -= (((Disk)item).ItemStatus == ItemStatus.Verified ? 1 : 0);
|
||||||
break;
|
break;
|
||||||
case ItemType.Release:
|
case ItemType.Release:
|
||||||
_releaseCount -= 1;
|
this.ReleaseCount -= 1;
|
||||||
break;
|
break;
|
||||||
case ItemType.Rom:
|
case ItemType.Rom:
|
||||||
_romCount -= 1;
|
this.RomCount -= 1;
|
||||||
if (((Rom)item).ItemStatus != ItemStatus.Nodump)
|
if (((Rom)item).ItemStatus != ItemStatus.Nodump)
|
||||||
{
|
{
|
||||||
_totalSize -= ((Rom)item).Size;
|
this.TotalSize -= ((Rom)item).Size;
|
||||||
_crcCount -= (String.IsNullOrWhiteSpace(((Rom)item).CRC) ? 0 : 1);
|
this.CRCCount -= (String.IsNullOrWhiteSpace(((Rom)item).CRC) ? 0 : 1);
|
||||||
_md5Count -= (String.IsNullOrWhiteSpace(((Rom)item).MD5) ? 0 : 1);
|
this.MD5Count -= (String.IsNullOrWhiteSpace(((Rom)item).MD5) ? 0 : 1);
|
||||||
_sha1Count -= (String.IsNullOrWhiteSpace(((Rom)item).SHA1) ? 0 : 1);
|
this.SHA1Count -= (String.IsNullOrWhiteSpace(((Rom)item).SHA1) ? 0 : 1);
|
||||||
_sha256Count -= (String.IsNullOrWhiteSpace(((Rom)item).SHA256) ? 0 : 1);
|
this.SHA256Count -= (String.IsNullOrWhiteSpace(((Rom)item).SHA256) ? 0 : 1);
|
||||||
_sha384Count -= (String.IsNullOrWhiteSpace(((Rom)item).SHA384) ? 0 : 1);
|
this.SHA384Count -= (String.IsNullOrWhiteSpace(((Rom)item).SHA384) ? 0 : 1);
|
||||||
_sha512Count -= (String.IsNullOrWhiteSpace(((Rom)item).SHA512) ? 0 : 1);
|
this.SHA512Count -= (String.IsNullOrWhiteSpace(((Rom)item).SHA512) ? 0 : 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
_baddumpCount -= (((Rom)item).ItemStatus == ItemStatus.BadDump ? 1 : 0);
|
this.BaddumpCount -= (((Rom)item).ItemStatus == ItemStatus.BadDump ? 1 : 0);
|
||||||
_goodCount -= (((Rom)item).ItemStatus == ItemStatus.Good ? 1 : 0);
|
this.GoodCount -= (((Rom)item).ItemStatus == ItemStatus.Good ? 1 : 0);
|
||||||
_nodumpCount -= (((Rom)item).ItemStatus == ItemStatus.Nodump ? 1 : 0);
|
this.NodumpCount -= (((Rom)item).ItemStatus == ItemStatus.Nodump ? 1 : 0);
|
||||||
_verifiedCount -= (((Rom)item).ItemStatus == ItemStatus.Verified ? 1 : 0);
|
this.VerifiedCount -= (((Rom)item).ItemStatus == ItemStatus.Verified ? 1 : 0);
|
||||||
break;
|
break;
|
||||||
case ItemType.Sample:
|
case ItemType.Sample:
|
||||||
_sampleCount -= 1;
|
this.SampleCount -= 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -340,30 +226,30 @@ namespace SabreTools.Library.DatFiles
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void Reset()
|
public void Reset()
|
||||||
{
|
{
|
||||||
_count = 0;
|
this.Count = 0;
|
||||||
|
|
||||||
_archiveCount = 0;
|
this.ArchiveCount = 0;
|
||||||
_biosSetCount = 0;
|
this.BiosSetCount = 0;
|
||||||
_diskCount = 0;
|
this.DiskCount = 0;
|
||||||
_releaseCount = 0;
|
this.ReleaseCount = 0;
|
||||||
_romCount = 0;
|
this.RomCount = 0;
|
||||||
_sampleCount = 0;
|
this.SampleCount = 0;
|
||||||
|
|
||||||
_gameCount = 0;
|
this.GameCount = 0;
|
||||||
|
|
||||||
_totalSize = 0;
|
this.TotalSize = 0;
|
||||||
|
|
||||||
_crcCount = 0;
|
this.CRCCount = 0;
|
||||||
_md5Count = 0;
|
this.MD5Count = 0;
|
||||||
_sha1Count = 0;
|
this.SHA1Count = 0;
|
||||||
_sha256Count = 0;
|
this.SHA256Count = 0;
|
||||||
_sha384Count = 0;
|
this.SHA384Count = 0;
|
||||||
_sha512Count = 0;
|
this.SHA512Count = 0;
|
||||||
|
|
||||||
_baddumpCount = 0;
|
this.BaddumpCount = 0;
|
||||||
_goodCount = 0;
|
this.GoodCount = 0;
|
||||||
_nodumpCount = 0;
|
this.NodumpCount = 0;
|
||||||
_verifiedCount = 0;
|
this.VerifiedCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion // Instance Methods
|
#endregion // Instance Methods
|
||||||
|
|||||||
Reference in New Issue
Block a user