using System; using SabreTools.Library.Data; using Newtonsoft.Json; namespace SabreTools.Library.DatFiles { /// /// Represents all possible DAT header information /// public class DatHeader : ICloneable { #region Publicly facing variables #region Data common to most DAT types /// /// External name of the DAT /// [JsonProperty("filename")] public string FileName { get; set; } /// /// Internal name of the DAT /// [JsonProperty("name")] public string Name { get; set; } /// /// DAT description /// [JsonProperty("description")] public string Description { get; set; } /// /// Root directory for the files; currently TruRip/EmuARC-exclusive /// [JsonProperty("rootdir")] public string RootDir { get; set; } /// /// General category of items found in the DAT /// [JsonProperty("category")] public string Category { get; set; } /// /// Version of the DAT /// [JsonProperty("version")] public string Version { get; set; } /// /// Creation or modification date /// [JsonProperty("date")] public string Date { get; set; } /// /// List of authors who contributed to the DAT /// [JsonProperty("author")] public string Author { get; set; } /// /// Email address for DAT author(s) /// [JsonProperty("email")] public string Email { get; set; } /// /// Author or distribution homepage name /// [JsonProperty("homepage")] public string Homepage { get; set; } /// /// Author or distribution URL /// [JsonProperty("url")] public string Url { get; set; } /// /// Any comment that does not already fit an existing field /// [JsonProperty("comment")] public string Comment { get; set; } /// /// Header skipper to be used when loading the DAT /// [JsonProperty("header")] public string Header { get; set; } /// /// Classification of the DAT. Generally only used for SuperDAT /// [JsonProperty("type")] public string Type { get; set; } /// /// Force a merging style when loaded /// [JsonProperty("forcemerging")] public ForceMerging ForceMerging { get; set; } /// /// Force nodump handling when loaded /// [JsonProperty("forcenodump")] public ForceNodump ForceNodump { get; set; } /// /// Force output packing when loaded /// [JsonProperty("forcepacking")] public ForcePacking ForcePacking { get; set; } /// /// Read or write format /// [JsonIgnore] public DatFormat DatFormat { get; set; } /// /// List of fields in machine and items to exclude from writing /// [JsonIgnore] public bool[] ExcludeFields { get; set; } = new bool[Enum.GetNames(typeof(Field)).Length]; /// /// Enable "One Rom, One Region (1G1R)" mode /// [JsonIgnore] public bool OneRom { get; set; } /// /// Keep machines that don't contain any items /// [JsonIgnore] public bool KeepEmptyGames { get; set; } /// /// Remove scene dates from the beginning of machine names /// [JsonIgnore] public bool SceneDateStrip { get; set; } /// /// Deduplicate items using the given method /// [JsonIgnore] public DedupeType DedupeRoms { get; set; } /// /// Strip hash types from items /// [JsonIgnore] public Hash StripHash { get; private set; } #endregion #region Write pre-processing /// /// Text to prepend to all outputted lines /// [JsonIgnore] public string Prefix { get; set; } /// /// Text to append to all outputted lines /// [JsonIgnore] public string Postfix { get; set; } /// /// Add a new extension to all items /// [JsonIgnore] public string AddExtension { get; set; } /// /// Replace all item extensions /// [JsonIgnore] public string ReplaceExtension { get; set; } /// /// Remove all item extensions /// [JsonIgnore] public bool RemoveExtension { get; set; } /// /// Romba output mode /// [JsonIgnore] public bool Romba { get; set; } /// /// Output the machine name /// [JsonIgnore] public bool GameName { get; set; } /// /// Wrap quotes around the entire line, sans prefix and postfix /// [JsonIgnore] public bool Quotes { get; set; } #endregion #region Data specific to the Miss DAT type /// /// Output the item name /// [JsonIgnore] public bool UseRomName { get; set; } #endregion #endregion #region Instance Methods #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, ReplaceExtension = this.ReplaceExtension, AddExtension = this.AddExtension, RemoveExtension = this.RemoveExtension, GameName = this.GameName, Romba = this.Romba, }; } #endregion #endregion // Instance Methods } }