2 * This file is part of SubLib.
3 * Copyright (C) 2007-2008 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
20 using SubLib
.Core
.Domain
;
22 using System
.Text
.RegularExpressions
;
24 namespace SubLib
.IO
.SubtitleFormats
{
26 internal class SubtitleFormatDKSSubtitleFormat
: SubtitleFormat
{
28 internal SubtitleFormatDKSSubtitleFormat () {
29 name
= "DKS Subtitle Format";
30 type
= SubtitleType
.DKSSubtitleFormat
;
31 mode
= SubtitleMode
.Times
;
32 extensions
= new string[] { "dks" }
;
35 format
= @"\[\d+:\d+:\d+\]\s*.*\s*\[\d+:\d+:\d+\]";
37 subtitleIn
= @"\[\s*(?<StartHours>\d+)\s*:\s*(?<StartMinutes>\d+)\s*:\s*(?<StartSeconds>\d+)\s*\]\s*(?<Text>.*)\s*\[\s*(?<EndHours>\d+)\s*:\s*(?<EndMinutes>\d+)\s*:\s*(?<EndSeconds>\d+)\s*\]";
39 subtitleOut
= "[<<StartHours>>:<<StartMinutes>>:<<StartSeconds>>]<<Text>>\n" +
40 "[<<EndHours>>:<<EndMinutes>>:<<EndSeconds>>]\n";