mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 19:57:07 +02:00
[PTRun]Don't clear config data on upgrade (#30187)
* [PTRun] Implemented a new JSON storage method for PTRun settings files. * [PTRun] Removed uncessary parts. * [PTRun] Spell checks. * [PTRun] New JsonSerializerOptions added for information files. * [PTRun] Unnecessary null check is removed. * [PT Run] - ExtractFields function removed. - Creating instance is used instead of deserializing. * [PTRun] Build fix * [PTRun] Removed unncessary parts * [PTRun] CheckWithInformationFileToClear reversed. * [PTRun] Build fix. * [PTRun] Deserialization is used instead of key by key comparison. * [PTRun] Removed unncessary parts. * [PTRun] Removed unncessary parts. * [PTRun] Remove entry if query is null or empty.
This commit is contained in:
@@ -24,9 +24,8 @@ public class Alphabet : IAlphabet
|
||||
PinyinFormat.WITHOUT_TONE;
|
||||
|
||||
private ConcurrentDictionary<string, string[][]> _pinyinCache;
|
||||
private WoxJsonStorage<Dictionary<string, string[][]>> _pinyinStorage;
|
||||
private WoxJsonStorage<ConcurrentDictionary<string, string[][]>> _pinyinStorage;
|
||||
private PowerToysRunSettings _settings;
|
||||
private Dictionary<string, string[][]> __cache;
|
||||
|
||||
public void Initialize(PowerToysRunSettings settings)
|
||||
{
|
||||
@@ -38,8 +37,8 @@ public class Alphabet : IAlphabet
|
||||
{
|
||||
Stopwatch.Normal("|Wox.Infrastructure.Alphabet.Initialize|Preload pinyin cache", () =>
|
||||
{
|
||||
_pinyinStorage = new WoxJsonStorage<Dictionary<string, string[][]>>("Pinyin");
|
||||
SetPinyinCacheAsDictionary(__cache = _pinyinStorage.Load());
|
||||
_pinyinStorage = new WoxJsonStorage<ConcurrentDictionary<string, string[][]>>("Pinyin");
|
||||
_pinyinCache = _pinyinStorage.Load();
|
||||
|
||||
// force pinyin library static constructor initialize
|
||||
Pinyin4Net.GetPinyin('一', _pinyinFormat);
|
||||
@@ -204,9 +203,4 @@ public class Alphabet : IAlphabet
|
||||
{
|
||||
return new Dictionary<string, string[][]>(_pinyinCache);
|
||||
}
|
||||
|
||||
private void SetPinyinCacheAsDictionary(Dictionary<string, string[][]> usage)
|
||||
{
|
||||
_pinyinCache = new ConcurrentDictionary<string, string[][]>(usage);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user