Work on settings

This commit is contained in:
Nikolaj Olsson 2024-09-01 21:08:25 +02:00
parent 4206978b0b
commit d06f1ea37c
3 changed files with 8 additions and 3 deletions

View File

@ -42,6 +42,7 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=Nuendo/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Ollama/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Purfview/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Spectrograms/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Stbl/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Tahoma/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Tesseract/@EntryIndexedValue">True</s:Boolean>

View File

@ -13,7 +13,7 @@ namespace Nikse.SubtitleEdit.Core.Common
{
private static readonly Lazy<Configuration> Instance = new Lazy<Configuration>(() => new Configuration());
private readonly Lazy<Settings.Settings> _settings;
private Lazy<Settings.Settings> _settings;
private readonly IEnumerable<Encoding> _encodings;
public static readonly string BaseDirectory = GetBaseDirectory();
@ -62,6 +62,11 @@ namespace Nikse.SubtitleEdit.Core.Common
_settings = new Lazy<Settings.Settings>(Core.Settings.Settings.GetSettings);
}
public void SetSettings(Settings.Settings settings)
{
_settings = new Lazy<Settings.Settings>(() => 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();
}
}
}

View File

@ -198,7 +198,7 @@ namespace Nikse.SubtitleEdit.Core.Settings
/// </summary>
/// <param name="fileName">File name of xml settings file to load</param>
/// <returns>Newly loaded settings</returns>
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))