Fixed bug in sami reading - thx josh :)

git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@1266 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
niksedk 2012-06-20 19:08:40 +00:00
parent 9d9f1ce520
commit 053fa2931f

View File

@ -133,9 +133,10 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
while (syncStartPos >= 0) while (syncStartPos >= 0)
{ {
string millisecAsString = string.Empty; string millisecAsString = string.Empty;
while (index < allInput.Length && "0123456789".Contains(allInput[index].ToString())) while (index < allInput.Length && "\"'0123456789".Contains(allInput[index].ToString()))
{ {
millisecAsString += allInput[index]; if (allInput[index] != '"' && allInput[index] != '\'')
millisecAsString += allInput[index];
index++; index++;
} }
@ -210,7 +211,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
cleanText = cleanText.Replace("&nbsp;", string.Empty).Replace("&NBSP;", string.Empty); cleanText = cleanText.Replace("&nbsp;", string.Empty).Replace("&NBSP;", string.Empty);
cleanText = cleanText.Trim(); cleanText = cleanText.Trim();
if (!string.IsNullOrEmpty(p.Text)) if (!string.IsNullOrEmpty(p.Text) && !string.IsNullOrEmpty(millisecAsString))
{ {
p.EndTime = new TimeCode(TimeSpan.FromMilliseconds(long.Parse(millisecAsString))); p.EndTime = new TimeCode(TimeSpan.FromMilliseconds(long.Parse(millisecAsString)));
subtitle.Paragraphs.Add(p); subtitle.Paragraphs.Add(p);