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

51 lines
1.1 KiB
C#
Raw Normal View History

using System.Collections.Generic;
using System.Reflection;
2014-03-23 16:17:41 +08:00
using Newtonsoft.Json;
using Wox.Infrastructure.Storage;
using System.IO;
2014-03-23 16:17:41 +08:00
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
}
}