Esempio n. 1
0
        private void DoExportSubtitleDialog(string fileNameSuffix, TimeTier timeTier, TextTier textTeir)
        {
            textTeir.AddTimeRangeData(timeTier);

            var action = new Action <string>(path => SRTFormatSubTitleExporter.Export(path, textTeir));

            DoSimpleExportDialog(".srt", "SRT Subtitle File", fileNameSuffix, string.Empty, action);
        }
Esempio n. 2
0
 public void Export_NoSegments_MakesEmptyFile()
 {
     using (var temp = TempFile.CreateAndGetPathButDontMakeTheFile())
     {
         SRTFormatSubTitleExporter.Export(temp.Path, new TextTier(TextTier.ElanTranscriptionTierId));
         Assert.IsTrue(File.Exists(temp.Path));
         Assert.AreEqual(0, File.ReadAllText(temp.Path).Length);
     }
 }
Esempio n. 3
0
        private void DoExportSubtitleDialog(string fileNameSuffix, TimeTier timeTier, TextTier textTeir)
        {
            textTeir.AddTimeRangeData(timeTier);

            var action = new Action <string>(path => SRTFormatSubTitleExporter.Export(path, textTeir));

            DoSimpleExportDialog(".srt",
                                 LocalizationManager.GetString("SessionsView.Transcription.TextAnnotation.ExportMenu.srtSubtitlesTranscriptionExport.TranscriptionFileDescriptor", "SRT Subtitle File ({0})"),
                                 fileNameSuffix, string.Empty, action);
        }
Esempio n. 4
0
 public void Export_FileLocked_Throws()
 {
     using (var temp = TempFile.CreateAndGetPathButDontMakeTheFile())
         using (File.OpenWrite(temp.Path))
         {
             Assert.Throws <IOException>(() =>
             {
                 SRTFormatSubTitleExporter.Export(temp.Path, CreateTier());
             });
         }
 }
Esempio n. 5
0
 public void Export_Nominal_WritesExpectedContents()
 {
     using (var temp = TempFile.CreateAndGetPathButDontMakeTheFile())
     {
         SRTFormatSubTitleExporter.Export(temp.Path, CreateTier());
         Debug.WriteLine(File.ReadAllText(temp.Path));
         var lines = GetLines(temp).ToArray();
         Assert.AreEqual((3 * 4) - 1, lines.Count());
         Assert.AreEqual("1", lines[0]);
         Assert.AreEqual("00:00:00,00 --> 00:00:01,00", lines[1]);
         Assert.AreEqual("one", lines[2]);
         Assert.AreEqual("", lines[3]);                  //blank line
         Assert.AreEqual("2", lines[4]);
         Assert.AreEqual("00:00:01,45 --> 00:00:02,67", lines[5]);
         Assert.AreEqual("two", lines[6]);
         Assert.AreEqual("", lines[7]);                  //blank line
     }
 }