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