diff --git a/src/Forms/BatchConvert.cs b/src/Forms/BatchConvert.cs index fbaba0b01..8078d499c 100644 --- a/src/Forms/BatchConvert.cs +++ b/src/Forms/BatchConvert.cs @@ -730,11 +730,11 @@ namespace Nikse.SubtitleEdit.Forms sub = vobSubOcr.SubtitleFromOcr; } } - if (comboBoxSubtitleFormats.Text == new AdvancedSubStationAlpha().Name && _assStyle != null) + if (comboBoxSubtitleFormats.Text == AdvancedSubStationAlpha.NameOfFormat && _assStyle != null) { sub.Header = _assStyle; } - else if (comboBoxSubtitleFormats.Text == new SubStationAlpha().Name && _ssaStyle != null) + else if (comboBoxSubtitleFormats.Text == SubStationAlpha.NameOfFormat && _ssaStyle != null) { sub.Header = _ssaStyle; } @@ -989,7 +989,7 @@ namespace Nikse.SubtitleEdit.Forms private void ComboBoxSubtitleFormatsSelectedIndexChanged(object sender, EventArgs e) { - if (comboBoxSubtitleFormats.Text == new AdvancedSubStationAlpha().Name || comboBoxSubtitleFormats.Text == new SubStationAlpha().Name) + if (comboBoxSubtitleFormats.Text == AdvancedSubStationAlpha.NameOfFormat || comboBoxSubtitleFormats.Text == SubStationAlpha.NameOfFormat) { buttonStyles.Visible = true; } diff --git a/src/Forms/Main.cs b/src/Forms/Main.cs index aa597fd57..8ff7effd0 100644 --- a/src/Forms/Main.cs +++ b/src/Forms/Main.cs @@ -2143,7 +2143,7 @@ namespace Nikse.SubtitleEdit.Forms } } - if (format == null || format.Name == new Scenarist().Name) + if (format == null || format.Name == Scenarist.NameOfFormat) { try { @@ -2165,7 +2165,7 @@ namespace Nikse.SubtitleEdit.Forms } } - if (format == null || format.Name == new SubRip().Name) + if (format == null || format.Name == SubRip.NameOfFormat) { if (_subtitle.Paragraphs.Count > 1) { @@ -2212,7 +2212,7 @@ namespace Nikse.SubtitleEdit.Forms } } - if (format == null || format.Name == new Scenarist().Name) + if (format == null || format.Name == Scenarist.NameOfFormat) { try { diff --git a/src/Forms/Styles/SubStationAlphaStyles.cs b/src/Forms/Styles/SubStationAlphaStyles.cs index c9193c624..fdef06146 100644 --- a/src/Forms/Styles/SubStationAlphaStyles.cs +++ b/src/Forms/Styles/SubStationAlphaStyles.cs @@ -1121,12 +1121,12 @@ namespace Nikse.SubtitleEdit.Forms.Styles openFileDialogImport.InitialDirectory = Configuration.DataDirectory; if (_isSubStationAlpha) { - openFileDialogImport.Filter = new SubStationAlpha().Name + "|*.ssa|" + Configuration.Settings.Language.General.AllFiles + "|*.*"; + openFileDialogImport.Filter = SubStationAlpha.NameOfFormat + "|*.ssa|" + Configuration.Settings.Language.General.AllFiles + "|*.*"; saveFileDialogStyle.FileName = "my_styles.ssa"; } else { - openFileDialogImport.Filter = new AdvancedSubStationAlpha().Name + "|*.ass|" + Configuration.Settings.Language.General.AllFiles + "|*.*"; + openFileDialogImport.Filter = AdvancedSubStationAlpha.NameOfFormat + "|*.ass|" + Configuration.Settings.Language.General.AllFiles + "|*.*"; saveFileDialogStyle.FileName = "my_styles.ass"; } @@ -1207,12 +1207,12 @@ namespace Nikse.SubtitleEdit.Forms.Styles saveFileDialogStyle.InitialDirectory = Configuration.DataDirectory; if (_isSubStationAlpha) { - saveFileDialogStyle.Filter = new SubStationAlpha().Name + "|*.ssa|" + Configuration.Settings.Language.General.AllFiles + "|*.*"; + saveFileDialogStyle.Filter = SubStationAlpha.NameOfFormat + "|*.ssa|" + Configuration.Settings.Language.General.AllFiles + "|*.*"; saveFileDialogStyle.FileName = "my_styles.ssa"; } else { - saveFileDialogStyle.Filter = new AdvancedSubStationAlpha().Name + "|*.ass|" + Configuration.Settings.Language.General.AllFiles + "|*.*"; + saveFileDialogStyle.Filter = AdvancedSubStationAlpha.NameOfFormat + "|*.ass|" + Configuration.Settings.Language.General.AllFiles + "|*.*"; saveFileDialogStyle.FileName = "my_styles.ass"; } diff --git a/src/Logic/CommandLineConvert.cs b/src/Logic/CommandLineConvert.cs index c575c24ad..4920568d0 100644 --- a/src/Logic/CommandLineConvert.cs +++ b/src/Logic/CommandLineConvert.cs @@ -218,8 +218,8 @@ namespace Nikse.SubtitleEdit.Logic if (format.GetType() == typeof(AdvancedSubStationAlpha) || format.GetType() == typeof(SubStationAlpha)) { - if (toFormat.ToLower() != new AdvancedSubStationAlpha().Name.ToLower().Replace(" ", string.Empty) && - toFormat.ToLower() != new SubStationAlpha().Name.ToLower().Replace(" ", string.Empty)) + if (toFormat.ToLower() != AdvancedSubStationAlpha.NameOfFormat.ToLower().Replace(" ", string.Empty) && + toFormat.ToLower() != SubStationAlpha.NameOfFormat.ToLower().Replace(" ", string.Empty)) { foreach (SubtitleFormat sf in formats) diff --git a/src/Logic/SubtitleFormats/AdvancedSubStationAlpha.cs b/src/Logic/SubtitleFormats/AdvancedSubStationAlpha.cs index 8ff31dc72..5cc6739e2 100644 --- a/src/Logic/SubtitleFormats/AdvancedSubStationAlpha.cs +++ b/src/Logic/SubtitleFormats/AdvancedSubStationAlpha.cs @@ -51,9 +51,11 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats get { return ".ass"; } } + public const string NameOfFormat = "Advanced Sub Station Alpha"; + public override string Name { - get { return "Advanced Sub Station Alpha"; } + get { return NameOfFormat; } } public override bool IsTimeBased @@ -855,7 +857,7 @@ Format: Layer, Start, End, Style, Actor, MarginL, MarginR, MarginV, Effect, Text public override void RemoveNativeFormatting(Subtitle subtitle, SubtitleFormat newFormat) { - if (newFormat != null && newFormat.Name == new SubStationAlpha().Name) + if (newFormat != null && newFormat.Name == SubStationAlpha.NameOfFormat) { foreach (Paragraph p in subtitle.Paragraphs) { diff --git a/src/Logic/SubtitleFormats/Scenarist.cs b/src/Logic/SubtitleFormats/Scenarist.cs index 39aebf2a7..bb5b8625f 100644 --- a/src/Logic/SubtitleFormats/Scenarist.cs +++ b/src/Logic/SubtitleFormats/Scenarist.cs @@ -15,9 +15,11 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats get { return ".txt"; } } + public const string NameOfFormat = "Scenarist"; + public override string Name { - get { return "Scenarist"; } + get { return NameOfFormat; } } public override bool IsTimeBased diff --git a/src/Logic/SubtitleFormats/SubRip.cs b/src/Logic/SubtitleFormats/SubRip.cs index 6eeb9b887..999efddd5 100644 --- a/src/Logic/SubtitleFormats/SubRip.cs +++ b/src/Logic/SubtitleFormats/SubRip.cs @@ -31,9 +31,11 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats get { return ".srt"; } } + public const string NameOfFormat = "SubRip"; + public override string Name { - get { return "SubRip"; } + get { return NameOfFormat; } } public override bool IsTimeBased diff --git a/src/Logic/SubtitleFormats/SubStationAlpha.cs b/src/Logic/SubtitleFormats/SubStationAlpha.cs index 86e00eb32..c5e058759 100644 --- a/src/Logic/SubtitleFormats/SubStationAlpha.cs +++ b/src/Logic/SubtitleFormats/SubStationAlpha.cs @@ -17,9 +17,12 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats get { return ".ssa"; } } + + public const string NameOfFormat = "Sub Station Alpha"; + public override string Name { - get { return "Sub Station Alpha"; } + get { return NameOfFormat; } } public override bool IsTimeBased @@ -434,7 +437,7 @@ Format: Marked, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text public override void RemoveNativeFormatting(Subtitle subtitle, SubtitleFormat newFormat) { - if (newFormat != null && newFormat.Name == new AdvancedSubStationAlpha().Name) + if (newFormat != null && newFormat.Name == AdvancedSubStationAlpha.NameOfFormat) { // do we need any conversion? }