2015-01-05 22:41:17 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using Wox.Infrastructure.Storage;
|
2015-05-02 21:47:03 +08:00
|
|
|
|
using System.ComponentModel;
|
2015-01-05 22:41:17 +08:00
|
|
|
|
|
|
|
|
|
namespace Wox.Plugin.Program
|
|
|
|
|
{
|
|
|
|
|
public class ProgramStorage : JsonStrorage<ProgramStorage>
|
|
|
|
|
{
|
|
|
|
|
[JsonProperty]
|
|
|
|
|
public List<ProgramSource> ProgramSources { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty]
|
|
|
|
|
public string ProgramSuffixes { get; set; }
|
|
|
|
|
|
2015-05-02 21:47:03 +08: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 string ConfigFolder
|
|
|
|
|
{
|
|
|
|
|
get { return Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override ProgramStorage LoadDefault()
|
|
|
|
|
{
|
|
|
|
|
ProgramSources = new List<ProgramSource>();
|
2015-05-02 21:47:03 +08:00
|
|
|
|
EnableStartMenuSource = true;
|
|
|
|
|
EnableRegistrySource = true;
|
2015-01-05 22:41:17 +08:00
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnAfterLoad(ProgramStorage storage)
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(storage.ProgramSuffixes))
|
|
|
|
|
{
|
|
|
|
|
storage.ProgramSuffixes = "lnk;exe;appref-ms;bat";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override string ConfigName
|
|
|
|
|
{
|
|
|
|
|
get { return "setting"; }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|