PowerToys/Plugins/Wox.Plugin.CMD/CMDStorage.cs

51 lines
1.1 KiB
C#
Raw Normal View History

using System.Collections.Generic;
2015-10-31 07:17:34 +08:00
using System.IO;
using System.Reflection;
2014-03-23 16:17:41 +08:00
using Newtonsoft.Json;
using Wox.Infrastructure.Storage;
namespace Wox.Plugin.CMD
2014-03-23 16:17:41 +08:00
{
public class CMDStorage : JsonStrorage<CMDStorage>
2014-03-23 16:17:41 +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>();
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"; }
}
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
}
}