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())
{
fixCommonErrors.RunBatch(p.Subtitle, p.Format, p.Encoding, Configuration.Settings.Tools.BatchConvertLanguage);
p.Subtitle = fixCommonErrors.FixedSubtitle;
}
using (var fixCommonErrors = new FixCommonErrors())
for (int i = 0; i < 3; i++)
{
fixCommonErrors.RunBatch(p.Subtitle, p.Format, p.Encoding, Configuration.Settings.Tools.BatchConvertLanguage);
p.Subtitle = fixCommonErrors.FixedSubtitle;
}
}
}
catch (Exception exception)
{
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 next = p.Subtitle.GetParagraphOrDefault(i + 1);
if (next.StartTime.TotalMilliseconds - current.EndTime.TotalMilliseconds < minumumMillisecondsBetweenLines)
current.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - minumumMillisecondsBetweenLines;
var gapsBetween = next.StartTime.TotalMilliseconds - current.EndTime.TotalMilliseconds;
if (gapsBetween < minumumMillisecondsBetweenLines)
current.EndTime.TotalMilliseconds = gapsBetween;
}
}
e.Result = p;

View File

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

View File

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