2015-01-03 15:20:34 +08:00
|
|
|
|
using System.Collections.Generic;
|
2015-10-31 07:17:34 +08:00
|
|
|
|
using System.IO;
|
2015-01-05 22:41:17 +08:00
|
|
|
|
using System.Reflection;
|
2014-03-23 16:17:41 +08:00
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using Wox.Infrastructure.Storage;
|
|
|
|
|
|
2015-01-03 15:20:34 +08:00
|
|
|
|
namespace Wox.Plugin.CMD
|
2014-03-23 16:17:41 +08:00
|
|
|
|
{
|
2014-12-15 22:58:49 +08:00
|
|
|
|
public class CMDStorage : JsonStrorage<CMDStorage>
|
2014-03-23 16:17:41 +08:00
|
|
|
|
{
|
2015-01-05 22:41:17 +08:00
|
|
|
|
[JsonProperty]
|
|
|
|
|
public bool ReplaceWinR { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty]
|
|
|
|
|
public bool LeaveCmdOpen { get; set; }
|
|
|
|
|
|
2014-03-23 16:17:41 +08:00
|
|
|
|
[JsonProperty]
|
|
|
|
|
public Dictionary<string, int> CMDHistory = new Dictionary<string, int>();
|
|
|
|
|
|
2015-01-05 22:41:17 +08:00
|
|
|
|
protected override string ConfigFolder
|
|
|
|
|
{
|
|
|
|
|
get { return Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); }
|
|
|
|
|
}
|
|
|
|
|
|
2014-03-23 16:17:41 +08:00
|
|
|
|
protected override string ConfigName
|
|
|
|
|
{
|
|
|
|
|
get { return "CMDHistory"; }
|
|
|
|
|
}
|
|
|
|
|
|
2015-01-05 22:41:17 +08:00
|
|
|
|
protected override CMDStorage LoadDefault()
|
|
|
|
|
{
|
|
|
|
|
ReplaceWinR = true;
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
|
2014-03-23 16:17:41 +08:00
|
|
|
|
public void AddCmdHistory(string cmdName)
|
|
|
|
|
{
|
|
|
|
|
if (CMDHistory.ContainsKey(cmdName))
|
|
|
|
|
{
|
|
|
|
|
CMDHistory[cmdName] += 1;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
CMDHistory.Add(cmdName, 1);
|
|
|
|
|
}
|
|
|
|
|
Save();
|
|
|
|
|
}
|
2014-12-18 19:22:47 +08:00
|
|
|
|
|
2014-03-23 16:17:41 +08:00
|
|
|
|
}
|
|
|
|
|
}
|