2
* This file is part of SubLib.
3
* Copyright (C) 2006 Pedro Castro
5
* SubLib is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
10
* SubLib is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26
/// <summary>Represents the headers of the supported subtitle formats.</summary>
27
public class SubtitleHeaders {
29
private SubtitleHeadersSubViewer1 subViewer1 = null;
30
private SubtitleHeadersSubViewer2 subViewer2 = null;
31
private SubtitleHeadersMPSub mPSub = null;
32
private SubtitleHeadersSubStationAlphaASS subStationAlphaASS = null;
34
/* Headers are initialized only if and when they're accessed */
36
/// <summary>The headers for the SubViewer 1.0 subtitle type.</summary>
37
public SubtitleHeadersSubViewer1 SubViewer1 {
39
if (subViewer1 == null)
40
subViewer1 = new SubtitleHeadersSubViewer1();
46
/// <summary>The headers for the SubViewer 2.0 subtitle type.</summary>
47
public SubtitleHeadersSubViewer2 SubViewer2 {
49
if (subViewer2 == null)
50
subViewer2 = new SubtitleHeadersSubViewer2();
56
/// <summary>The headers for the MPSub subtitle type.</summary>
57
public SubtitleHeadersMPSub MPSub {
60
mPSub = new SubtitleHeadersMPSub();
66
/// <summary>The headers for the Sub Station Alpha and Advanced Sub Station Alpha subtitle types.</summary>
67
public SubtitleHeadersSubStationAlphaASS SubStationAlphaASS {
69
if (subStationAlphaASS == null)
70
subStationAlphaASS = new SubtitleHeadersSubStationAlphaASS();
72
return subStationAlphaASS;
76
public override string ToString() {
77
return "\t**** SUBTITLE HEADERS ****\t\n" +
78
(subViewer1 != null ? subViewer1.ToString() : "! SubViewer 1.0 not used") + "\n" +
79
(subViewer2 != null ? subViewer2.ToString() : "! SubViewer 2.0 not used") + "\n" +
80
(mPSub != null ? mPSub.ToString() : "! MPSub not used") + "\n" +
81
(subStationAlphaASS != null ? subStationAlphaASS.ToString() : "! SubStationAlpha and ASS not used");
86
/// <summary>Represents the headers of the SubViewer 1.0 subtitle format.</summary>
87
public class SubtitleHeadersSubViewer1 {
88
private string title = String.Empty;
89
private string author = String.Empty;
90
private string source = String.Empty;
91
private string program = String.Empty;
92
private string filePath = String.Empty;
93
private int delay = 0;
94
private int cdTrack = 0;
96
/// <summary>The movie's title.</summary>
99
set { title = value; }
102
/// <summary>The subtitles' author.</summary>
103
public string Author {
104
get { return author; }
105
set { author = value; }
108
/// <summary>The subtitles' source.</summary>
109
public string Source {
110
get { return source; }
111
set { source = value; }
114
/// <summary>The name of the subtitles' program.</summary>
115
public string Program {
116
get { return program; }
117
set { program = value; }
120
/// <summary>The subtitles' file path.</summary>
121
public string FilePath {
122
get { return filePath; }
123
set { filePath = value; }
126
/// <summary>The delay of the subtitles.</summary>
128
get { return delay; }
129
set { delay = value; }
132
/// <summary>The delay of the subtitles as text.</summary>
133
public string DelayAsText {
134
get { return delay.ToString(); }
137
delay = Convert.ToInt32(value);
144
/// <summary>The CD track of the subtitles.</summary>
146
get { return cdTrack; }
147
set { cdTrack = value; }
150
/// <summary>The CD track of the subtitles as text.</summary>
151
public string CDTrackAsText {
152
get { return cdTrack.ToString(); }
155
cdTrack = Convert.ToInt32(value);
162
public override string ToString() {
163
return "\t** SubViewer 1.0 Headers **\n" +
164
"Title: " + title + ", Author: " + author + ", Source: " + source + ", Program: " + program +
165
", FilePath: " + filePath + ", Delay: " + delay + ", CD Track: " + cdTrack;
170
/// <summary>Represents the headers of the SubViewer 2.0 subtitle format.</summary>
171
public class SubtitleHeadersSubViewer2 : SubtitleHeadersSubViewer1 {
172
private string comment = String.Empty;
173
private string fontColor = "&HFFFFFF";
174
private string fontStyle = "bd";
175
private int fontSize = 24;
176
private string fontName = "Tahoma";
179
/// <summary>A comment on the subtitles.</summary>
180
public string Comment {
181
get { return comment; }
182
set { comment = value; }
185
/// <summary>The subtitles' font color.</summary>
186
public string FontColor {
187
get { return fontColor; }
188
set { fontColor = value; }
191
/// <summary>The subtitles' font style.</summary>
192
public string FontStyle {
193
get { return fontStyle; }
194
set { fontStyle = value; }
197
/// <summary>The subtitles' font size.</summary>
198
public int FontSize {
199
get { return fontSize; }
200
set { fontSize = value; }
203
/// <summary>The subtitles' font size as text.</summary>
204
public string FontSizeAsText {
205
get { return fontSize.ToString(); }
208
fontSize = Convert.ToInt32(value);
215
/// <summary>The subtitles' font name.</summary>
216
public string FontName {
217
get { return fontName; }
218
set { fontName = value; }
221
public override string ToString() {
222
return "\t** SubViewer 2.0 Headers **\n" +
223
"Base " + base.ToString() + "\n" +
224
"FontColor: " + fontColor + ", FontStyle: " + fontStyle + ", FontSize: " + fontSize + ", FontName: " + fontName;
228
/// <summary>Represents the headers of the MPSub subtitle format.</summary>
229
public class SubtitleHeadersMPSub {
230
private string title = String.Empty;
231
private string file = String.Empty;
232
private string author = String.Empty;
233
private string mediaType = "VIDEO";
234
private string note = String.Empty;
237
/// <summary>The movie's title.</summary>
238
public string Title {
239
get { return title; }
240
set { title = value; }
243
/// <summary>The File properties, in the format 'size,md5'.</summary>
246
set { file = value; }
249
/// <summary>The subtitles' author.</summary>
250
public string Author {
251
get { return author; }
252
set { author = value; }
255
/// <summary>The Media Type of the subtitles, which can be 'VIDEO' or 'AUDIO'.</summary>
256
/// <remarks>This property is only set if the value is 'VIDEO' or 'AUDIO'. It's case insensitive.</remarks>
257
public string MediaType {
258
get { return mediaType; }
260
string type = value.ToUpper();
261
if (type.Equals("VIDEO") || type.Equals("AUDIO"))
266
/// <summary>A note on the subtitles.</summary>
269
set { note = value; }
272
public override string ToString() {
273
return "\t** MPSub Headers **\n" +
274
"Title: " + title + ", File: " + file + ", Author: " + author + ", MediaType: " + mediaType + ", Note: " + note;
279
/// <summary>Represents the headers of the Sub Station Alpha and Advanced Sub Station Alpha subtitle formats.</summary>
280
public class SubtitleHeadersSubStationAlphaASS {
281
private string title = String.Empty;
282
private string originalScript = "<unknown>";
283
private string originalTranslation = String.Empty;
284
private string originalEditing = String.Empty;
285
private string originalTiming = String.Empty;
286
private string originalScriptChecking = String.Empty;
287
private string scriptUpdatedBy = String.Empty;
288
private string collisions = String.Empty;
289
private int playResX = 0;
290
private int playResY = 0;
291
private int playDepth = 0;
292
private string timer = String.Empty;
294
/// <summary>The movie's title.</summary>
295
public string Title {
296
get { return title; }
297
set { title = value; }
300
/// <summary>The Original Script of the subtitles.</summary>
301
public string OriginalScript {
302
get { return originalScript; }
303
set { originalScript = value; }
306
/// <summary>The Original Translation of the subtitles.</summary>
307
public string OriginalTranslation {
308
get { return originalTranslation; }
309
set { originalTranslation = value; }
312
/// <summary>The Original Editing of the subtitles.</summary>
313
public string OriginalEditing {
314
get { return originalEditing; }
315
set { originalEditing = value; }
318
/// <summary>The Original Timing of the subtitles.</summary>
319
public string OriginalTiming {
320
get { return originalTiming; }
321
set { originalTiming = value; }
324
/// <summary>The Original Script Checking of the subtitles.</summary>
325
public string OriginalScriptChecking {
326
get { return originalScriptChecking; }
327
set { originalScriptChecking = value; }
330
/// <summary>The Script Updated By of the subtitles.</summary>
331
public string ScriptUpdatedBy {
332
get { return scriptUpdatedBy; }
333
set { scriptUpdatedBy = value; }
336
/// <summary>The Collisions of the subtitles.</summary>
337
public string Collisions {
338
get { return collisions; }
339
set { collisions = value; }
342
/// <summary>The PlayResX of the subtitles.</summary>
343
public int PlayResX {
344
get { return playResX; }
345
set { playResX = value; }
348
/// <summary>The PlayResX of the subtitles as text.</summary>
349
public string PlayResXAsText {
350
get { return playResX.ToString(); }
353
playResX = Convert.ToInt32(value);
360
/// <summary>The PlayResY of the subtitles.</summary>
361
public int PlayResY {
362
get { return playResY; }
363
set { playResY = value; }
366
/// <summary>The PlayResY of the subtitles as text.</summary>
367
public string PlayResYAsText {
368
get { return playResY.ToString(); }
371
playResY = Convert.ToInt32(value);
378
/// <summary>The PlayDepth of the subtitles.</summary>
379
public int PlayDepth {
380
get { return playDepth; }
381
set { playDepth = value; }
384
/// <summary>The PlayResY of the subtitles as text.</summary>
385
public string PlayDepthAsText {
386
get { return playDepth.ToString(); }
389
playDepth = Convert.ToInt32(value);
396
/// <summary>The Timer of the subtitles.</summary>
397
public string Timer {
398
get { return timer; }
399
set { timer = value; }
402
public override string ToString() {
403
return "\t** SubStationAlpha and Advanced SubStationAlpha Headers **\n" +
404
"Title: " + title + ", Original Script: " + originalScript + ", Original Translation: " + originalTranslation +
405
", Original Editing: " + originalEditing + ", Original Timing: " + originalTiming +
406
", Original Script Checking: " + originalScriptChecking + ", Script Updated By: " + scriptUpdatedBy +
407
", Collisions: " + collisions + ", PlayResX: " + playResX + ", PlayResY: " + playResY +
408
", PlayDepth: " + playDepth + ", Timer: " + timer;