Files
KJD/Work/UserConfig.cs
T

52 lines
1.0 KiB
C#

using CefSharp.DevTools.IndexedDB;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Work;
/// <summary>
/// 主账号云端配置
/// </summary>
public class UserConfig
{
public const string SensitiveWordsKey = "SensitiveWords";
public const string UseOrderReturnWarehouseAddressKey = "UseOrderReturnWarehouseAddress";
public Dictionary<string, ConfigItem> Configs { get; set; } = [];
public ConfigItem this[string key]
{
get => Configs.TryGetValue(key, out var item) ? item : null;
}
public bool TryGetConfig(string key, out ConfigItem item)
{
return Configs.TryGetValue(key, out item);
}
public enum InheritPolicy
{
/// <summary>
/// 自由
/// </summary>
Free = 0,
/// <summary>
/// 锁定
/// </summary>
Locked = 1,
/// <summary>
/// 追加
/// </summary>
AppendOnly = 2
}
public class ConfigItem
{
public string Key { get; set; }
public string Value { get; set; }
public InheritPolicy Policy { get; set; } = InheritPolicy.Free;
}
}