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

41 lines
937 B
C#
Raw Normal View History

using System.Collections.Generic;
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>();
2016-01-07 10:31:17 +08:00
protected override string FileName { get; } = "CMDHistory";
2014-03-23 16:17:41 +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
}
}