Merge pull request #5582 from OmrSi/replace-timed-text-1.0-ext-in-favorite-formats

Replace timed text 1.0 ext in favorite formats if changed
This commit is contained in:
Nikolaj Olsson 2021-12-09 16:55:07 +01:00 committed by GitHub
commit 1148d30e39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -310,7 +310,21 @@ namespace Nikse.SubtitleEdit.Forms
_subtitle.Header = _xml.OuterXml;
Configuration.Settings.SubtitleSettings.TimedText10TimeCodeFormat = comboBoxTimeCodeFormat.SelectedItem.ToString();
Configuration.Settings.SubtitleSettings.TimedText10FileExtension= comboBoxFileExtensions.SelectedItem.ToString();
var currentTimedTextExt = Configuration.Settings.SubtitleSettings.TimedText10FileExtension;
var newTimedTextExt = comboBoxFileExtensions.SelectedItem.ToString();
if (currentTimedTextExt != newTimedTextExt)
{
var favoriteFormats = Configuration.Settings.General.FavoriteSubtitleFormats;
var currentTimedTextWithExt = $"Timed Text 1.0 ({currentTimedTextExt})";
var newTimedTextWithExt = $"Timed Text 1.0 ({newTimedTextExt})";
if (favoriteFormats.Contains(currentTimedTextWithExt))
{
Configuration.Settings.General.FavoriteSubtitleFormats = favoriteFormats.Replace(currentTimedTextWithExt, newTimedTextWithExt);
}
Configuration.Settings.SubtitleSettings.TimedText10FileExtension = newTimedTextExt;
}
DialogResult = DialogResult.OK;
}