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:
@@ -4,6 +4,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Wox.Plugin
|
||||
@@ -73,6 +74,34 @@ namespace Wox.Plugin
|
||||
}
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
foreach (var key in Records.Keys.ToList())
|
||||
{
|
||||
// Check if any of the specified fields are empty
|
||||
if (string.IsNullOrEmpty(Records[key].IconPath) ||
|
||||
string.IsNullOrEmpty(Records[key].Title) ||
|
||||
string.IsNullOrEmpty(Records[key].SubTitle) ||
|
||||
string.IsNullOrEmpty(Records[key].Search) ||
|
||||
string.IsNullOrEmpty(Records[key].PluginID))
|
||||
{
|
||||
Records.Remove(key);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Records[key].SelectedCount == 0)
|
||||
{
|
||||
Records[key].SelectedCount = 1;
|
||||
}
|
||||
|
||||
if (Records[key].LastSelected == DateTime.MinValue)
|
||||
{
|
||||
Records[key].LastSelected = DateTime.UtcNow;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public UserSelectedRecordItem GetSelectedData(Result result)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(result);
|
||||
|
||||
Reference in New Issue
Block a user