2014-01-29 22:44:57 +08:00
|
|
|
|
using System.Collections.Generic;
|
2014-03-23 16:17:41 +08:00
|
|
|
|
using System.Drawing;
|
2014-01-29 22:44:57 +08:00
|
|
|
|
using System.IO;
|
2014-03-22 16:50:47 +08:00
|
|
|
|
using System.Windows.Forms;
|
2014-03-23 16:17:41 +08:00
|
|
|
|
using Newtonsoft.Json;
|
2014-01-29 22:44:57 +08:00
|
|
|
|
|
2014-03-23 16:17:41 +08:00
|
|
|
|
namespace Wox.Infrastructure.Storage.UserSettings
|
2014-01-29 22:44:57 +08:00
|
|
|
|
{
|
2014-03-23 16:17:41 +08:00
|
|
|
|
public class UserSettingStorage : BaseStorage<UserSettingStorage>
|
2014-01-29 22:44:57 +08:00
|
|
|
|
{
|
2014-03-23 16:17:41 +08:00
|
|
|
|
[JsonProperty]
|
2014-02-22 11:55:48 +08:00
|
|
|
|
public string Hotkey { get; set; }
|
2014-03-23 16:17:41 +08:00
|
|
|
|
|
|
|
|
|
[JsonProperty]
|
2014-01-29 22:44:57 +08:00
|
|
|
|
public string Theme { get; set; }
|
2014-03-23 16:17:41 +08:00
|
|
|
|
|
|
|
|
|
[JsonProperty]
|
2014-03-19 22:17:01 +08:00
|
|
|
|
public string QueryBoxFont { get; set; }
|
2014-03-23 16:17:41 +08:00
|
|
|
|
|
2014-03-25 13:25:43 +08:00
|
|
|
|
[JsonProperty]
|
|
|
|
|
public string QueryBoxFontStyle { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty]
|
|
|
|
|
public string QueryBoxFontWeight { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty]
|
|
|
|
|
public string QueryBoxFontStretch { get; set; }
|
|
|
|
|
|
2014-03-23 16:17:41 +08:00
|
|
|
|
[JsonProperty]
|
2014-03-19 22:17:01 +08:00
|
|
|
|
public string ResultItemFont { get; set; }
|
2014-03-23 16:17:41 +08:00
|
|
|
|
|
2014-03-25 13:25:43 +08:00
|
|
|
|
[JsonProperty]
|
|
|
|
|
public string ResultItemFontStyle { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty]
|
|
|
|
|
public string ResultItemFontWeight { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty]
|
|
|
|
|
public string ResultItemFontStretch { get; set; }
|
|
|
|
|
|
2014-03-23 16:17:41 +08:00
|
|
|
|
[JsonProperty]
|
2014-01-29 22:44:57 +08:00
|
|
|
|
public bool ReplaceWinR { get; set; }
|
2014-03-23 16:17:41 +08:00
|
|
|
|
|
|
|
|
|
[JsonProperty]
|
2014-01-29 22:44:57 +08:00
|
|
|
|
public List<WebSearch> WebSearches { get; set; }
|
2014-03-23 16:17:41 +08:00
|
|
|
|
|
2014-06-16 14:06:24 +08:00
|
|
|
|
[JsonProperty]
|
|
|
|
|
public double WindowLeft { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty]
|
|
|
|
|
public double WindowTop { get; set; }
|
|
|
|
|
|
2014-03-23 16:17:41 +08:00
|
|
|
|
[JsonProperty]
|
2014-03-19 04:05:27 +08:00
|
|
|
|
public List<ProgramSource> ProgramSources { get; set; }
|
2014-03-23 16:17:41 +08:00
|
|
|
|
|
2014-07-18 20:00:55 +08:00
|
|
|
|
[JsonProperty]
|
|
|
|
|
public List<FolderLink> FolderLinks { get; set; } //Aaron
|
2014-03-31 07:03:07 +08:00
|
|
|
|
|
2014-07-01 22:19:46 +08:00
|
|
|
|
public List<CustomizedPluginConfig> CustomizedPluginConfigs { get; set; }
|
|
|
|
|
|
2014-03-23 16:17:41 +08:00
|
|
|
|
[JsonProperty]
|
2014-02-22 15:52:20 +08:00
|
|
|
|
public List<CustomPluginHotkey> CustomPluginHotkeys { get; set; }
|
2014-03-23 16:17:41 +08:00
|
|
|
|
|
|
|
|
|
[JsonProperty]
|
2014-02-07 22:10:00 +08:00
|
|
|
|
public bool StartWoxOnSystemStartup { get; set; }
|
2014-03-23 16:17:41 +08:00
|
|
|
|
|
2014-03-26 17:34:19 +08:00
|
|
|
|
[JsonProperty]
|
|
|
|
|
public double Opacity { get; set; }
|
|
|
|
|
|
2014-08-13 23:16:45 +08:00
|
|
|
|
[JsonProperty]
|
2014-08-14 19:45:48 +08:00
|
|
|
|
public string ProgramSuffixes { get; set; }
|
2014-08-13 23:16:45 +08:00
|
|
|
|
|
2014-03-26 17:34:19 +08:00
|
|
|
|
[JsonProperty]
|
|
|
|
|
public OpacityMode OpacityMode { get; set; }
|
|
|
|
|
|
2014-07-21 22:27:57 +08:00
|
|
|
|
[JsonProperty]
|
|
|
|
|
public bool EnableWebSearchSuggestion { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty]
|
|
|
|
|
public string WebSearchSuggestionSource { get; set; }
|
|
|
|
|
|
2014-07-18 20:00:55 +08:00
|
|
|
|
[JsonProperty]
|
|
|
|
|
public bool LeaveCmdOpen { get; set; }
|
2014-04-11 05:44:57 +08:00
|
|
|
|
|
2014-04-13 10:08:33 +08:00
|
|
|
|
[JsonProperty]
|
|
|
|
|
public bool HideWhenDeactive { get; set; }
|
|
|
|
|
|
2014-07-18 20:00:55 +08:00
|
|
|
|
[JsonProperty]
|
|
|
|
|
public string ProxyServer { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty]
|
|
|
|
|
public bool ProxyEnabled { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty]
|
|
|
|
|
public int ProxyPort { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty]
|
|
|
|
|
public string ProxyUserName { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty]
|
|
|
|
|
public string ProxyPassword { get; set; }
|
|
|
|
|
|
2014-02-02 16:15:34 +08:00
|
|
|
|
public List<WebSearch> LoadDefaultWebSearches()
|
2014-01-29 22:44:57 +08:00
|
|
|
|
{
|
|
|
|
|
List<WebSearch> webSearches = new List<WebSearch>();
|
|
|
|
|
|
|
|
|
|
WebSearch googleWebSearch = new WebSearch()
|
|
|
|
|
{
|
|
|
|
|
Title = "Google",
|
|
|
|
|
ActionWord = "g",
|
2014-03-22 16:50:47 +08:00
|
|
|
|
IconPath = Path.GetDirectoryName(Application.ExecutablePath) + @"\Images\websearch\google.png",
|
2014-01-29 22:44:57 +08:00
|
|
|
|
Url = "https://www.google.com/search?q={q}",
|
|
|
|
|
Enabled = true
|
|
|
|
|
};
|
|
|
|
|
webSearches.Add(googleWebSearch);
|
|
|
|
|
|
2014-03-23 16:17:41 +08:00
|
|
|
|
|
2014-01-29 22:44:57 +08:00
|
|
|
|
WebSearch wikiWebSearch = new WebSearch()
|
|
|
|
|
{
|
|
|
|
|
Title = "Wikipedia",
|
|
|
|
|
ActionWord = "wiki",
|
2014-03-22 16:50:47 +08:00
|
|
|
|
IconPath = Path.GetDirectoryName(Application.ExecutablePath) + @"\Images\websearch\wiki.png",
|
2014-01-29 22:44:57 +08:00
|
|
|
|
Url = "http://en.wikipedia.org/wiki/{q}",
|
|
|
|
|
Enabled = true
|
|
|
|
|
};
|
|
|
|
|
webSearches.Add(wikiWebSearch);
|
|
|
|
|
|
2014-06-30 21:31:13 +08:00
|
|
|
|
WebSearch findIcon = new WebSearch()
|
|
|
|
|
{
|
|
|
|
|
Title = "FindIcon",
|
|
|
|
|
ActionWord = "findicon",
|
|
|
|
|
IconPath = Path.GetDirectoryName(Application.ExecutablePath) + @"\Images\websearch\pictures.png",
|
|
|
|
|
Url = "http://findicons.com/search/{q}",
|
|
|
|
|
Enabled = true
|
|
|
|
|
};
|
|
|
|
|
webSearches.Add(findIcon);
|
|
|
|
|
|
2014-01-29 22:44:57 +08:00
|
|
|
|
return webSearches;
|
|
|
|
|
}
|
2014-03-19 04:05:27 +08:00
|
|
|
|
|
2014-03-23 16:17:41 +08:00
|
|
|
|
protected override string ConfigName
|
|
|
|
|
{
|
|
|
|
|
get { return "config"; }
|
|
|
|
|
}
|
2014-03-23 18:14:46 +08:00
|
|
|
|
|
|
|
|
|
protected override void LoadDefaultConfig()
|
|
|
|
|
{
|
|
|
|
|
Theme = "Dark";
|
|
|
|
|
ReplaceWinR = true;
|
|
|
|
|
WebSearches = LoadDefaultWebSearches();
|
2014-08-10 22:22:54 +08:00
|
|
|
|
ProgramSources = new List<ProgramSource>();
|
2014-07-01 22:19:46 +08:00
|
|
|
|
CustomizedPluginConfigs = new List<CustomizedPluginConfig>();
|
2014-03-23 18:14:46 +08:00
|
|
|
|
Hotkey = "Alt + Space";
|
|
|
|
|
QueryBoxFont = FontFamily.GenericSansSerif.Name;
|
|
|
|
|
ResultItemFont = FontFamily.GenericSansSerif.Name;
|
2014-03-26 17:34:19 +08:00
|
|
|
|
Opacity = 1;
|
2014-07-18 20:00:55 +08:00
|
|
|
|
OpacityMode = OpacityMode.Normal;
|
|
|
|
|
LeaveCmdOpen = false;
|
2014-04-13 10:08:33 +08:00
|
|
|
|
HideWhenDeactive = false;
|
2014-03-23 18:14:46 +08:00
|
|
|
|
}
|
2014-03-26 17:34:19 +08:00
|
|
|
|
|
2014-07-01 22:19:46 +08:00
|
|
|
|
protected override void OnAfterLoadConfig(UserSettingStorage storage)
|
|
|
|
|
{
|
|
|
|
|
if (storage.CustomizedPluginConfigs == null)
|
|
|
|
|
{
|
|
|
|
|
storage.CustomizedPluginConfigs = new List<CustomizedPluginConfig>();
|
|
|
|
|
}
|
2014-08-14 19:45:48 +08:00
|
|
|
|
if (string.IsNullOrEmpty(storage.ProgramSuffixes))
|
2014-08-13 23:16:45 +08:00
|
|
|
|
{
|
2014-08-14 19:45:48 +08:00
|
|
|
|
storage.ProgramSuffixes = "lnk;exe;appref-ms;bat";
|
|
|
|
|
}
|
2014-07-01 22:19:46 +08:00
|
|
|
|
}
|
2014-03-26 17:34:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum OpacityMode
|
|
|
|
|
{
|
|
|
|
|
Normal = 0,
|
|
|
|
|
LayeredWindow = 1,
|
|
|
|
|
DWM = 2
|
2014-01-29 22:44:57 +08:00
|
|
|
|
}
|
|
|
|
|
}
|