Exemplo n.º 1
0
        private void ImportAndOcrBdnXml(string fileName, BdnXml bdnXml, List<string> list)
        {
            using (var formSubOcr = new VobSubOcr())
            {
                var bdnSubtitle = new Subtitle();
                bdnXml.LoadSubtitle(bdnSubtitle, list, fileName);
                bdnSubtitle.FileName = fileName;
                formSubOcr.Initialize(bdnSubtitle, Configuration.Settings.VobSubOcr, false);
                if (formSubOcr.ShowDialog(this) == DialogResult.OK)
                {
                    MakeHistoryForUndo(_language.BeforeImportingBdnXml);
                    FileNew();
                    _subtitle.Paragraphs.Clear();
                    SetCurrentFormat(Configuration.Settings.General.DefaultSubtitleFormat);
                    _subtitle.WasLoadedWithFrameNumbers = false;
                    _subtitle.CalculateFrameNumbersFromTimeCodes(CurrentFrameRate);
                    foreach (var p in formSubOcr.SubtitleFromOcr.Paragraphs)
                    {
                        _subtitle.Paragraphs.Add(p);
                    }

                    ShowSource();
                    SubtitleListview1.Fill(_subtitle, _subtitleAlternate);
                    _subtitleListViewIndex = -1;
                    SubtitleListview1.FirstVisibleIndex = -1;
                    SubtitleListview1.SelectIndexAndEnsureVisible(0);

                    _fileName = Path.ChangeExtension(formSubOcr.FileName, ".srt");
                    SetTitle();
                    _converted = true;
                }
            }
        }