mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 10:46:33 +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:
@@ -2,9 +2,11 @@
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Text.Json;
|
||||
using Wox.Infrastructure.Storage;
|
||||
using Wox.Infrastructure.UserSettings;
|
||||
using Wox.Plugin;
|
||||
using Wox.Plugin.Logger;
|
||||
|
||||
namespace PowerLauncher.ViewModel
|
||||
{
|
||||
@@ -16,6 +18,22 @@ namespace PowerLauncher.ViewModel
|
||||
{
|
||||
_storage = new WoxJsonStorage<PowerToysRunSettings>();
|
||||
Settings = _storage.Load();
|
||||
|
||||
// Check information file for version mismatch
|
||||
try
|
||||
{
|
||||
if (_storage.CheckVersionMismatch())
|
||||
{
|
||||
if (!_storage.TryLoadData())
|
||||
{
|
||||
_storage.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (JsonException e)
|
||||
{
|
||||
Log.Exception($"Error in Load of PowerToysRunSettings: {e.Message}", e, GetType());
|
||||
}
|
||||
}
|
||||
|
||||
public PowerToysRunSettings Settings { get; }
|
||||
|
||||
Reference in New Issue
Block a user