|
| 1 | +using System; |
| 2 | +using System.Collections.Generic; |
| 3 | +using Newtonsoft.Json; |
| 4 | +using SabreTools.RedumpLib.Converters; |
| 5 | + |
| 6 | +namespace SabreTools.RedumpLib.Data.Sections |
| 7 | +{ |
| 8 | + /// <summary> |
| 9 | + /// Common disc info section of New Disc Form |
| 10 | + /// </summary> |
| 11 | + public class CommonDiscInfoSection : ICloneable |
| 12 | + { |
| 13 | + // Name not defined by Redump |
| 14 | + [JsonProperty(PropertyName = "d_system", DefaultValueHandling = DefaultValueHandling.Include)] |
| 15 | + [JsonConverter(typeof(SystemConverter))] |
| 16 | + public RedumpSystem? System { get; set; } |
| 17 | + |
| 18 | + // Name not defined by Redump |
| 19 | + [JsonProperty(PropertyName = "d_media", DefaultValueHandling = DefaultValueHandling.Include)] |
| 20 | + [JsonConverter(typeof(DiscTypeConverter))] |
| 21 | + public DiscType? Media { get; set; } |
| 22 | + |
| 23 | + [JsonProperty(PropertyName = "d_title", DefaultValueHandling = DefaultValueHandling.Include)] |
| 24 | + public string? Title { get; set; } |
| 25 | + |
| 26 | + [JsonProperty(PropertyName = "d_title_foreign", DefaultValueHandling = DefaultValueHandling.Ignore)] |
| 27 | + public string? ForeignTitleNonLatin { get; set; } |
| 28 | + |
| 29 | + [JsonProperty(PropertyName = "d_number", NullValueHandling = NullValueHandling.Ignore)] |
| 30 | + public string? DiscNumberLetter { get; set; } |
| 31 | + |
| 32 | + [JsonProperty(PropertyName = "d_label", NullValueHandling = NullValueHandling.Ignore)] |
| 33 | + public string? DiscTitle { get; set; } |
| 34 | + |
| 35 | + [JsonProperty(PropertyName = "d_category", DefaultValueHandling = DefaultValueHandling.Include)] |
| 36 | + [JsonConverter(typeof(DiscCategoryConverter))] |
| 37 | + public DiscCategory? Category { get; set; } |
| 38 | + |
| 39 | + [JsonProperty(PropertyName = "d_region", DefaultValueHandling = DefaultValueHandling.Include)] |
| 40 | + [JsonConverter(typeof(RegionConverter))] |
| 41 | + public Region? Region { get; set; } |
| 42 | + |
| 43 | + [JsonProperty(PropertyName = "d_languages", DefaultValueHandling = DefaultValueHandling.Include)] |
| 44 | + [JsonConverter(typeof(LanguageConverter))] |
| 45 | + public Language?[]? Languages { get; set; } |
| 46 | + |
| 47 | + [JsonProperty(PropertyName = "d_languages_selection", NullValueHandling = NullValueHandling.Ignore, DefaultValueHandling = DefaultValueHandling.Ignore)] |
| 48 | + [JsonConverter(typeof(LanguageSelectionConverter))] |
| 49 | + public LanguageSelection?[]? LanguageSelection { get; set; } |
| 50 | + |
| 51 | + [JsonProperty(PropertyName = "d_serial", NullValueHandling = NullValueHandling.Ignore)] |
| 52 | + public string? Serial { get; set; } |
| 53 | + |
| 54 | + [JsonProperty(PropertyName = "d_ring", NullValueHandling = NullValueHandling.Ignore)] |
| 55 | + public string? Ring { get; private set; } |
| 56 | + |
| 57 | + [JsonProperty(PropertyName = "d_ring_0_id", NullValueHandling = NullValueHandling.Ignore)] |
| 58 | + public string? RingId { get; private set; } |
| 59 | + |
| 60 | + [JsonProperty(PropertyName = "d_ring_0_ma1", DefaultValueHandling = DefaultValueHandling.Include)] |
| 61 | + public string? Layer0MasteringRing { get; set; } |
| 62 | + |
| 63 | + [JsonProperty(PropertyName = "d_ring_0_ma1_sid", NullValueHandling = NullValueHandling.Ignore)] |
| 64 | + public string? Layer0MasteringSID { get; set; } |
| 65 | + |
| 66 | + [JsonProperty(PropertyName = "d_ring_0_ts1", NullValueHandling = NullValueHandling.Ignore)] |
| 67 | + public string? Layer0ToolstampMasteringCode { get; set; } |
| 68 | + |
| 69 | + [JsonProperty(PropertyName = "d_ring_0_mo1_sid", NullValueHandling = NullValueHandling.Ignore)] |
| 70 | + public string? Layer0MouldSID { get; set; } |
| 71 | + |
| 72 | + [JsonProperty(PropertyName = "d_ring_0_mo1", NullValueHandling = NullValueHandling.Ignore)] |
| 73 | + public string? Layer0AdditionalMould { get; set; } |
| 74 | + |
| 75 | + [JsonProperty(PropertyName = "d_ring_0_ma2", DefaultValueHandling = DefaultValueHandling.Include)] |
| 76 | + public string? Layer1MasteringRing { get; set; } |
| 77 | + |
| 78 | + [JsonProperty(PropertyName = "d_ring_0_ma2_sid", NullValueHandling = NullValueHandling.Ignore)] |
| 79 | + public string? Layer1MasteringSID { get; set; } |
| 80 | + |
| 81 | + [JsonProperty(PropertyName = "d_ring_0_ts2", NullValueHandling = NullValueHandling.Ignore)] |
| 82 | + public string? Layer1ToolstampMasteringCode { get; set; } |
| 83 | + |
| 84 | + [JsonProperty(PropertyName = "d_ring_0_mo2_sid", NullValueHandling = NullValueHandling.Ignore)] |
| 85 | + public string? Layer1MouldSID { get; set; } |
| 86 | + |
| 87 | + [JsonProperty(PropertyName = "d_ring_0_mo2", NullValueHandling = NullValueHandling.Ignore)] |
| 88 | + public string? Layer1AdditionalMould { get; set; } |
| 89 | + |
| 90 | + [JsonProperty(PropertyName = "d_ring_0_ma3", DefaultValueHandling = DefaultValueHandling.Include)] |
| 91 | + public string? Layer2MasteringRing { get; set; } |
| 92 | + |
| 93 | + [JsonProperty(PropertyName = "d_ring_0_ma3_sid", NullValueHandling = NullValueHandling.Ignore)] |
| 94 | + public string? Layer2MasteringSID { get; set; } |
| 95 | + |
| 96 | + [JsonProperty(PropertyName = "d_ring_0_ts3", NullValueHandling = NullValueHandling.Ignore)] |
| 97 | + public string? Layer2ToolstampMasteringCode { get; set; } |
| 98 | + |
| 99 | + [JsonProperty(PropertyName = "d_ring_0_ma4", DefaultValueHandling = DefaultValueHandling.Include)] |
| 100 | + public string? Layer3MasteringRing { get; set; } |
| 101 | + |
| 102 | + [JsonProperty(PropertyName = "d_ring_0_ma4_sid", NullValueHandling = NullValueHandling.Ignore)] |
| 103 | + public string? Layer3MasteringSID { get; set; } |
| 104 | + |
| 105 | + [JsonProperty(PropertyName = "d_ring_0_ts4", NullValueHandling = NullValueHandling.Ignore)] |
| 106 | + public string? Layer3ToolstampMasteringCode { get; set; } |
| 107 | + |
| 108 | + [JsonProperty(PropertyName = "d_ring_0_offsets", NullValueHandling = NullValueHandling.Ignore)] |
| 109 | + public string RingOffsetsHidden { get { return "1"; } } |
| 110 | + |
| 111 | + [JsonProperty(PropertyName = "d_ring_0_0_id", NullValueHandling = NullValueHandling.Ignore)] |
| 112 | + public string? RingZeroId { get; private set; } |
| 113 | + |
| 114 | + [JsonProperty(PropertyName = "d_ring_0_0_density", NullValueHandling = NullValueHandling.Ignore)] |
| 115 | + public string? RingZeroDensity { get; private set; } |
| 116 | + |
| 117 | + [JsonProperty(PropertyName = "d_ring_0_0_value", NullValueHandling = NullValueHandling.Ignore)] |
| 118 | + public string? RingWriteOffset { get; set; } |
| 119 | + |
| 120 | + [JsonProperty(PropertyName = "d_ring_count", NullValueHandling = NullValueHandling.Ignore)] |
| 121 | + public string RingCount { get { return "1"; } } |
| 122 | + |
| 123 | + [JsonProperty(PropertyName = "d_barcode", NullValueHandling = NullValueHandling.Ignore)] |
| 124 | + public string? Barcode { get; set; } |
| 125 | + |
| 126 | + [JsonProperty(PropertyName = "d_date", NullValueHandling = NullValueHandling.Ignore)] |
| 127 | + public string? EXEDateBuildDate { get; set; } |
| 128 | + |
| 129 | + [JsonProperty(PropertyName = "d_errors", NullValueHandling = NullValueHandling.Ignore)] |
| 130 | + public string? ErrorsCount { get; set; } |
| 131 | + |
| 132 | + [JsonProperty(PropertyName = "d_comments", NullValueHandling = NullValueHandling.Ignore)] |
| 133 | + public string? Comments { get; set; } |
| 134 | + |
| 135 | + [JsonIgnore] |
| 136 | + public Dictionary<SiteCode, string> CommentsSpecialFields { get; set; } = []; |
| 137 | + |
| 138 | + [JsonProperty(PropertyName = "d_contents", NullValueHandling = NullValueHandling.Ignore)] |
| 139 | + public string? Contents { get; set; } |
| 140 | + |
| 141 | + [JsonIgnore] |
| 142 | + public Dictionary<SiteCode, string> ContentsSpecialFields { get; set; } = []; |
| 143 | + |
| 144 | + public object Clone() |
| 145 | + { |
| 146 | + Dictionary<SiteCode, string> commentsSpecialFields = []; |
| 147 | + foreach (var kvp in this.CommentsSpecialFields) |
| 148 | + { |
| 149 | + commentsSpecialFields[kvp.Key] = kvp.Value; |
| 150 | + } |
| 151 | + |
| 152 | + Dictionary<SiteCode, string> contentsSpecialFields = []; |
| 153 | + foreach (var kvp in this.ContentsSpecialFields) |
| 154 | + { |
| 155 | + contentsSpecialFields[kvp.Key] = kvp.Value; |
| 156 | + } |
| 157 | + |
| 158 | + return new CommonDiscInfoSection |
| 159 | + { |
| 160 | + System = this.System, |
| 161 | + Media = this.Media, |
| 162 | + Title = this.Title, |
| 163 | + ForeignTitleNonLatin = this.ForeignTitleNonLatin, |
| 164 | + DiscNumberLetter = this.DiscNumberLetter, |
| 165 | + DiscTitle = this.DiscTitle, |
| 166 | + Category = this.Category, |
| 167 | + Region = this.Region, |
| 168 | + Languages = this.Languages?.Clone() as Language?[], |
| 169 | + LanguageSelection = this.LanguageSelection?.Clone() as LanguageSelection?[], |
| 170 | + Serial = this.Serial, |
| 171 | + Ring = this.Ring, |
| 172 | + RingId = this.RingId, |
| 173 | + Layer0MasteringRing = this.Layer0MasteringRing, |
| 174 | + Layer0MasteringSID = this.Layer0MasteringSID, |
| 175 | + Layer0ToolstampMasteringCode = this.Layer0ToolstampMasteringCode, |
| 176 | + Layer0MouldSID = this.Layer0MouldSID, |
| 177 | + Layer0AdditionalMould = this.Layer0AdditionalMould, |
| 178 | + Layer1MasteringRing = this.Layer1MasteringRing, |
| 179 | + Layer1MasteringSID = this.Layer1MasteringSID, |
| 180 | + Layer1ToolstampMasteringCode = this.Layer1ToolstampMasteringCode, |
| 181 | + Layer1MouldSID = this.Layer1MouldSID, |
| 182 | + Layer1AdditionalMould = this.Layer1AdditionalMould, |
| 183 | + Layer2MasteringRing = this.Layer2MasteringRing, |
| 184 | + Layer2MasteringSID = this.Layer2MasteringSID, |
| 185 | + Layer2ToolstampMasteringCode = this.Layer2ToolstampMasteringCode, |
| 186 | + Layer3MasteringRing = this.Layer3MasteringRing, |
| 187 | + Layer3MasteringSID = this.Layer3MasteringSID, |
| 188 | + Layer3ToolstampMasteringCode = this.Layer3ToolstampMasteringCode, |
| 189 | + RingZeroId = this.RingZeroId, |
| 190 | + RingZeroDensity = this.RingZeroDensity, |
| 191 | + RingWriteOffset = this.RingWriteOffset, |
| 192 | + Barcode = this.Barcode, |
| 193 | + EXEDateBuildDate = this.EXEDateBuildDate, |
| 194 | + ErrorsCount = this.ErrorsCount, |
| 195 | + Comments = this.Comments, |
| 196 | + CommentsSpecialFields = commentsSpecialFields, |
| 197 | + Contents = this.Contents, |
| 198 | + ContentsSpecialFields = contentsSpecialFields, |
| 199 | + }; |
| 200 | + } |
| 201 | + } |
| 202 | +} |
0 commit comments