From 9e8a950580becfb5f232df40c2a73e65a5e30200 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Sat, 5 Apr 2025 23:01:09 +0800 Subject: [PATCH] Fix build issue & Improve code quality --- .../PinyinAlphabet.cs | 21 +++++-------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/Flow.Launcher.Infrastructure/PinyinAlphabet.cs b/Flow.Launcher.Infrastructure/PinyinAlphabet.cs index e12764ed3..a63dd99d9 100644 --- a/Flow.Launcher.Infrastructure/PinyinAlphabet.cs +++ b/Flow.Launcher.Infrastructure/PinyinAlphabet.cs @@ -1,7 +1,5 @@ -using System; -using System.Collections.Concurrent; +using System.Collections.Concurrent; using System.Text; -using JetBrains.Annotations; using Flow.Launcher.Infrastructure.UserSettings; using ToolGood.Words.Pinyin; using System.Collections.Generic; @@ -15,11 +13,11 @@ namespace Flow.Launcher.Infrastructure private readonly ConcurrentDictionary _pinyinCache = new(); - private Settings _settings; + private readonly Settings _settings; - public void Initialize([NotNull] Settings settings) + public PinyinAlphabet() { - _settings = settings ?? throw new ArgumentNullException(nameof(settings)); + _settings = Ioc.Default.GetRequiredService(); } public bool ShouldTranslate(string stringToTranslate) @@ -109,16 +107,6 @@ namespace Flow.Launcher.Infrastructure {"Sh", "u"}, {"Zh", "v"} }); - - public PinyinAlphabet() - { - Initialize(Ioc.Default.GetRequiredService()); - } - - private void Initialize([NotNull] Settings settings) - { - _settings = settings ?? throw new ArgumentNullException(nameof(settings)); - } private static readonly ReadOnlyDictionary second = new(new Dictionary() { @@ -200,6 +188,7 @@ namespace Flow.Launcher.Infrastructure return doublePin.ToString(); } + #endregion } }