From d06f1ea37c14f8c587fa5ffa744b6102e2cfb7cc Mon Sep 17 00:00:00 2001 From: Nikolaj Olsson Date: Sun, 1 Sep 2024 21:08:25 +0200 Subject: [PATCH] Work on settings --- SubtitleEdit.sln.DotSettings | 1 + src/libse/Common/Configuration.cs | 8 ++++++-- src/libse/Settings/Settings.cs | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/SubtitleEdit.sln.DotSettings b/SubtitleEdit.sln.DotSettings index 05bf0fa48..b49c68f42 100644 --- a/SubtitleEdit.sln.DotSettings +++ b/SubtitleEdit.sln.DotSettings @@ -42,6 +42,7 @@ True True True + True True True True diff --git a/src/libse/Common/Configuration.cs b/src/libse/Common/Configuration.cs index 346ce6269..47cd537b9 100644 --- a/src/libse/Common/Configuration.cs +++ b/src/libse/Common/Configuration.cs @@ -13,7 +13,7 @@ namespace Nikse.SubtitleEdit.Core.Common { private static readonly Lazy Instance = new Lazy(() => new Configuration()); - private readonly Lazy _settings; + private Lazy _settings; private readonly IEnumerable _encodings; public static readonly string BaseDirectory = GetBaseDirectory(); @@ -62,6 +62,11 @@ namespace Nikse.SubtitleEdit.Core.Common _settings = new Lazy(Core.Settings.Settings.GetSettings); } + public void SetSettings(Settings.Settings settings) + { + _settings = new Lazy(() => settings); + } + private const int PlatformWindows = 1; private const int PlatformLinux = 2; private const int PlatformMac = 3; @@ -294,6 +299,5 @@ namespace Nikse.SubtitleEdit.Core.Common return encodings.AsEnumerable(); } - } } diff --git a/src/libse/Settings/Settings.cs b/src/libse/Settings/Settings.cs index 04a403466..f191d55b3 100644 --- a/src/libse/Settings/Settings.cs +++ b/src/libse/Settings/Settings.cs @@ -198,7 +198,7 @@ namespace Nikse.SubtitleEdit.Core.Settings /// /// File name of xml settings file to load /// Newly loaded settings - private static Settings CustomDeserialize(string fileName) + public static Settings CustomDeserialize(string fileName) { var doc = new XmlDocument { PreserveWhitespace = true }; using (var stream = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))