revise access of UserSelectedrecord, Histroy, TopMost setter access to private

This commit is contained in:
弘韬 张 2021-02-24 16:03:10 +08:00
parent 374bb79e11
commit f3a1bcc01f
3 changed files with 7 additions and 21 deletions

View file

@ -1,13 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Flow.Launcher.Plugin;
using System.Text.Json.Serialization;
namespace Flow.Launcher.Storage
{
public class History
{
public List<HistoryItem> Items { get; set; } = new List<HistoryItem>();
[JsonInclude]
public List<HistoryItem> Items { get; private set; } = new List<HistoryItem>();
private int _maxHistory = 300;

View file

@ -1,6 +1,4 @@
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using System.Text.Json.Serialization;
using Flow.Launcher.Plugin;
@ -9,14 +7,8 @@ namespace Flow.Launcher.Storage
// todo this class is not thread safe.... but used from multiple threads.
public class TopMostRecord
{
/// <summary>
/// You should not directly access this field
/// <para>
/// It is public due to System.Text.Json limitation in version 3.1
/// </para>
/// </summary>
/// TODO: Set it to private
public Dictionary<string, Record> records { get; set; } = new Dictionary<string, Record>();
[JsonInclude]
public Dictionary<string, Record> records { get; private set; } = new Dictionary<string, Record>();
internal bool IsTopMost(Result result)
{

View file

@ -7,15 +7,8 @@ namespace Flow.Launcher.Storage
{
public class UserSelectedRecord
{
/// <summary>
/// You should not directly access this field
/// <para>
/// It is public due to System.Text.Json limitation in version 3.1
/// </para>
/// </summary>
/// TODO: Set it to private
[JsonPropertyName("records")]
public Dictionary<string, int> records { get; set; }
[JsonInclude]
public Dictionary<string, int> records { get; private set; }
public UserSelectedRecord()
{