mirror of
https://jihulab.com/DGP-Studio/Snap.Hutao.git
synced 2025-11-19 21:02:53 +08:00
add options to disable metadata initialization
This commit is contained in:
@@ -53,4 +53,9 @@ internal static class SettingKeys
|
|||||||
/// 排除的系统公告
|
/// 排除的系统公告
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string ExcludedAnnouncementIds = "ExcludedAnnouncementIds";
|
public const string ExcludedAnnouncementIds = "ExcludedAnnouncementIds";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 禁用元数据更新检查
|
||||||
|
/// </summary>
|
||||||
|
public const string SuppressMetadataInitialization = "SuppressMetadataInitialization";
|
||||||
}
|
}
|
||||||
@@ -7,6 +7,7 @@ using Snap.Hutao.Core.DependencyInjection.Annotation.HttpClient;
|
|||||||
using Snap.Hutao.Core.Diagnostics;
|
using Snap.Hutao.Core.Diagnostics;
|
||||||
using Snap.Hutao.Core.ExceptionService;
|
using Snap.Hutao.Core.ExceptionService;
|
||||||
using Snap.Hutao.Core.IO.Hashing;
|
using Snap.Hutao.Core.IO.Hashing;
|
||||||
|
using Snap.Hutao.Core.Setting;
|
||||||
using Snap.Hutao.Service.Notification;
|
using Snap.Hutao.Service.Notification;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
@@ -61,6 +62,11 @@ internal sealed partial class MetadataService : IMetadataService, IMetadataServi
|
|||||||
|
|
||||||
private async ValueTask<bool> TryUpdateMetadataAsync(CancellationToken token)
|
private async ValueTask<bool> TryUpdateMetadataAsync(CancellationToken token)
|
||||||
{
|
{
|
||||||
|
if (LocalSetting.Get(SettingKeys.SuppressMetadataInitialization, false))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
Dictionary<string, string>? metaXXH64Map;
|
Dictionary<string, string>? metaXXH64Map;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -159,13 +159,13 @@
|
|||||||
|
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Margin="16,16,16,0"
|
Margin="16,16,12,0"
|
||||||
Style="{StaticResource TitleTextBlockStyle}"
|
Style="{StaticResource TitleTextBlockStyle}"
|
||||||
Text="{Binding GreetingText}"/>
|
Text="{Binding GreetingText}"/>
|
||||||
<TextBlock Margin="16,0,16,0" Text="{Binding UserOptions.UserName}"/>
|
<TextBlock Margin="16,0,16,0" Text="{Binding UserOptions.UserName}"/>
|
||||||
|
|
||||||
<ItemsControl
|
<ItemsControl
|
||||||
Margin="16,16,16,0"
|
Margin="16,16,12,0"
|
||||||
ItemsSource="{Binding HutaoAnnouncements}"
|
ItemsSource="{Binding HutaoAnnouncements}"
|
||||||
Visibility="{Binding HutaoAnnouncements.Count, Converter={StaticResource Int32ToVisibilityConverter}}">
|
Visibility="{Binding HutaoAnnouncements.Count, Converter={StaticResource Int32ToVisibilityConverter}}">
|
||||||
<ItemsControl.ItemTemplate>
|
<ItemsControl.ItemTemplate>
|
||||||
|
|||||||
@@ -65,6 +65,15 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
</cwc:SettingsCard>
|
</cwc:SettingsCard>
|
||||||
|
|
||||||
|
<cwc:SettingsCard Header="Suppress Metadata Initialization">
|
||||||
|
<ToggleSwitch IsOn="{Binding SuppressMetadataInitialization, Mode=TwoWay}"/>
|
||||||
|
</cwc:SettingsCard>
|
||||||
|
|
||||||
|
<cwc:SettingsCard
|
||||||
|
Command="{Binding CompensationGachaLogServiceTimeCommand}"
|
||||||
|
Header="Compensation GachaLog Service Time For 15 Days"
|
||||||
|
IsClickEnabled="True"/>
|
||||||
|
|
||||||
<Expander
|
<Expander
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
HorizontalContentAlignment="Stretch"
|
HorizontalContentAlignment="Stretch"
|
||||||
|
|||||||
@@ -24,6 +24,13 @@ internal sealed partial class TestViewModel : Abstraction.ViewModel
|
|||||||
|
|
||||||
public UploadAnnouncement Announcement { get => announcement; set => SetProperty(ref announcement, value); }
|
public UploadAnnouncement Announcement { get => announcement; set => SetProperty(ref announcement, value); }
|
||||||
|
|
||||||
|
[SuppressMessage("", "CA1822")]
|
||||||
|
public bool SuppressMetadataInitialization
|
||||||
|
{
|
||||||
|
get => LocalSetting.Get(SettingKeys.SuppressMetadataInitialization, false);
|
||||||
|
set => LocalSetting.Set(SettingKeys.SuppressMetadataInitialization, value);
|
||||||
|
}
|
||||||
|
|
||||||
protected override ValueTask<bool> InitializeUIAsync()
|
protected override ValueTask<bool> InitializeUIAsync()
|
||||||
{
|
{
|
||||||
return ValueTask.FromResult(true);
|
return ValueTask.FromResult(true);
|
||||||
@@ -46,4 +53,16 @@ internal sealed partial class TestViewModel : Abstraction.ViewModel
|
|||||||
Announcement = new();
|
Announcement = new();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Command("CompensationGachaLogServiceTimeCommand")]
|
||||||
|
private async void CompensationGachaLogServiceTimeAsync()
|
||||||
|
{
|
||||||
|
Web.Response.Response response = await homaAsAServiceClient.GachaLogCompensationAsync(15).ConfigureAwait(false);
|
||||||
|
if (response.IsOk())
|
||||||
|
{
|
||||||
|
infoBarService.Success(response.Message);
|
||||||
|
await taskContext.SwitchToMainThreadAsync();
|
||||||
|
Announcement = new();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -23,7 +23,7 @@ internal sealed class Announcement : UploadAnnouncement
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public long LastUpdateTime { get; set; }
|
public long LastUpdateTime { get; set; }
|
||||||
|
|
||||||
public string UpdateTimeFormatted { get => $"{DateTimeOffset.FromUnixTimeSeconds(LastUpdateTime):yyyy-MM-dd HH:mm:ss}"; }
|
public string UpdateTimeFormatted { get => $"{DateTimeOffset.FromUnixTimeSeconds(LastUpdateTime).ToLocalTime():yyyy-MM-dd HH:mm:ss}"; }
|
||||||
|
|
||||||
public ICommand? DismissCommand { get; set; }
|
public ICommand? DismissCommand { get; set; }
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user