Skip to content

Commit

Permalink
🚧 Misc
Browse files Browse the repository at this point in the history
  • Loading branch information
rmbadmin committed Nov 21, 2023
1 parent dc3dac0 commit d563122
Show file tree
Hide file tree
Showing 6 changed files with 229 additions and 21 deletions.
43 changes: 43 additions & 0 deletions build/settings_v4_app.json
Original file line number Diff line number Diff line change
Expand Up @@ -964,6 +964,49 @@
}
],
"Usings": ""
},
"SteamIdleSettings": {
"ClassFilePath": "..\\src\\BD.WTTS.Client.Plugins.SteamIdleCard\\Settings",
"InterfaceFilePath": "..\\src\\BD.WTTS.Client.Plugins.SteamIdleCard\\Settings\\Abstractions",
"Properties": [
{
"TypeName": "ConcurrentDictionary<string, string?>",
"PropertyName": "AccountRemarks",
"DefaultValue": "new()",
"DefaultValueIsConst": false,
"Summary": "账号备注字典",
"IsRegionOrEndregion": null,
"IsValueType": null
},
{
"TypeName": "IReadOnlyCollection<DisableAuthorizedDevice>",
"PropertyName": "DisableAuthorizedDevice",
"DefaultValue": "Array.Empty<DisableAuthorizedDevice>()",
"DefaultValueIsConst": false,
"Summary": "Steam 家庭共享临时禁用",
"IsRegionOrEndregion": null,
"IsValueType": null
},
{
"TypeName": "HashSet<string>",
"PropertyName": "EnablePlatforms",
"DefaultValue": "new()",
"DefaultValueIsConst": false,
"Summary": "启用的账号平台集合",
"IsRegionOrEndregion": null,
"IsValueType": null
},
{
"TypeName": "ConcurrentDictionary<string, PlatformSettings>",
"PropertyName": "PlatformSettings",
"DefaultValue": "new()",
"DefaultValueIsConst": false,
"Summary": "账号平台设置集合",
"IsRegionOrEndregion": null,
"IsValueType": null
}
],
"Usings": ""
}
}
}
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();

}
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);

}
Original file line number Diff line number Diff line change
Expand Up @@ -94,28 +94,29 @@ public async Task IdleRunStartOrStop_Click()
IsLoaing = false;
}

//if (!RunLoaingState)
//{
// RunLoaingState = true;

if (!RunState)
if (!RunLoaingState)
{
//await SteamConnectService.Current.RefreshGamesListAsync();
RunState = await ReadyToGoIdle();
RunLoaingState = true;

if (!RunState)
{
//await SteamConnectService.Current.RefreshGamesListAsync();
RunState = await ReadyToGoIdle();
}
else
{
RunState = false;
StopIdle();
RunOrStopAutoNext(false);
}

RunLoaingState = false;
//Toast.Show(ToastIcon.Success, Strings.Idle_OperationSuccess);
}
else
{
RunState = false;
StopIdle();
RunOrStopAutoNext(false);
Toast.Show(ToastIcon.Warning, Strings.Idle_LoaingTips);
}
//RunLoaingState = false;
//Toast.Show(ToastIcon.Success, Strings.Idle_OperationSuccess);
//}
//else
//{
// Toast.Show(ToastIcon.Warning, Strings.Idle_LoaingTips);
//}
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ public sealed partial class IdleCardPageViewModel
[Reactive]
public bool IsLoaing { get; set; }

//[Reactive]
//public bool RunLoaingState { get; set; }
[Reactive]
public bool RunLoaingState { get; set; }

[Reactive]
public bool RunState { get; set; }
Expand Down Expand Up @@ -87,13 +87,13 @@ public sealed partial class IdleCardPageViewModel
/// 最少游戏时间 hours
/// </summary>
[Reactive]
private double MinRunTime { get; set; } = 2;
public double MinRunTime { get; set; } = 2;

/// <summary>
/// 自动切换游戏时间间隔 ms
/// </summary>
[Reactive]
private double SwitchTime { get; set; } = 500;
public double SwitchTime { get; set; } = 500;

#endregion
}
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,9 @@
Orientation="Vertical"
Spacing="6">
<Panel>
<ToolTip.Tip>
123
</ToolTip.Tip>
<ProgressBar
Width="80"
Height="80"
Expand Down

0 comments on commit d563122

Please sign in to comment.