Replace timed text 1.0 ext in favorite formats if changed

This commit is contained in:
OmrSi 2021-12-09 05:53:40 +02:00
parent 5e5cf95360
commit 3e309da6ad

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;
}