2015-10-31 07:17:34 +08:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Reflection;
|
2014-03-23 16:17:41 +08:00
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using Wox.Infrastructure.Storage;
|
|
|
|
|
using Wox.Plugin;
|
|
|
|
|
|
2014-12-26 22:51:04 +08:00
|
|
|
|
namespace Wox.Storage
|
2014-03-23 16:17:41 +08:00
|
|
|
|
{
|
2014-12-15 22:58:49 +08:00
|
|
|
|
public class UserSelectedRecordStorage : JsonStrorage<UserSelectedRecordStorage>
|
2014-03-23 16:17:41 +08:00
|
|
|
|
{
|
|
|
|
|
[JsonProperty]
|
|
|
|
|
private Dictionary<string, int> records = new Dictionary<string, int>();
|
|
|
|
|
|
2016-01-07 10:31:17 +08:00
|
|
|
|
protected override string FileName { get; } = "UserSelectedRecords";
|
2014-03-23 16:17:41 +08:00
|
|
|
|
|
|
|
|
|
public void Add(Result result)
|
|
|
|
|
{
|
|
|
|
|
if (records.ContainsKey(result.ToString()))
|
|
|
|
|
{
|
|
|
|
|
records[result.ToString()] += 1;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
records.Add(result.ToString(), 1);
|
|
|
|
|
}
|
|
|
|
|
Save();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int GetSelectedCount(Result result)
|
|
|
|
|
{
|
|
|
|
|
if (records.ContainsKey(result.ToString()))
|
|
|
|
|
{
|
|
|
|
|
return records[result.ToString()];
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|