Trying to fix issue with format "DCinema SMTP 2010"

Might be related to #2351
This commit is contained in:
Nikolaj Olsson 2017-04-27 16:38:07 +02:00
parent 1b7363f6b2
commit 7174c93826
2 changed files with 29 additions and 31 deletions

View File

@ -468,9 +468,10 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
internal static string FixDcsTextSameLine(string xml)
{
int index = xml.IndexOf("<dcst:Text", StringComparison.Ordinal);
while (index > 0)
int endIndex = 1;
while (index > 0 && endIndex > 0)
{
int endIndex = xml.IndexOf("</dcst:Text>", index, StringComparison.Ordinal);
endIndex = xml.IndexOf("</dcst:Text>", index, StringComparison.Ordinal);
if (endIndex > 0)
{
var part = xml.Substring(index, endIndex - index);

View File

@ -1921,42 +1921,39 @@ namespace Nikse.SubtitleEdit.Forms
return;
}
if (ext == ".mxf")
if (ext == ".mxf" && FileUtil.IsMaterialExchangeFormat(fileName))
{
if (FileUtil.IsMaterialExchangeFormat(fileName))
var parser = new MxfParser(fileName);
if (parser.IsValid)
{
var parser = new MxfParser(fileName);
if (parser.IsValid)
var subtitles = parser.GetSubtitles();
if (subtitles.Count > 0)
{
var subtitles = parser.GetSubtitles();
if (subtitles.Count > 0)
{
SetEncoding(Configuration.Settings.General.DefaultEncoding);
var list = new List<string>(subtitles[0].SplitToLines());
_subtitle = new Subtitle();
var mxfFormat = _subtitle.ReloadLoadSubtitle(list, null, null);
SetCurrentFormat(mxfFormat);
_fileName = Path.GetFileNameWithoutExtension(fileName);
SetTitle();
ShowStatus(string.Format(_language.LoadedSubtitleX, _fileName));
_sourceViewChange = false;
_changeSubtitleToString = _subtitle.GetFastHashCode();
ResetHistory();
SetUndockedWindowsTitle();
_converted = true;
ShowStatus(string.Format(_language.LoadedSubtitleX, _fileName) + " - " + string.Format(_language.ConvertedToX, mxfFormat.FriendlyName));
SetEncoding(Configuration.Settings.General.DefaultEncoding);
var list = new List<string>(subtitles[0].SplitToLines());
_subtitle = new Subtitle();
var mxfFormat = _subtitle.ReloadLoadSubtitle(list, null, null);
SetCurrentFormat(mxfFormat);
_fileName = Path.GetFileNameWithoutExtension(fileName);
SetTitle();
ShowStatus(string.Format(_language.LoadedSubtitleX, _fileName));
_sourceViewChange = false;
_changeSubtitleToString = _subtitle.GetFastHashCode();
ResetHistory();
SetUndockedWindowsTitle();
_converted = true;
ShowStatus(string.Format(_language.LoadedSubtitleX, _fileName) + " - " + string.Format(_language.ConvertedToX, mxfFormat.FriendlyName));
ShowSource();
SubtitleListview1.Fill(_subtitle, _subtitleAlternate);
_subtitleListViewIndex = -1;
SubtitleListview1.FirstVisibleIndex = -1;
SubtitleListview1.SelectIndexAndEnsureVisible(0);
ShowSource();
SubtitleListview1.Fill(_subtitle, _subtitleAlternate);
_subtitleListViewIndex = -1;
SubtitleListview1.FirstVisibleIndex = -1;
SubtitleListview1.SelectIndexAndEnsureVisible(0);
return;
}
MessageBox.Show("No subtitles found!");
return;
}
MessageBox.Show("No subtitles found!");
return;
}
}