Remove instance logic for BinaryStorage and JsonStorage, part 1

1. part of #389
2. huge refactoring
This commit is contained in:
bao-qian
2016-04-21 01:53:21 +01:00
parent 0bcb76fa81
commit 8d10c9aa41
52 changed files with 502 additions and 584 deletions

View File

@@ -5,11 +5,9 @@ using Wox.Plugin;
namespace Wox.Storage
{
public class TopMostRecordStorage : JsonStrorage<TopMostRecordStorage>
public class TopMostRecord
{
public Dictionary<string, TopMostRecord> records = new Dictionary<string, TopMostRecord>();
protected override string FileName { get; } = "TopMostRecords";
public Dictionary<string, Record> records = new Dictionary<string, Record>();
internal bool IsTopMost(Result result)
{
@@ -24,7 +22,6 @@ namespace Wox.Storage
if (records.ContainsKey(result.OriginQuery.RawQuery))
{
records.Remove(result.OriginQuery.RawQuery);
Save();
}
}
@@ -38,20 +35,18 @@ namespace Wox.Storage
}
else
{
records.Add(result.OriginQuery.RawQuery, new TopMostRecord
records.Add(result.OriginQuery.RawQuery, new Record
{
PluginID = result.PluginID,
Title = result.Title,
SubTitle = result.SubTitle
});
}
Save();
}
}
public class TopMostRecord
public class Record
{
public string Title { get; set; }
public string SubTitle { get; set; }