mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-16 04:29:16 +08:00
51 lines
1.1 KiB
C#
51 lines
1.1 KiB
C#
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Reflection;
|
|
using Newtonsoft.Json;
|
|
using Wox.Infrastructure.Storage;
|
|
|
|
namespace Wox.Plugin.CMD
|
|
{
|
|
public class CMDStorage : JsonStrorage<CMDStorage>
|
|
{
|
|
[JsonProperty]
|
|
public bool ReplaceWinR { get; set; }
|
|
|
|
[JsonProperty]
|
|
public bool LeaveCmdOpen { get; set; }
|
|
|
|
[JsonProperty]
|
|
public Dictionary<string, int> CMDHistory = new Dictionary<string, int>();
|
|
|
|
protected override string ConfigFolder
|
|
{
|
|
get { return Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); }
|
|
}
|
|
|
|
protected override string ConfigName
|
|
{
|
|
get { return "CMDHistory"; }
|
|
}
|
|
|
|
protected override CMDStorage LoadDefault()
|
|
{
|
|
ReplaceWinR = true;
|
|
return this;
|
|
}
|
|
|
|
public void AddCmdHistory(string cmdName)
|
|
{
|
|
if (CMDHistory.ContainsKey(cmdName))
|
|
{
|
|
CMDHistory[cmdName] += 1;
|
|
}
|
|
else
|
|
{
|
|
CMDHistory.Add(cmdName, 1);
|
|
}
|
|
Save();
|
|
}
|
|
|
|
}
|
|
}
|