[DatHeader, DatStats] Round 1 cleanup

This commit is contained in:
Matt Nadareski
2019-01-08 11:06:26 -08:00
parent cc3c360c28
commit e2b65b7acd
2 changed files with 304 additions and 588 deletions

View File

@@ -1,275 +1,105 @@
using System; using System;
using System.Collections.Generic;
using SabreTools.Library.Data; using SabreTools.Library.Data;
namespace SabreTools.Library.DatFiles namespace SabreTools.Library.DatFiles
{ {
/// <summary> /// <summary>
/// Represents all possible DAT header information /// Represents all possible DAT header information
/// </summary> /// </summary>
public class DatHeader : ICloneable public class DatHeader : ICloneable
{ {
#region Private instance variables #region Publicly facing variables
// Data common to most DAT types // Data common to most DAT types
private string _fileName; public string FileName { get; set; }
private string _name; public string Name { get; set; }
private string _description; public string Description { get; set; }
private string _rootDir; public string RootDir { get; set; }
private string _category; public string Category { get; set; }
private string _version; public string Version { get; set; }
private string _date; public string Date { get; set; }
private string _author; public string Author { get; set; }
private string _email; public string Email { get; set; }
private string _homepage; public string Homepage { get; set; }
private string _url; public string Url { get; set; }
private string _comment; public string Comment { get; set; }
private string _header; public string Header { get; set; }
private string _type; // Generally only used for SuperDAT public string Type { get; set; } // Generally only used for SuperDAT
private ForceMerging _forceMerging; public ForceMerging ForceMerging { get; set; }
private ForceNodump _forceNodump; public ForceNodump ForceNodump { get; set; }
private ForcePacking _forcePacking; public ForcePacking ForcePacking { get; set; }
private DatFormat _datFormat; public DatFormat DatFormat { get; set; }
private bool[] _excludeFields = new bool[Enum.GetNames(typeof(Field)).Length]; public bool[] ExcludeFields { get; set; } = new bool[Enum.GetNames(typeof(Field)).Length];
private bool _oneRom; public bool OneRom { get; set; }
private bool _keepEmptyGames; public bool KeepEmptyGames { get; set; }
private bool _sceneDateStrip; public bool SceneDateStrip { get; set; }
private DedupeType _dedupeRoms; public DedupeType DedupeRoms { get; set; }
private Hash _stripHash; public Hash StripHash { get; private set; }
// Data (mostly) specific to the Miss DAT type // Data specific to the Miss DAT type
private bool _useRomName; public bool UseRomName { get; set; }
private string _prefix; public string Prefix { get; set; }
private string _postfix; public string Postfix { get; set; }
private bool _quotes; public bool Quotes { get; set; }
private string _repExt; public string ReplaceExtension { get; set; }
private string _addExt; public string AddExtension { get; set; }
private bool _remExt; public bool RemoveExtension { get; set; }
private bool _gameName; public bool GameName { get; set; }
private bool _romba; public bool Romba { get; set; }
#endregion #endregion
#region Publicly facing variables #region Instance Methods
// Data common to most DAT types #region Cloning Methods
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; }
}
// Data specific to the Miss DAT type /// <summary>
public bool UseRomName /// Clone the current header
{ /// </summary>
get { return _useRomName; } /// <returns></returns>
set { _useRomName = value; } public object Clone()
} {
public string Prefix return new DatHeader()
{ {
get { return _prefix; } FileName = this.FileName,
set { _prefix = value; } Name = this.Name,
} Description = this.Description,
public string Postfix RootDir = this.RootDir,
{ Category = this.Category,
get { return _postfix; } Version = this.Version,
set { _postfix = value; } Date = this.Date,
} Author = this.Author,
public bool Quotes Email = this.Email,
{ Homepage = this.Homepage,
get { return _quotes; } Url = this.Url,
set { _quotes = value; } Comment = this.Comment,
} Header = this.Header,
public string ReplaceExtension Type = this.Type,
{ ForceMerging = this.ForceMerging,
get { return _repExt; } ForceNodump = this.ForceNodump,
set { _repExt = value; } ForcePacking = this.ForcePacking,
} DatFormat = this.DatFormat,
public string AddExtension ExcludeFields = this.ExcludeFields,
{ OneRom = this.OneRom,
get { return _addExt; } KeepEmptyGames = this.KeepEmptyGames,
set { _addExt = value; } SceneDateStrip = this.SceneDateStrip,
} DedupeRoms = this.DedupeRoms,
public bool RemoveExtension StripHash = this.StripHash,
{
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 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,
};
}
#region Instance Methods #endregion
#region Cloning Methods #endregion // Instance Methods
}
/// <summary>
/// Clone the current header
/// </summary>
/// <returns></returns>
public object Clone()
{
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,
_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,
};
}
#endregion
#endregion // Instance Methods
}
} }

View File

@@ -5,367 +5,253 @@ using SabreTools.Library.DatItems;
namespace SabreTools.Library.DatFiles namespace SabreTools.Library.DatFiles
{ {
/// <summary> /// <summary>
/// Represents statistical data associated with a DAT /// Represents statistical data associated with a DAT
/// </summary> /// </summary>
public class DatStats public class DatStats
{ {
#region Private instance variables #region Private instance variables
// Statistics report format // Object used to lock stats updates
private StatReportFormat _reportFormat = StatReportFormat.None; private object _lockObject = new object();
// Object used to lock stats updates #endregion
private object _lockObject = new object();
// Overall item count #region Publicly facing variables
private long _count = 0;
// Individual DatItem type counts // Statistics report format
private long _archiveCount = 0; public StatReportFormat ReportFormat { get; set; } = StatReportFormat.None;
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 // Overall item count
private long _gameCount = 0; public long Count { get; set; } = 0;
// Total reported size // Individual DatItem type counts
private long _totalSize = 0; 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;
// Individual hash counts // Special count only used by statistics output
private long _crcCount = 0; public long GameCount { get; set; } = 0;
private long _md5Count = 0;
private long _sha1Count = 0;
private long _sha256Count = 0;
private long _sha384Count = 0;
private long _sha512Count = 0;
// Individual status counts // Total reported size
private long _baddumpCount = 0; public long TotalSize { get; set; } = 0;
private long _goodCount = 0;
private long _nodumpCount = 0;
private long _verifiedCount = 0;
#endregion // Individual hash counts
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;
#region Publicly facing variables // Individual status counts
public long BaddumpCount { get; set; } = 0;
public long GoodCount { get; set; } = 0;
public long NodumpCount { get; set; } = 0;
public long VerifiedCount { get; set; } = 0;
// Statistics report format #endregion
public StatReportFormat ReportFormat
{
get { return _reportFormat; }
set { _reportFormat = value; }
}
// Overall item count #region Instance Methods
public long Count
{
get { return _count; }
set { _count = value; }
}
// Individual DatItem type counts /// <summary>
public long ArchiveCount /// Add to the statistics given a DatItem
{ /// </summary>
get { return _archiveCount; } /// <param name="item">Item to add info from</param>
set { _archiveCount = value; } public void AddItem(DatItem item)
} {
public long BiosSetCount // No matter what the item is, we increate the count
{ lock (_lockObject)
get { return _biosSetCount; } {
set { _biosSetCount = value; } this.Count += 1;
}
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 // Now we do different things for each item type
public long GameCount
{
get { return _gameCount; }
set { _gameCount = value; }
}
// Total reported size switch (item.Type)
public long TotalSize {
{ case ItemType.Archive:
get { return _totalSize; } this.ArchiveCount += 1;
set { _totalSize = value; } break;
} case ItemType.BiosSet:
this.BiosSetCount += 1;
break;
case ItemType.Disk:
this.DiskCount += 1;
if (((Disk)item).ItemStatus != ItemStatus.Nodump)
{
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);
}
// Individual hash counts this.BaddumpCount += (((Disk)item).ItemStatus == ItemStatus.BadDump ? 1 : 0);
public long CRCCount this.GoodCount += (((Disk)item).ItemStatus == ItemStatus.Good ? 1 : 0);
{ this.NodumpCount += (((Disk)item).ItemStatus == ItemStatus.Nodump ? 1 : 0);
get { return _crcCount; } this.VerifiedCount += (((Disk)item).ItemStatus == ItemStatus.Verified ? 1 : 0);
set { _crcCount = value; } break;
} case ItemType.Release:
public long MD5Count this.ReleaseCount += 1;
{ break;
get { return _md5Count; } case ItemType.Rom:
set { _md5Count = value; } this.RomCount += 1;
} if (((Rom)item).ItemStatus != ItemStatus.Nodump)
public long SHA1Count {
{ this.TotalSize += ((Rom)item).Size;
get { return _sha1Count; } this.CRCCount += (String.IsNullOrWhiteSpace(((Rom)item).CRC) ? 0 : 1);
set { _sha1Count = value; } this.MD5Count += (String.IsNullOrWhiteSpace(((Rom)item).MD5) ? 0 : 1);
} this.SHA1Count += (String.IsNullOrWhiteSpace(((Rom)item).SHA1) ? 0 : 1);
public long SHA256Count this.SHA256Count += (String.IsNullOrWhiteSpace(((Rom)item).SHA256) ? 0 : 1);
{ this.SHA384Count += (String.IsNullOrWhiteSpace(((Rom)item).SHA384) ? 0 : 1);
get { return _sha256Count; } this.SHA512Count += (String.IsNullOrWhiteSpace(((Rom)item).SHA512) ? 0 : 1);
set { _sha256Count = value; } }
}
public long SHA384Count
{
get { return _sha384Count; }
set { _sha384Count = value; }
}
public long SHA512Count
{
get { return _sha512Count; }
set { _sha512Count = value; }
}
// Individual status counts this.BaddumpCount += (((Rom)item).ItemStatus == ItemStatus.BadDump ? 1 : 0);
public long BaddumpCount this.GoodCount += (((Rom)item).ItemStatus == ItemStatus.Good ? 1 : 0);
{ this.NodumpCount += (((Rom)item).ItemStatus == ItemStatus.Nodump ? 1 : 0);
get { return _baddumpCount; } this.VerifiedCount += (((Rom)item).ItemStatus == ItemStatus.Verified ? 1 : 0);
set { _baddumpCount = value; } break;
} case ItemType.Sample:
public long GoodCount this.SampleCount += 1;
{ break;
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 /// <summary>
/// Add statistics from another DatStats object
/// </summary>
/// <param name="stats">DatStats object to add from</param>
public void AddStats(DatStats stats)
{
this.Count += stats.Count;
#region Instance Methods this.ArchiveCount += stats.ArchiveCount;
this.BiosSetCount += stats.BiosSetCount;
this.DiskCount += stats.DiskCount;
this.ReleaseCount += stats.ReleaseCount;
this.RomCount += stats.RomCount;
this.SampleCount += stats.SampleCount;
/// <summary> this.GameCount += stats.GameCount;
/// Add to the statistics given a DatItem
/// </summary>
/// <param name="item">Item to add info from</param>
public void AddItem(DatItem item)
{
// No matter what the item is, we increate the count
lock (_lockObject)
{
_count += 1;
// Now we do different things for each item type this.TotalSize += stats.TotalSize;
switch (item.Type) // Individual hash counts
{ this.CRCCount += stats.CRCCount;
case ItemType.Archive: this.MD5Count += stats.MD5Count;
_archiveCount += 1; this.SHA1Count += stats.SHA1Count;
break; this.SHA256Count += stats.SHA256Count;
case ItemType.BiosSet: this.SHA384Count += stats.SHA384Count;
_biosSetCount += 1; this.SHA512Count += stats.SHA512Count;
break;
case ItemType.Disk:
_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);
}
_baddumpCount += (((Disk)item).ItemStatus == ItemStatus.BadDump ? 1 : 0); // Individual status counts
_goodCount += (((Disk)item).ItemStatus == ItemStatus.Good ? 1 : 0); this.BaddumpCount += stats.BaddumpCount;
_nodumpCount += (((Disk)item).ItemStatus == ItemStatus.Nodump ? 1 : 0); this.GoodCount += stats.GoodCount;
_verifiedCount += (((Disk)item).ItemStatus == ItemStatus.Verified ? 1 : 0); this.NodumpCount += stats.NodumpCount;
break; this.VerifiedCount += stats.VerifiedCount;
case ItemType.Release: }
_releaseCount += 1;
break;
case ItemType.Rom:
_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);
}
_baddumpCount += (((Rom)item).ItemStatus == ItemStatus.BadDump ? 1 : 0); /// <summary>
_goodCount += (((Rom)item).ItemStatus == ItemStatus.Good ? 1 : 0); /// Remove from the statistics given a DatItem
_nodumpCount += (((Rom)item).ItemStatus == ItemStatus.Nodump ? 1 : 0); /// </summary>
_verifiedCount += (((Rom)item).ItemStatus == ItemStatus.Verified ? 1 : 0); /// <param name="item">Item to remove info for</param>
break; public void RemoveItem(DatItem item)
case ItemType.Sample: {
_sampleCount += 1; // No matter what the item is, we increate the count
break; lock (_lockObject)
} {
} this.Count -= 1;
}
/// <summary> // Now we do different things for each item type
/// Add statistics from another DatStats object
/// </summary>
/// <param name="stats">DatStats object to add from</param>
public void AddStats(DatStats stats)
{
_count += stats.Count;
_archiveCount += stats.ArchiveCount; switch (item.Type)
_biosSetCount += stats.BiosSetCount; {
_diskCount += stats.DiskCount; case ItemType.Archive:
_releaseCount += stats.ReleaseCount; this.ArchiveCount -= 1;
_romCount += stats.RomCount; break;
_sampleCount += stats.SampleCount; case ItemType.BiosSet:
this.BiosSetCount -= 1;
break;
case ItemType.Disk:
this.DiskCount -= 1;
if (((Disk)item).ItemStatus != ItemStatus.Nodump)
{
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);
}
_gameCount += stats.GameCount; 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:
this.ReleaseCount -= 1;
break;
case ItemType.Rom:
this.RomCount -= 1;
if (((Rom)item).ItemStatus != ItemStatus.Nodump)
{
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);
}
_totalSize += stats.TotalSize; 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:
this.SampleCount -= 1;
break;
}
}
}
// Individual hash counts /// <summary>
_crcCount += stats.CRCCount; /// Reset all statistics
_md5Count += stats.MD5Count; /// </summary>
_sha1Count += stats.SHA1Count; public void Reset()
_sha256Count += stats.SHA256Count; {
_sha384Count += stats.SHA384Count; this.Count = 0;
_sha512Count += stats.SHA512Count;
// Individual status counts this.ArchiveCount = 0;
_baddumpCount += stats.BaddumpCount; this.BiosSetCount = 0;
_goodCount += stats.GoodCount; this.DiskCount = 0;
_nodumpCount += stats.NodumpCount; this.ReleaseCount = 0;
_verifiedCount += stats.VerifiedCount; this.RomCount = 0;
} this.SampleCount = 0;
/// <summary> this.GameCount = 0;
/// Remove from the statistics given a DatItem
/// </summary>
/// <param name="item">Item to remove info for</param>
public void RemoveItem(DatItem item)
{
// No matter what the item is, we increate the count
lock (_lockObject)
{
_count -= 1;
// Now we do different things for each item type this.TotalSize = 0;
switch (item.Type) this.CRCCount = 0;
{ this.MD5Count = 0;
case ItemType.Archive: this.SHA1Count = 0;
_archiveCount -= 1; this.SHA256Count = 0;
break; this.SHA384Count = 0;
case ItemType.BiosSet: this.SHA512Count = 0;
_biosSetCount -= 1;
break;
case ItemType.Disk:
_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);
}
_baddumpCount -= (((Disk)item).ItemStatus == ItemStatus.BadDump ? 1 : 0); this.BaddumpCount = 0;
_goodCount -= (((Disk)item).ItemStatus == ItemStatus.Good ? 1 : 0); this.GoodCount = 0;
_nodumpCount -= (((Disk)item).ItemStatus == ItemStatus.Nodump ? 1 : 0); this.NodumpCount = 0;
_verifiedCount -= (((Disk)item).ItemStatus == ItemStatus.Verified ? 1 : 0); this.VerifiedCount = 0;
break; }
case ItemType.Release:
_releaseCount -= 1;
break;
case ItemType.Rom:
_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);
}
_baddumpCount -= (((Rom)item).ItemStatus == ItemStatus.BadDump ? 1 : 0); #endregion // Instance Methods
_goodCount -= (((Rom)item).ItemStatus == ItemStatus.Good ? 1 : 0); }
_nodumpCount -= (((Rom)item).ItemStatus == ItemStatus.Nodump ? 1 : 0);
_verifiedCount -= (((Rom)item).ItemStatus == ItemStatus.Verified ? 1 : 0);
break;
case ItemType.Sample:
_sampleCount -= 1;
break;
}
}
}
/// <summary>
/// Reset all statistics
/// </summary>
public void Reset()
{
_count = 0;
_archiveCount = 0;
_biosSetCount = 0;
_diskCount = 0;
_releaseCount = 0;
_romCount = 0;
_sampleCount = 0;
_gameCount = 0;
_totalSize = 0;
_crcCount = 0;
_md5Count = 0;
_sha1Count = 0;
_sha256Count = 0;
_sha384Count = 0;
_sha512Count = 0;
_baddumpCount = 0;
_goodCount = 0;
_nodumpCount = 0;
_verifiedCount = 0;
}
#endregion // Instance Methods
}
} }