diff --git a/SabreTools.Library/DatFiles/DatHeader.cs b/SabreTools.Library/DatFiles/DatHeader.cs index 8e668ca1..b07f1c4d 100644 --- a/SabreTools.Library/DatFiles/DatHeader.cs +++ b/SabreTools.Library/DatFiles/DatHeader.cs @@ -1,275 +1,105 @@ using System; -using System.Collections.Generic; - using SabreTools.Library.Data; namespace SabreTools.Library.DatFiles { - /// - /// Represents all possible DAT header information - /// - public class DatHeader : ICloneable - { - #region Private instance variables + /// + /// Represents all possible DAT header information + /// + public class DatHeader : ICloneable + { + #region Publicly facing 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 common to most DAT types + 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 (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; + // Data specific to the Miss DAT type + 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 + #endregion - #region Publicly facing variables + #region Instance Methods - // 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; } - } + #region Cloning Methods - // 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; } - } + /// + /// Clone the current header + /// + /// + 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, - #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 - - /// - /// Clone the current header - /// - /// - 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 - } + #endregion // Instance Methods + } } diff --git a/SabreTools.Library/DatFiles/DatStats.cs b/SabreTools.Library/DatFiles/DatStats.cs index 30e3dee7..c3feff41 100644 --- a/SabreTools.Library/DatFiles/DatStats.cs +++ b/SabreTools.Library/DatFiles/DatStats.cs @@ -5,367 +5,253 @@ using SabreTools.Library.DatItems; namespace SabreTools.Library.DatFiles { - /// - /// Represents statistical data associated with a DAT - /// - public class DatStats - { - #region Private instance variables + /// + /// Represents statistical data associated with a DAT + /// + public class DatStats + { + #region Private instance variables - // Statistics report format - private StatReportFormat _reportFormat = StatReportFormat.None; + // Object used to lock stats updates + private object _lockObject = new object(); - // Object used to lock stats updates - private object _lockObject = new object(); + #endregion - // Overall item count - private long _count = 0; + #region Publicly facing variables - // 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; + // Statistics report format + public StatReportFormat ReportFormat { get; set; } = StatReportFormat.None; - // Special count only used by statistics output - private long _gameCount = 0; + // Overall item count + public long Count { get; set; } = 0; - // Total reported size - private long _totalSize = 0; + // Individual DatItem type counts + 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 - private long _crcCount = 0; - private long _md5Count = 0; - private long _sha1Count = 0; - private long _sha256Count = 0; - private long _sha384Count = 0; - private long _sha512Count = 0; + // Special count only used by statistics output + public long GameCount { get; set; } = 0; - // Individual status counts - private long _baddumpCount = 0; - private long _goodCount = 0; - private long _nodumpCount = 0; - private long _verifiedCount = 0; + // Total reported size + public long TotalSize { get; set; } = 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 - public StatReportFormat ReportFormat - { - get { return _reportFormat; } - set { _reportFormat = value; } - } + #endregion - // Overall item count - public long Count - { - get { return _count; } - set { _count = value; } - } + #region Instance Methods - // 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; } - } + /// + /// Add to the statistics given a DatItem + /// + /// Item to add info from + public void AddItem(DatItem item) + { + // No matter what the item is, we increate the count + lock (_lockObject) + { + this.Count += 1; - // Special count only used by statistics output - public long GameCount - { - get { return _gameCount; } - set { _gameCount = value; } - } + // Now we do different things for each item type - // Total reported size - public long TotalSize - { - get { return _totalSize; } - set { _totalSize = value; } - } + switch (item.Type) + { + case ItemType.Archive: + this.ArchiveCount += 1; + 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 - 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; } - } + 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); + } - // 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; } - } + 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; + } + } + } - #endregion + /// + /// Add statistics from another DatStats object + /// + /// DatStats object to add from + 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; - /// - /// Add to the statistics given a DatItem - /// - /// Item to add info from - public void AddItem(DatItem item) - { - // No matter what the item is, we increate the count - lock (_lockObject) - { - _count += 1; + this.GameCount += stats.GameCount; - // Now we do different things for each item type + this.TotalSize += stats.TotalSize; - switch (item.Type) - { - case ItemType.Archive: - _archiveCount += 1; - break; - case ItemType.BiosSet: - _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); - } + // Individual hash counts + this.CRCCount += stats.CRCCount; + this.MD5Count += stats.MD5Count; + this.SHA1Count += stats.SHA1Count; + this.SHA256Count += stats.SHA256Count; + this.SHA384Count += stats.SHA384Count; + this.SHA512Count += stats.SHA512Count; - _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); - 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); - } + // Individual status counts + this.BaddumpCount += stats.BaddumpCount; + this.GoodCount += stats.GoodCount; + this.NodumpCount += stats.NodumpCount; + this.VerifiedCount += stats.VerifiedCount; + } - _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); - break; - case ItemType.Sample: - _sampleCount += 1; - break; - } - } - } + /// + /// Remove from the statistics given a DatItem + /// + /// Item to remove info for + public void RemoveItem(DatItem item) + { + // No matter what the item is, we increate the count + lock (_lockObject) + { + this.Count -= 1; - /// - /// Add statistics from another DatStats object - /// - /// DatStats object to add from - public void AddStats(DatStats stats) - { - _count += stats.Count; + // Now we do different things for each item type - _archiveCount += stats.ArchiveCount; - _biosSetCount += stats.BiosSetCount; - _diskCount += stats.DiskCount; - _releaseCount += stats.ReleaseCount; - _romCount += stats.RomCount; - _sampleCount += stats.SampleCount; + switch (item.Type) + { + case ItemType.Archive: + this.ArchiveCount -= 1; + 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); + } - _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 - _crcCount += stats.CRCCount; - _md5Count += stats.MD5Count; - _sha1Count += stats.SHA1Count; - _sha256Count += stats.SHA256Count; - _sha384Count += stats.SHA384Count; - _sha512Count += stats.SHA512Count; + /// + /// Reset all statistics + /// + public void Reset() + { + this.Count = 0; - // Individual status counts - _baddumpCount += stats.BaddumpCount; - _goodCount += stats.GoodCount; - _nodumpCount += stats.NodumpCount; - _verifiedCount += stats.VerifiedCount; - } + this.ArchiveCount = 0; + this.BiosSetCount = 0; + this.DiskCount = 0; + this.ReleaseCount = 0; + this.RomCount = 0; + this.SampleCount = 0; - /// - /// Remove from the statistics given a DatItem - /// - /// Item to remove info for - public void RemoveItem(DatItem item) - { - // No matter what the item is, we increate the count - lock (_lockObject) - { - _count -= 1; + this.GameCount = 0; - // Now we do different things for each item type + this.TotalSize = 0; - switch (item.Type) - { - case ItemType.Archive: - _archiveCount -= 1; - break; - case ItemType.BiosSet: - _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); - } + this.CRCCount = 0; + this.MD5Count = 0; + this.SHA1Count = 0; + this.SHA256Count = 0; + this.SHA384Count = 0; + this.SHA512Count = 0; - _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); - 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); - } + this.BaddumpCount = 0; + this.GoodCount = 0; + this.NodumpCount = 0; + this.VerifiedCount = 0; + } - _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); - break; - case ItemType.Sample: - _sampleCount -= 1; - break; - } - } - } - - /// - /// Reset all statistics - /// - 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 - } + #endregion // Instance Methods + } }