[DatStats, DatHeader] Do more work on currently unused classes

This commit is contained in:
Matt Nadareski
2017-10-06 13:29:58 -07:00
parent eb1d1ba618
commit 9cf5913c11
3 changed files with 359 additions and 34 deletions

View File

@@ -1,49 +1,284 @@
using System.Collections.Generic; using System;
using System.Collections.Generic;
using SabreTools.Library.Data; using SabreTools.Library.Data;
namespace SabreTools.Library.Dats namespace SabreTools.Library.Dats
{ {
public struct DatHeader 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 _excludeOf;
private DedupeType _dedupeRoms;
private Hash _stripHash;
private bool _oneGameOneRegion;
private List<string> _regions;
private SortedBy _sortedBy;
// Data specific to the Miss DAT type
private bool _useGame;
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
public string Name; {
public string Description; get { return _fileName; }
public string RootDir; set { _fileName = value; }
public string Category; }
public string Version; public string Name
public string Date; {
public string Author; get { return _name; }
public string Email; set { _name = value; }
public string Homepage; }
public string Url; public string Description
public string Comment; {
public string Header; get { return _description; }
public string Type; // Generally only used for SuperDAT set { _description = value; }
public ForceMerging ForceMerging; }
public ForceNodump ForceNodump; public string RootDir
public ForcePacking ForcePacking; {
public DatFormat DatFormat; get { return _rootDir; }
public bool ExcludeOf; set { _rootDir = value; }
public bool MergeRoms; }
public Hash StripHash; public string Category
public bool OneGameOneRegion; {
public List<string> Regions; 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 ExcludeOf
{
get { return _excludeOf; }
set { _excludeOf = value; }
}
public DedupeType DedupeRoms
{
get { return _dedupeRoms; }
set { _dedupeRoms = value; }
}
public Hash StripHash
{
get { return _stripHash; }
set { _stripHash = value; }
}
public bool OneGameOneRegion
{
get { return _oneGameOneRegion; }
set { _oneGameOneRegion = value; }
}
public List<string> Regions
{
get
{
if (_regions == null)
{
_regions = new List<string>();
}
return _regions;
}
set { _regions = value; }
}
public SortedBy SortedBy
{
get { return _sortedBy; }
}
// Data specific to the Miss DAT type // Data specific to the Miss DAT type
public bool UseGame; public bool UseGame
public string Prefix; {
public string Postfix; get { return _useGame; }
public bool Quotes; set { _useGame = value; }
public string RepExt; }
public string AddExt; public string Prefix
public bool RemExt; {
public bool GameName; get { return _prefix; }
public bool Romba; set { _prefix = value; }
}
public string Postfix
{
get { return _postfix; }
set { _postfix = value; }
}
public bool Quotes
{
get { return _quotes; }
set { _quotes = value; }
}
public string RepExt
{
get { return _repExt; }
set { _repExt = value; }
}
public string AddExt
{
get { return _addExt; }
set { _addExt = value; }
}
public bool RemExt
{
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
#region Instance Methods
#region Cloning 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,
_excludeOf = this._excludeOf,
_dedupeRoms = this._dedupeRoms,
_stripHash = this._stripHash,
_oneGameOneRegion = this._oneGameOneRegion,
_regions = this._regions,
_sortedBy = this._sortedBy,
_useGame = this._useGame,
_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

@@ -0,0 +1,89 @@
namespace SabreTools.Library.Dats
{
public class DatStats
{
#region Private instance variables
// Statistical data related to the DAT
private object _lockObject;
private long _count;
private long _romCount;
private long _diskCount;
private long _totalSize;
private long _crcCount;
private long _md5Count;
private long _sha1Count;
private long _sha256Count;
private long _sha384Count;
private long _sha512Count;
private long _baddumpCount;
private long _nodumpCount;
#endregion
#region Publicly facing variables
// Statistical data related to the DAT
public object LockObject
{
get
{
if (_lockObject == null)
{
_lockObject = new object();
}
return _lockObject;
}
}
public long Count
{
get { return _count; }
}
public long RomCount
{
get { return _romCount; }
}
public long DiskCount
{
get { return _diskCount; }
}
public long TotalSize
{
get { return _totalSize; }
}
public long CRCCount
{
get { return _crcCount; }
}
public long MD5Count
{
get { return _md5Count; }
}
public long SHA1Count
{
get { return _sha1Count; }
}
public long SHA256Count
{
get { return _sha256Count; }
}
public long SHA384Count
{
get { return _sha384Count; }
}
public long SHA512Count
{
get { return _sha512Count; }
}
public long BaddumpCount
{
get { return _baddumpCount; }
}
public long NodumpCount
{
get { return _nodumpCount; }
}
#endregion
}
}

View File

@@ -116,6 +116,7 @@
<Compile Include="Data\Flags.cs" /> <Compile Include="Data\Flags.cs" />
<Compile Include="Data\Globals.cs" /> <Compile Include="Data\Globals.cs" />
<Compile Include="Dats\DatHeader.cs" /> <Compile Include="Dats\DatHeader.cs" />
<Compile Include="Dats\DatStats.cs" />
<Compile Include="Dats\Partials\DatFile.Manipulate.cs" /> <Compile Include="Dats\Partials\DatFile.Manipulate.cs" />
<Compile Include="Dats\Partials\DatFile.ConvertUpdate.cs" /> <Compile Include="Dats\Partials\DatFile.ConvertUpdate.cs" />
<Compile Include="Dats\Partials\DatFile.DFD.cs" /> <Compile Include="Dats\Partials\DatFile.DFD.cs" />