-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
RomSignatureObject.cs
234 lines (202 loc) · 8.75 KB
/
RomSignatureObject.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
using System;
using System.Collections.Generic;
namespace gaseous_signature_parser.models.RomSignatureObject
{
/// <summary>
/// Object returned by all signature engines containing metadata about the ROM's in the data files
///
/// This class was based on the TOSEC dataset, so may need to be expanded as new signature engines are added
/// </summary>
public class RomSignatureObject
{
public string? Id { get; set; }
public string? Name { get; set; }
public string? Description { get; set; }
public string? Category { get; set; }
public string? Version { get; set; }
public string? Author { get; set; }
public string? Email { get; set; }
public string? Homepage { get; set; }
public Uri? Url { get; set; }
public string? SourceType { get; set; }
public string SourceMd5 { get; set; } = "";
public string SourceSHA1 { get; set; } = "";
public List<Game> Games { get; set; } = new List<Game>();
public class Game
{
public string? Id { get; set; }
public string? GameId { get; set; }
public string? Category { get; set; }
public string? Name { get; set; }
public string? Description { get; set; }
public string? Year { get; set; }
public string? Publisher { get; set; }
public DemoTypes Demo { get; set; }
public string? System { get; set; }
public string? SystemVariant { get; set; }
public string? Video { get; set; }
public string? Country { get; set; }
public string? Language { get; set; }
public string? Copyright { get; set; }
public List<Rom> Roms { get; set; } = new List<Rom>();
public Dictionary<string, object> flags { get; set; } = new Dictionary<string, object>();
public int RomCount
{
get
{
return Roms.Count();
}
}
public enum DemoTypes
{
NotDemo = 0,
demo = 1,
demo_kiosk = 2,
demo_playable = 3,
demo_rolling = 4,
demo_slideshow = 5
}
public class Rom
{
public string? Id { get; set; }
public string? Name { get; set; }
public UInt64? Size { get; set; }
public string? Crc { get; set; }
public string? Md5 { get; set; }
public string? Sha1 { get; set; }
public string? DevelopmentStatus { get; set; }
public Dictionary<string, object> Attributes { get; set; } = new Dictionary<string, object>();
public RomTypes RomType { get; set; }
public string? RomTypeMedia { get; set; }
public MediaType? MediaDetail {
get
{
if (RomTypeMedia != null)
{
return new MediaType(SignatureSource, RomTypeMedia);
}
else
{
return null;
}
}
}
public string? MediaLabel { get; set; }
public SignatureSourceType SignatureSource { get; set; }
public enum SignatureSourceType
{
None = 0,
TOSEC = 1,
MAMEArcade = 2,
MAMEMess = 3,
NoIntros = 4
}
public enum RomTypes
{
/// <summary>
/// Media type is unknown
/// </summary>
Unknown = 0,
/// <summary>
/// Optical media
/// </summary>
Disc = 1,
/// <summary>
/// Magnetic media
/// </summary>
Disk = 2,
/// <summary>
/// Individual files
/// </summary>
File = 3,
/// <summary>
/// Individual pars
/// </summary>
Part = 4,
/// <summary>
/// Tape base media
/// </summary>
Tape = 5,
/// <summary>
/// Side of the media
/// </summary>
Side = 6
}
public class MediaType
{
public MediaType(SignatureSourceType Source, string MediaTypeString)
{
switch (Source)
{
case Rom.SignatureSourceType.TOSEC:
case Rom.SignatureSourceType.NoIntros:
string[] typeString = MediaTypeString.Split(" ");
string inType = "";
foreach (string typeStringVal in typeString)
{
if (inType == "")
{
switch (typeStringVal.ToLower())
{
case "disk":
Media = Rom.RomTypes.Disk;
inType = typeStringVal;
break;
case "disc":
Media = Rom.RomTypes.Disc;
inType = typeStringVal;
break;
case "file":
Media = Rom.RomTypes.File;
inType = typeStringVal;
break;
case "part":
Media = Rom.RomTypes.Part;
inType = typeStringVal;
break;
case "tape":
Media = Rom.RomTypes.Tape;
inType = typeStringVal;
break;
case "of":
inType = typeStringVal;
break;
case "side":
inType = typeStringVal;
break;
}
}
else {
switch (inType.ToLower())
{
case "disk":
case "disc":
case "file":
case "part":
case "tape":
Number = int.Parse(typeStringVal);
break;
case "of":
Count = int.Parse(typeStringVal);
break;
case "side":
Side = typeStringVal;
break;
}
inType = "";
}
}
break;
default:
break;
}
}
public Rom.RomTypes? Media { get; set; }
public int? Number { get; set; }
public int? Count { get; set; }
public string? Side { get; set; }
}
}
}
}
}