mirror of
https://github.com/microsoft/PowerToys
synced 2025-09-05 17:05:12 +00:00
43 lines
1.4 KiB
C#
43 lines
1.4 KiB
C#
// Copyright (c) Microsoft Corporation
|
|
// 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.Collections.Generic;
|
|
using Wox.Plugin;
|
|
|
|
namespace Wox.Infrastructure.UserSettings
|
|
{
|
|
public class PluginSettings : BaseModel
|
|
{
|
|
public Dictionary<string, Plugin> Plugins { get; set; } = new Dictionary<string, Plugin>();
|
|
|
|
public void UpdatePluginSettings(List<PluginMetadata> metadatas)
|
|
{
|
|
foreach (var metadata in metadatas)
|
|
{
|
|
if (Plugins.ContainsKey(metadata.ID))
|
|
{
|
|
var settings = Plugins[metadata.ID];
|
|
if (settings.ActionKeywords?.Count > 0)
|
|
{
|
|
metadata.ActionKeywords = settings.ActionKeywords;
|
|
metadata.ActionKeyword = settings.ActionKeywords[0];
|
|
}
|
|
|
|
metadata.Disabled = settings.Disabled;
|
|
}
|
|
else
|
|
{
|
|
Plugins[metadata.ID] = new Plugin
|
|
{
|
|
ID = metadata.ID,
|
|
Name = metadata.Name,
|
|
ActionKeywords = metadata.ActionKeywords,
|
|
Disabled = metadata.Disabled,
|
|
};
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|