Fix for shortcut open original - thx OmrSi :)

Fix #3991
This commit is contained in:
Nikolaj Olsson 2020-02-17 18:28:53 +01:00
parent 4ba3dfd6e7
commit 117fba4425

View File

@ -36,11 +36,21 @@ namespace Nikse.SubtitleEdit.Core
public void Add(string fileName, int firstVisibleIndex, int firstSelectedIndex, string videoFileName, string originalFileName, long videoOffset)
{
if (string.IsNullOrEmpty(fileName) && !string.IsNullOrEmpty(originalFileName))
{
fileName = originalFileName;
}
if (string.IsNullOrEmpty(fileName))
{
return;
}
var newList = new List<RecentFileEntry> { new RecentFileEntry { FileName = fileName, FirstVisibleIndex = firstVisibleIndex, FirstSelectedIndex = firstSelectedIndex, VideoFileName = videoFileName, OriginalFileName = originalFileName, VideoOffsetInMs = videoOffset } };
int index = 0;
foreach (var oldRecentFile in Files)
{
if (fileName != null && !fileName.Equals(oldRecentFile.FileName, StringComparison.OrdinalIgnoreCase) && index < MaxRecentFiles)
if (!fileName.Equals(oldRecentFile.FileName, StringComparison.OrdinalIgnoreCase) && index < MaxRecentFiles)
{
newList.Add(new RecentFileEntry { FileName = oldRecentFile.FileName, FirstVisibleIndex = oldRecentFile.FirstVisibleIndex, FirstSelectedIndex = oldRecentFile.FirstSelectedIndex, VideoFileName = oldRecentFile.VideoFileName, OriginalFileName = oldRecentFile.OriginalFileName, VideoOffsetInMs = oldRecentFile.VideoOffsetInMs });
}