2014-03-23 16:17:41 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using Wox.Infrastructure.Storage;
|
|
|
|
|
using Wox.Plugin;
|
|
|
|
|
|
|
|
|
|
namespace Wox.Infrastructure.Storage
|
|
|
|
|
{
|
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>();
|
|
|
|
|
|
|
|
|
|
protected override string ConfigName
|
|
|
|
|
{
|
|
|
|
|
get { return "UserSelectedRecords"; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|