Fix "Join" with append issues - thx Henrique :)

Do not auto-sort when adding files in append mode
This commit is contained in:
Nikolaj Olsson 2020-03-21 10:09:45 +01:00
parent a76e20f721
commit 94d12b0c54

View File

@ -176,21 +176,25 @@ namespace Nikse.SubtitleEdit.Forms
}
JoinedFormat = lastFormat;
for (int outer = 0; outer < subtitles.Count; outer++)
{
for (int inner = 1; inner < subtitles.Count; inner++)
{
var a = subtitles[inner - 1];
var b = subtitles[inner];
if (a.Paragraphs.Count > 0 && b.Paragraphs.Count > 0 && a.Paragraphs[0].StartTime.TotalMilliseconds > b.Paragraphs[0].StartTime.TotalMilliseconds)
{
string t1 = _fileNamesToJoin[inner - 1];
_fileNamesToJoin[inner - 1] = _fileNamesToJoin[inner];
_fileNamesToJoin[inner] = t1;
var t2 = subtitles[inner - 1];
subtitles[inner - 1] = subtitles[inner];
subtitles[inner] = t2;
if (!radioButtonJoinAddTime.Checked)
{
for (int outer = 0; outer < subtitles.Count; outer++)
{
for (int inner = 1; inner < subtitles.Count; inner++)
{
var a = subtitles[inner - 1];
var b = subtitles[inner];
if (a.Paragraphs.Count > 0 && b.Paragraphs.Count > 0 && a.Paragraphs[0].StartTime.TotalMilliseconds > b.Paragraphs[0].StartTime.TotalMilliseconds)
{
string t1 = _fileNamesToJoin[inner - 1];
_fileNamesToJoin[inner - 1] = _fileNamesToJoin[inner];
_fileNamesToJoin[inner] = t1;
var t2 = subtitles[inner - 1];
subtitles[inner - 1] = subtitles[inner];
subtitles[inner] = t2;
}
}
}
}
@ -338,6 +342,7 @@ namespace Nikse.SubtitleEdit.Forms
{
numericUpDownAddMs.Enabled = radioButtonJoinAddTime.Checked;
labelAddTime.Enabled = radioButtonJoinAddTime.Checked;
SortAndLoad();
}
}
}