-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
229 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
src/BD.WTTS.Client.Plugins.SteamIdleCard/Settings/Abstractions/ISteamIdleSettings.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#nullable enable | ||
#pragma warning disable IDE0079 // 请删除不必要的忽略 | ||
#pragma warning disable SA1634 // File header should show copyright | ||
#pragma warning disable CS8601 // 引用类型赋值可能为 null。 | ||
#pragma warning disable CS0108 // 成员隐藏继承的成员;缺少关键字 new | ||
//------------------------------------------------------------------------------ | ||
// <auto-generated> | ||
// 此代码由包 BD.Common.Settings.V4.SourceGenerator.Tools 源生成。 | ||
// | ||
// 对此文件的更改可能会导致不正确的行为,并且如果 | ||
// 重新生成代码,这些更改将会丢失。 | ||
// </auto-generated> | ||
//------------------------------------------------------------------------------ | ||
|
||
// ReSharper disable once CheckNamespace | ||
namespace BD.WTTS.Settings.Abstractions; | ||
|
||
public partial interface ISteamIdleSettings | ||
{ | ||
static ISteamIdleSettings? Instance | ||
=> Ioc.Get_Nullable<IOptionsMonitor<ISteamIdleSettings>>()?.CurrentValue; | ||
|
||
/// <summary> | ||
/// 账号备注字典 | ||
/// </summary> | ||
ConcurrentDictionary<string, string?>? AccountRemarks { get; set; } | ||
|
||
/// <summary> | ||
/// Steam 家庭共享临时禁用 | ||
/// </summary> | ||
IReadOnlyCollection<DisableAuthorizedDevice>? DisableAuthorizedDevice { get; set; } | ||
|
||
/// <summary> | ||
/// 启用的账号平台集合 | ||
/// </summary> | ||
HashSet<string>? EnablePlatforms { get; set; } | ||
|
||
/// <summary> | ||
/// 账号平台设置集合 | ||
/// </summary> | ||
ConcurrentDictionary<string, PlatformSettings>? PlatformSettings { get; set; } | ||
|
||
/// <summary> | ||
/// 账号备注字典的默认值 | ||
/// </summary> | ||
static readonly ConcurrentDictionary<string, string?> DefaultAccountRemarks = new(); | ||
|
||
/// <summary> | ||
/// Steam 家庭共享临时禁用的默认值 | ||
/// </summary> | ||
static readonly IReadOnlyCollection<DisableAuthorizedDevice> DefaultDisableAuthorizedDevice = Array.Empty<DisableAuthorizedDevice>(); | ||
|
||
/// <summary> | ||
/// 启用的账号平台集合的默认值 | ||
/// </summary> | ||
static readonly HashSet<string> DefaultEnablePlatforms = new(); | ||
|
||
/// <summary> | ||
/// 账号平台设置集合的默认值 | ||
/// </summary> | ||
static readonly ConcurrentDictionary<string, PlatformSettings> DefaultPlatformSettings = new(); | ||
|
||
} |
98 changes: 98 additions & 0 deletions
98
src/BD.WTTS.Client.Plugins.SteamIdleCard/Settings/SteamIdleSettings.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
#nullable enable | ||
#pragma warning disable IDE0079 // 请删除不必要的忽略 | ||
#pragma warning disable SA1634 // File header should show copyright | ||
#pragma warning disable CS8601 // 引用类型赋值可能为 null。 | ||
#pragma warning disable CS0108 // 成员隐藏继承的成员;缺少关键字 new | ||
//------------------------------------------------------------------------------ | ||
// <auto-generated> | ||
// 此代码由包 BD.Common.Settings.V4.SourceGenerator.Tools 源生成。 | ||
// | ||
// 对此文件的更改可能会导致不正确的行为,并且如果 | ||
// 重新生成代码,这些更改将会丢失。 | ||
// </auto-generated> | ||
//------------------------------------------------------------------------------ | ||
|
||
using static BD.WTTS.Settings.Abstractions.ISteamIdleSettings; | ||
|
||
// ReSharper disable once CheckNamespace | ||
namespace BD.WTTS.Settings; | ||
|
||
[JsonSourceGenerationOptions(WriteIndented = true, IgnoreReadOnlyProperties = true)] | ||
[JsonSerializable(typeof(SteamIdleSettings_))] | ||
internal partial class SteamIdleSettingsContext : JsonSerializerContext | ||
{ | ||
static SteamIdleSettingsContext? instance; | ||
|
||
public static SteamIdleSettingsContext Instance | ||
=> instance ??= new SteamIdleSettingsContext(ISettings.GetDefaultOptions()); | ||
} | ||
|
||
[MPObj, MP2Obj(SerializeLayout.Explicit)] | ||
public sealed partial class SteamIdleSettings_ : ISteamIdleSettings, ISettings, ISettings<SteamIdleSettings_> | ||
{ | ||
public const string Name = nameof(SteamIdleSettings); | ||
|
||
static string ISettings.Name => Name; | ||
|
||
static JsonSerializerContext ISettings.JsonSerializerContext | ||
=> SteamIdleSettingsContext.Instance; | ||
|
||
static JsonTypeInfo ISettings.JsonTypeInfo | ||
=> SteamIdleSettingsContext.Instance.SteamIdleSettings_; | ||
|
||
static JsonTypeInfo<SteamIdleSettings_> ISettings<SteamIdleSettings_>.JsonTypeInfo | ||
=> SteamIdleSettingsContext.Instance.SteamIdleSettings_; | ||
|
||
/// <summary> | ||
/// 账号备注字典 | ||
/// </summary> | ||
[MPKey(0), MP2Key(0), JsonPropertyOrder(0)] | ||
public ConcurrentDictionary<string, string?>? AccountRemarks { get; set; } = ISteamIdleSettings.DefaultAccountRemarks; | ||
|
||
/// <summary> | ||
/// Steam 家庭共享临时禁用 | ||
/// </summary> | ||
[MPKey(1), MP2Key(1), JsonPropertyOrder(1)] | ||
public IReadOnlyCollection<DisableAuthorizedDevice>? DisableAuthorizedDevice { get; set; } = ISteamIdleSettings.DefaultDisableAuthorizedDevice; | ||
|
||
/// <summary> | ||
/// 启用的账号平台集合 | ||
/// </summary> | ||
[MPKey(2), MP2Key(2), JsonPropertyOrder(2)] | ||
public HashSet<string>? EnablePlatforms { get; set; } = ISteamIdleSettings.DefaultEnablePlatforms; | ||
|
||
/// <summary> | ||
/// 账号平台设置集合 | ||
/// </summary> | ||
[MPKey(3), MP2Key(3), JsonPropertyOrder(3)] | ||
public ConcurrentDictionary<string, PlatformSettings>? PlatformSettings { get; set; } = ISteamIdleSettings.DefaultPlatformSettings; | ||
|
||
} | ||
|
||
public static partial class SteamIdleSettings | ||
{ | ||
/// <summary> | ||
/// 账号备注字典 | ||
/// </summary> | ||
public static SettingsProperty<string, string?, ConcurrentDictionary<string, string?>, SteamIdleSettings_> AccountRemarks { get; } | ||
= new(DefaultAccountRemarks); | ||
|
||
/// <summary> | ||
/// Steam 家庭共享临时禁用 | ||
/// </summary> | ||
public static SettingsProperty<IReadOnlyCollection<DisableAuthorizedDevice>, SteamIdleSettings_> DisableAuthorizedDevice { get; } | ||
= new(DefaultDisableAuthorizedDevice); | ||
|
||
/// <summary> | ||
/// 启用的账号平台集合 | ||
/// </summary> | ||
public static SettingsProperty<string, HashSet<string>, SteamIdleSettings_> EnablePlatforms { get; } | ||
= new(DefaultEnablePlatforms); | ||
|
||
/// <summary> | ||
/// 账号平台设置集合 | ||
/// </summary> | ||
public static SettingsProperty<string, PlatformSettings, ConcurrentDictionary<string, PlatformSettings>, SteamIdleSettings_> PlatformSettings { get; } | ||
= new(DefaultPlatformSettings); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters