mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 19:26:39 +02:00
Remove instance logic for BinaryStorage and JsonStorage, part 1
1. part of #389 2. huge refactoring
This commit is contained in:
@@ -1,45 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using Newtonsoft.Json;
|
||||
using Wox.Infrastructure.Storage;
|
||||
|
||||
namespace Wox.Plugin.Program
|
||||
{
|
||||
[Serializable]
|
||||
public class ProgramStorage : JsonStrorage<ProgramStorage>
|
||||
public class Settings
|
||||
{
|
||||
[JsonProperty]
|
||||
public List<ProgramSource> ProgramSources { get; set; }
|
||||
public List<ProgramSource> ProgramSources { get; set; } = new List<ProgramSource>();
|
||||
public string[] ProgramSuffixes { get; set; } = {"bat", "appref-ms", "exe", "lnk"};
|
||||
|
||||
public bool EnableStartMenuSource { get; set; } = true;
|
||||
|
||||
[JsonProperty]
|
||||
public string[] ProgramSuffixes { get; set; }
|
||||
|
||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
|
||||
[DefaultValue(true)]
|
||||
public bool EnableStartMenuSource { get; set; }
|
||||
|
||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
|
||||
[DefaultValue(true)]
|
||||
public bool EnableRegistrySource { get; set; }
|
||||
|
||||
protected override ProgramStorage LoadDefault()
|
||||
{
|
||||
ProgramSources = new List<ProgramSource>();
|
||||
EnableStartMenuSource = true;
|
||||
EnableRegistrySource = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
protected override void OnAfterLoad(ProgramStorage storage)
|
||||
{
|
||||
if (storage.ProgramSuffixes == null || storage.ProgramSuffixes.Length == 0)
|
||||
{
|
||||
storage.ProgramSuffixes = new[] {"bat", "appref-ms", "exe", "lnk"};
|
||||
}
|
||||
}
|
||||
|
||||
protected override string FileName { get; } = "settings_plugin_program";
|
||||
public bool EnableRegistrySource { get; set; } = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user