2016-03-28 03:09:57 +01:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
2015-10-30 23:17:34 +00:00
|
|
|
|
using System.ComponentModel;
|
2015-01-05 22:41:17 +08:00
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
|
using Wox.Infrastructure.Storage;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Wox.Plugin.Program
|
|
|
|
|
|
{
|
2016-03-28 03:09:57 +01:00
|
|
|
|
[Serializable]
|
2015-01-05 22:41:17 +08:00
|
|
|
|
public class ProgramStorage : JsonStrorage<ProgramStorage>
|
|
|
|
|
|
{
|
|
|
|
|
|
[JsonProperty]
|
|
|
|
|
|
public List<ProgramSource> ProgramSources { get; set; }
|
|
|
|
|
|
|
2016-03-28 03:09:57 +01:00
|
|
|
|
|
2015-01-05 22:41:17 +08:00
|
|
|
|
[JsonProperty]
|
2016-03-28 03:09:57 +01:00
|
|
|
|
public string[] ProgramSuffixes { get; set; }
|
2015-01-05 22:41:17 +08:00
|
|
|
|
|
2015-05-02 09:47:03 -04:00
|
|
|
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
|
|
|
|
|
|
[DefaultValue(true)]
|
|
|
|
|
|
public bool EnableStartMenuSource { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
|
|
|
|
|
|
[DefaultValue(true)]
|
|
|
|
|
|
public bool EnableRegistrySource { get; set; }
|
|
|
|
|
|
|
2015-01-05 22:41:17 +08:00
|
|
|
|
protected override ProgramStorage LoadDefault()
|
|
|
|
|
|
{
|
|
|
|
|
|
ProgramSources = new List<ProgramSource>();
|
2015-05-02 09:47:03 -04:00
|
|
|
|
EnableStartMenuSource = true;
|
|
|
|
|
|
EnableRegistrySource = true;
|
2015-01-05 22:41:17 +08:00
|
|
|
|
return this;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected override void OnAfterLoad(ProgramStorage storage)
|
|
|
|
|
|
{
|
2016-03-28 03:09:57 +01:00
|
|
|
|
if (storage.ProgramSuffixes == null || storage.ProgramSuffixes.Length == 0)
|
2015-01-05 22:41:17 +08:00
|
|
|
|
{
|
2016-03-28 03:09:57 +01:00
|
|
|
|
storage.ProgramSuffixes = new[] {"bat", "appref-ms", "exe", "lnk"};
|
2015-01-05 22:41:17 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2016-01-07 02:31:17 +00:00
|
|
|
|
protected override string FileName { get; } = "settings_plugin_program";
|
2015-01-05 22:41:17 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|