Debian Codegraph @

terps/frankendrift/FrankenDrift.Adrift/Babel.vb

raw
1 Imports FrankenDrift.Glue
2
3 Public Class clsBabelTreatyInfo
4
5 Public Sub New()
6 sVersion = "1.0"
7 ReDim oStories(0)
8 oStories(0) = New clsStory
9 End Sub
10
11
12 Public Function FromString(ByVal sXML As String) As Boolean
13
14 Return True
15
16 End Function
17
18
19
20 Private oStories() As clsStory
21 Public Property Stories() As clsStory()
22 Get
23 Return oStories
24 End Get
25 Set(ByVal Value As clsStory())
26 oStories = Value
27 End Set
28 End Property
29
30
31 Private sVersion As String
32 Public Property Version() As String
33 Get
34 Return sVersion
35 End Get
36 Set(ByVal value As String)
37 sVersion = value
38 End Set
39 End Property
40
41
42 Public Class clsStory
43
44 Public Sub New()
45 Identification.GenerateNewIFID()
46 Releases = New clsBabelTreatyInfo.clsStory.clsReleases
47 End Sub
48
49
50 ' The <identification> section is mandatory. The content here identifies
51 ' to which story file the metadata belongs. (This is necessary because
52 ' the metadata may be held on some remote server, quite separate from
53 ' the story file.)
54 Public Class clsIdentification
55
56 Public Sub GenerateNewIFID()
57 With System.Reflection.Assembly.GetExecutingAssembly.GetName.Version
58 sIFID = "ADRIFT-" & .Major & .Minor.ToString("00") & "-" & sRight(Guid.NewGuid.ToString, 32).ToUpper
59 End With
60 End Sub
61
62 Private sIFID As String
63 Public Property IFID() As String
64 Get
65 Return sIFID
66 End Get
67 Set(ByVal value As String)
68 sIFID = value
69 End Set
70 End Property
71
72 Public Property Format() As String
73 Get
74 Return "adrift"
75 End Get
76 Set(ByVal value As String)
77 ' Ignore
78 End Set
79 End Property
80
81 End Class
82 Public Identification As New clsIdentification
83
84 ' The <bibliographic> section is mandatory.
85 Public Class clsBibliographic
86
87 Public Property Title() As String
88 Get
89 Return Adventure.Title
90 End Get
91 Set(ByVal value As String)
92 ' Ignore
93 End Set
94 End Property
95
96 Public Property Author() As String
97 Get
98 Return Adventure.Author
99 End Get
100 Set(ByVal value As String)
101 ' Ignore
102 End Set
103 End Property
104
105 ' Always reads this from the current culture, so can change if modified on a different machine
106 Private sLanguage As String
107 Public Property Language() As String
108 Get
109 Return Threading.Thread.CurrentThread.CurrentCulture.ToString()
110 End Get
111 Set(ByVal value As String)
112 ' Ignore
113 End Set
114 End Property
115
116 Private sHeadline As String
117 Public Property Headline() As String
118 Get
119 Return sHeadline
120 End Get
121 Set(ByVal value As String)
122 sHeadline = value
123 End Set
124 End Property
125
126 Private sDescription As String
127 Public Property Description() As String
128 Get
129 Return sDescription
130 End Get
131 Set(ByVal value As String)
132 sDescription = value
133 End Set
134 End Property
135
136 Private sSeries As String
137 Public Property Series() As String
138 Get
139 Return sSeries
140 End Get
141 Set(ByVal value As String)
142 sSeries = value
143 End Set
144 End Property
145
146 Private iSeriesNumber As Integer
147 Public Property SeriesNumber() As Integer
148 Get
149 Return iSeriesNumber
150 End Get
151 Set(ByVal value As Integer)
152 iSeriesNumber = value
153 If iSeriesNumber > 0 Then bSeriesNumberSpecified = True
154 End Set
155 End Property
156
157 Private bSeriesNumberSpecified As Boolean
158 Public Property SeriesNumberSpecified() As Boolean
159 Get
160 Return bSeriesNumberSpecified
161 End Get
162 Set(ByVal Value As Boolean)
163 bSeriesNumberSpecified = Value
164 End Set
165 End Property
166
167 Public Enum ForgivenessEnum
168 Merciful
169 Polite
170 Tough
171 Nasty
172 Cruel
173 End Enum
174 Private eForgiveness As ForgivenessEnum
175 Public Property Forgiveness() As ForgivenessEnum
176 Get
177 Return eForgiveness
178 End Get
179 Set(ByVal value As ForgivenessEnum)
180 eForgiveness = value
181 bForgivenessSpecified = True
182 End Set
183 End Property
184
185 Private bForgivenessSpecified As Boolean
186 Public Property ForgivenessSpecified() As Boolean
187 Get
188 Return bForgivenessSpecified
189 End Get
190 Set(ByVal Value As Boolean)
191 bForgivenessSpecified = Value
192 End Set
193 End Property
194
195 End Class
196 Public Bibliographic As New clsBibliographic
197
198 ' The <resources> tag is optional. This section, if present, details
199 ' the other files (if any) which are intended to accompany the story
200 ' file, and to be available to any player. By "other" is meant files
201 ' which are not embedded in the story file. (So, for instance, pictures
202 ' in a blorbed Z-machine story file do not count as "other".)
203 Public Class clsResources
204
205 Public Class clsAuxiliary
206
207 Private sLeafName As String
208 Public Property LeafName() As String
209 Get
210 Return sLeafName
211 End Get
212 Set(ByVal value As String)
213 sLeafName = value
214 End Set
215 End Property
216
217 Private sDescription As String
218 Public Property Description() As String
219 Get
220 Return sDescription
221 End Get
222 Set(ByVal value As String)
223 sDescription = value
224 End Set
225 End Property
226
227 End Class
228 Public Auxiliary As New clsAuxiliary
229
230 End Class
231 Public Resources As clsResources
232
233 ' The <contacts> tag is optional.
234 Public Class clsContacts
235
236 Private sURL As String
237 Public Property URL() As String
238 Get
239 Return sURL
240 End Get
241 Set(ByVal value As String)
242 sURL = value
243 End Set
244 End Property
245
246 Private sAuthorEmail As String
247 Public Property AuthorEmail() As String
248 Get
249 Return sAuthorEmail
250 End Get
251 Set(ByVal value As String)
252 sAuthorEmail = value
253 End Set
254 End Property
255
256 End Class
257 Public Contacts As clsContacts
258
259 ' The <cover> tag is optional, except that it is mandatory for an
260 ' iFiction record embedded in a story file which contains a cover
261 ' image; and the information must, of course, be correct.
262
263 Public Class clsCover
264 Friend imgCoverArt As Byte()
265
266
267 ' This is required to be either "jpg" or "png". No other casings,
268 ' spellings or image formats are permitted.
269 Private sFormat As String
270 Public Property Format() As String
271 Get
272 If imgCoverArt IsNot Nothing Then Return sFormat Else Return Nothing
273 End Get
274 Set(ByVal value As String)
275 If value = "" OrElse value = "jpg" OrElse value = "png" Then
276 sFormat = value
277 Else
278 Throw New Exception("Only jpg or png allowed!")
279 End If
280 End Set
281 End Property
282
283 Public Property Height() As Integer
284 Get
285 Return 0
286 End Get
287 Set(ByVal value As Integer)
288 ' Provided for serialization only
289 End Set
290 End Property
291
292 Private bHeightSpecified As Boolean
293 Public Property HeightSpecified() As Boolean
294 Get
295 Return False
296 End Get
297 Set(ByVal Value As Boolean)
298 ' Ignore
299 End Set
300 End Property
301
302 Public Property Width() As Integer
303 Get
304 Return 0
305 End Get
306 Set(ByVal value As Integer)
307 ' Provided for serialization only
308 End Set
309 End Property
310
311 Private bWidthSpecified As Boolean
312 Public Property WidthSpecified() As Boolean
313 Get
314 Return False
315 End Get
316 Set(ByVal Value As Boolean)
317 ' Ignore
318 End Set
319 End Property
320
321 End Class
322 Public Cover As clsCover
323
324 Public Class clsADRIFT
325
326 Public ReadOnly Property Version() As String
327 Get
328 Return Application.ProductVersion
329 End Get
330 End Property
331
332 End Class
333 Public ADRIFT As clsADRIFT
334
335 ' 5.11 - Releases
336 ' Attached
337 ' History
338 Public Class clsReleases
339
340 Public Sub New()
341 Attached = New clsBabelTreatyInfo.clsStory.clsReleases.clsAttached
342 End Sub
343
344
345 Public Class clsAttached
346
347 Public Sub New()
348 Release = New clsBabelTreatyInfo.clsStory.clsReleases.clsAttached.clsRelease
349 End Sub
350
351
352 Public Class clsRelease
353
354 Private iVersion As Integer = 1
355 Public Property Version() As Integer
356 Get
357 Return iVersion
358 End Get
359 Set(ByVal value As Integer)
360 iVersion = value
361 If iVersion > 0 Then bVersionSpecified = True
362 End Set
363 End Property
364
365 Private bVersionSpecified As Boolean
366 Public Property VersionSpecified() As Boolean
367 Get
368 Return bVersionSpecified
369 End Get
370 Set(ByVal Value As Boolean)
371 bVersionSpecified = Value
372 End Set
373 End Property
374
375 Private dtReleaseDate As DateTime
376 Public Property ReleaseDateXML() As String
377 Get
378 Return ReleaseDate.ToString("yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture.DateTimeFormat)
379 End Get
380 Set(ByVal value As String)
381 ReleaseDate = DateTime.Parse(value)
382 End Set
383 End Property
384
385 Public Property ReleaseDate() As DateTime
386 Get
387 #If Generator Then
388 Return Date.Today
389 #Else
390 Return dtReleaseDate
391 #End If
392 End Get
393 Set(ByVal value As DateTime)
394 dtReleaseDate = value
395 End Set
396 End Property
397
398 Private sCompiler As String
399 Public Property Compiler() As String
400 Get
401 Return "ADRIFT 5"
402 End Get
403 Set(ByVal value As String)
404 End Set
405 End Property
406
407 Private sCompilerVersion As String
408 Public Property CompilerVersion() As String
409 Get
410 Return Application.ProductVersion
411 End Get
412 Set(ByVal value As String)
413 End Set
414 End Property
415
416 End Class
417 Public Release As New clsRelease
418
419 End Class
420 Public Attached As New clsAttached
421
422 End Class
423
424 Public Releases As clsReleases
425
426
427 ' 5.12 - Colophon
428
429 ' 5.13 - Annotation
430
431 ' 5.14 - Examples
432
433 End Class
434
435 End Class