Merge pull request #626 from ivandrofly/develop

Refact only
This commit is contained in:
Nikolaj Olsson 2015-03-08 15:10:48 +01:00
commit 796e0b08c5
3 changed files with 11 additions and 11 deletions

View File

@ -876,15 +876,13 @@ namespace Nikse.SubtitleEdit.Forms
{ {
using (var fixCommonErrors = new FixCommonErrors()) using (var fixCommonErrors = new FixCommonErrors())
{ {
fixCommonErrors.RunBatch(p.Subtitle, p.Format, p.Encoding, Configuration.Settings.Tools.BatchConvertLanguage); for (int i = 0; i < 3; i++)
p.Subtitle = fixCommonErrors.FixedSubtitle;
}
using (var fixCommonErrors = new FixCommonErrors())
{ {
fixCommonErrors.RunBatch(p.Subtitle, p.Format, p.Encoding, Configuration.Settings.Tools.BatchConvertLanguage); fixCommonErrors.RunBatch(p.Subtitle, p.Format, p.Encoding, Configuration.Settings.Tools.BatchConvertLanguage);
p.Subtitle = fixCommonErrors.FixedSubtitle; p.Subtitle = fixCommonErrors.FixedSubtitle;
} }
} }
}
catch (Exception exception) catch (Exception exception)
{ {
p.Error = string.Format(Configuration.Settings.Language.BatchConvert.FixCommonErrorsErrorX, exception.Message); p.Error = string.Format(Configuration.Settings.Language.BatchConvert.FixCommonErrorsErrorX, exception.Message);
@ -941,8 +939,9 @@ namespace Nikse.SubtitleEdit.Forms
{ {
Paragraph current = p.Subtitle.GetParagraphOrDefault(i); Paragraph current = p.Subtitle.GetParagraphOrDefault(i);
Paragraph next = p.Subtitle.GetParagraphOrDefault(i + 1); Paragraph next = p.Subtitle.GetParagraphOrDefault(i + 1);
if (next.StartTime.TotalMilliseconds - current.EndTime.TotalMilliseconds < minumumMillisecondsBetweenLines) var gapsBetween = next.StartTime.TotalMilliseconds - current.EndTime.TotalMilliseconds;
current.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - minumumMillisecondsBetweenLines; if (gapsBetween < minumumMillisecondsBetweenLines)
current.EndTime.TotalMilliseconds = gapsBetween;
} }
} }
e.Result = p; e.Result = p;

View File

@ -191,10 +191,10 @@ namespace Nikse.SubtitleEdit.Forms
else else
{ {
int index = newText.IndexOf(findWhat, StringComparison.OrdinalIgnoreCase); int index = newText.IndexOf(findWhat, StringComparison.OrdinalIgnoreCase);
hit = index >= 0;
while (index >= 0) while (index >= 0)
{ {
newText = newText.Substring(0, index) + replaceWith + newText.Remove(0, index + findWhat.Length); newText = newText.Remove(index, findWhat.Length).Insert(index, replaceWith);
hit = true;
index = newText.IndexOf(findWhat, index + replaceWith.Length, StringComparison.OrdinalIgnoreCase); index = newText.IndexOf(findWhat, index + replaceWith.Length, StringComparison.OrdinalIgnoreCase);
} }
} }

View File

@ -614,6 +614,7 @@ namespace Nikse.SubtitleEdit.Logic
} }
} }
Console.WriteLine(" done."); Console.WriteLine(" done.");
break;
} }
} }
if (!targetFormatFound) if (!targetFormatFound)