static void Main(string[] args)
        {
            string batchFile = args[0];

            FileProvider fileProvider = new FileProvider();
            IEnumerable <SubtitleFileInfo> subtilesInfos = fileProvider.ReadTxtFile(batchFile);

            MVAXml2Subs.Parser.XmlParser parser = new MVAXml2Subs.Parser.XmlParser();

            SrtConverter subtitleConverter = new SrtConverter();

            foreach (var subtitleFileInfo in subtilesInfos)
            {
                IEnumerable <SubtitleModel> lines = parser.Parse(fileProvider.ReadFile(subtitleFileInfo.Incoming));

                string subtitleText = subtitleConverter.Create(lines);

                fileProvider.WriteFile(subtitleFileInfo.Outcoming, subtitleText);
            }
        }
Exemple #2
0
        public void Create()
        {
            IEnumerable <SubtitleModel> set = new[]
            {
                new SubtitleModel
                {
                    Start = new TimeSpan(0, 0, 0, 0, 200),
                    End   = new TimeSpan(0, 0, 0, 1, 900),
                    Value = "Hello World!",
                }
            };

            SrtConverter converter = new SrtConverter();
            string       result    = converter.Create(set);

            string expect = @"1
00:00:00,200 --> 00:00:01,900
Hello World!";

            Assert.Equal(expect, result);
        }