mirror of
https://jihulab.com/DGP-Studio/Snap.Hutao.git
synced 2025-11-19 21:02:53 +08:00
Compare commits
3 Commits
fix/titleb
...
fix/naviga
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e9b784818d | ||
|
|
1b8e0e9231 | ||
|
|
c1f2bb132a |
@@ -35,8 +35,7 @@ Install with Snap Hutao MSIX package, can be installed with Windows built-in App
|
|||||||
|
|
||||||
* [向我们提交 PR / Make Pull Requests](https://github.com/DGP-Studio/Snap.Hutao/pulls)
|
* [向我们提交 PR / Make Pull Requests](https://github.com/DGP-Studio/Snap.Hutao/pulls)
|
||||||
* [在 Crowdin 上进行本地化 / Translate Project on Crowdin](https://translate.hut.ao/)
|
* [在 Crowdin 上进行本地化 / Translate Project on Crowdin](https://translate.hut.ao/)
|
||||||
* [为我们更新文档 / Enhance our Document](https://github.com/DGP-Studio/Snap.Hutao.Docs)
|
* [为我们更新文档 / Enhance our Document ](https://github.com/DGP-Studio/Snap.Hutao.Docs)
|
||||||
* [帮助我们测试程序 / Test Binary Package](https://hut.ao/development/contribute.html)
|
|
||||||
|
|
||||||
## 特别感谢 / Special Thanks
|
## 特别感谢 / Special Thanks
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
|
||||||
<PackageReference Include="MSTest.TestAdapter" Version="3.2.2" />
|
<PackageReference Include="MSTest.TestAdapter" Version="3.2.1" />
|
||||||
<PackageReference Include="MSTest.TestFramework" Version="3.2.2" />
|
<PackageReference Include="MSTest.TestFramework" Version="3.2.2" />
|
||||||
<PackageReference Include="coverlet.collector" Version="6.0.1">
|
<PackageReference Include="coverlet.collector" Version="6.0.1">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
|||||||
@@ -168,7 +168,6 @@ internal abstract partial class CompositionImage : Microsoft.UI.Xaml.Controls.Co
|
|||||||
if (surface.DecodedPhysicalSize.Size() <= 0D)
|
if (surface.DecodedPhysicalSize.Size() <= 0D)
|
||||||
{
|
{
|
||||||
await Task.WhenAny(surfaceLoadTaskCompletionSource.Task, Task.Delay(5000, token)).ConfigureAwait(true);
|
await Task.WhenAny(surfaceLoadTaskCompletionSource.Task, Task.Delay(5000, token)).ConfigureAwait(true);
|
||||||
await Task.Delay(50, token).ConfigureAwait(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LoadImageSurfaceCompleted(surface);
|
LoadImageSurfaceCompleted(surface);
|
||||||
|
|||||||
@@ -1,58 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
using Microsoft.UI.Xaml;
|
|
||||||
using Windows.Foundation;
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Control.Panel;
|
|
||||||
|
|
||||||
[DependencyProperty("MinItemWidth", typeof(double))]
|
|
||||||
[DependencyProperty("Spacing", typeof(double))]
|
|
||||||
internal partial class HorizontalEqualPanel : Microsoft.UI.Xaml.Controls.Panel
|
|
||||||
{
|
|
||||||
public HorizontalEqualPanel()
|
|
||||||
{
|
|
||||||
Loaded += OnLoaded;
|
|
||||||
SizeChanged += OnSizeChanged;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override Size MeasureOverride(Size availableSize)
|
|
||||||
{
|
|
||||||
foreach (UIElement child in Children)
|
|
||||||
{
|
|
||||||
// ScrollViewer will always return an Infinity Size, we should use ActualWidth for this situation.
|
|
||||||
double availableWidth = double.IsInfinity(availableSize.Width) ? ActualWidth : availableSize.Width;
|
|
||||||
double childAvailableWidth = (availableWidth + Spacing) / Children.Count;
|
|
||||||
double childMaxAvailableWidth = Math.Max(MinItemWidth, childAvailableWidth);
|
|
||||||
child.Measure(new(childMaxAvailableWidth - Spacing, ActualHeight));
|
|
||||||
}
|
|
||||||
|
|
||||||
return base.MeasureOverride(availableSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override Size ArrangeOverride(Size finalSize)
|
|
||||||
{
|
|
||||||
int itemCount = Children.Count;
|
|
||||||
double availableWidthPerItem = (finalSize.Width - (Spacing * (itemCount - 1))) / itemCount;
|
|
||||||
double actualItemWidth = Math.Max(MinItemWidth, availableWidthPerItem);
|
|
||||||
|
|
||||||
double offset = 0;
|
|
||||||
foreach (UIElement child in Children)
|
|
||||||
{
|
|
||||||
child.Arrange(new Rect(offset, 0, actualItemWidth, finalSize.Height));
|
|
||||||
offset += actualItemWidth + Spacing;
|
|
||||||
}
|
|
||||||
|
|
||||||
return finalSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnLoaded(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
MinWidth = (MinItemWidth * Children.Count) + (Spacing * (Children.Count - 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnSizeChanged(object sender, SizeChangedEventArgs e)
|
|
||||||
{
|
|
||||||
InvalidateMeasure();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -4,19 +4,21 @@
|
|||||||
xmlns:cwm="using:CommunityToolkit.WinUI.Media">
|
xmlns:cwm="using:CommunityToolkit.WinUI.Media">
|
||||||
<ResourceDictionary.ThemeDictionaries>
|
<ResourceDictionary.ThemeDictionaries>
|
||||||
<ResourceDictionary x:Key="Light">
|
<ResourceDictionary x:Key="Light">
|
||||||
<x:Double x:Key="CompatShadowThemeOpacity">0.14</x:Double>
|
<cwm:AttachedCardShadow
|
||||||
|
x:Key="CompatCardShadow"
|
||||||
|
BlurRadius="8"
|
||||||
|
Opacity="0.14"
|
||||||
|
Offset="0,4,0"/>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
<ResourceDictionary x:Key="Dark">
|
<ResourceDictionary x:Key="Dark">
|
||||||
<x:Double x:Key="CompatShadowThemeOpacity">0.28</x:Double>
|
<cwm:AttachedCardShadow
|
||||||
|
x:Key="CompatCardShadow"
|
||||||
|
BlurRadius="8"
|
||||||
|
Opacity="0.28"
|
||||||
|
Offset="0,4,0"/>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
</ResourceDictionary.ThemeDictionaries>
|
</ResourceDictionary.ThemeDictionaries>
|
||||||
|
|
||||||
<cwm:AttachedCardShadow
|
|
||||||
x:Key="CompatCardShadow"
|
|
||||||
BlurRadius="8"
|
|
||||||
Opacity="{ThemeResource CompatShadowThemeOpacity}"
|
|
||||||
Offset="0,4,0"/>
|
|
||||||
|
|
||||||
<Style x:Key="BorderCardStyle" TargetType="Border">
|
<Style x:Key="BorderCardStyle" TargetType="Border">
|
||||||
<Setter Property="Background" Value="{ThemeResource CardBackgroundFillColorDefaultBrush}"/>
|
<Setter Property="Background" Value="{ThemeResource CardBackgroundFillColorDefaultBrush}"/>
|
||||||
<Setter Property="BorderBrush" Value="{ThemeResource CardStrokeColorDefaultBrush}"/>
|
<Setter Property="BorderBrush" Value="{ThemeResource CardStrokeColorDefaultBrush}"/>
|
||||||
|
|||||||
@@ -8,9 +8,6 @@
|
|||||||
<ItemsPanelTemplate x:Key="WrapPanelSpacing0Template">
|
<ItemsPanelTemplate x:Key="WrapPanelSpacing0Template">
|
||||||
<cwcont:WrapPanel/>
|
<cwcont:WrapPanel/>
|
||||||
</ItemsPanelTemplate>
|
</ItemsPanelTemplate>
|
||||||
<ItemsPanelTemplate x:Key="WrapPanelSpacing2Template">
|
|
||||||
<cwcont:WrapPanel HorizontalSpacing="2" VerticalSpacing="2"/>
|
|
||||||
</ItemsPanelTemplate>
|
|
||||||
<ItemsPanelTemplate x:Key="WrapPanelSpacing4Template">
|
<ItemsPanelTemplate x:Key="WrapPanelSpacing4Template">
|
||||||
<cwcont:WrapPanel HorizontalSpacing="4" VerticalSpacing="4"/>
|
<cwcont:WrapPanel HorizontalSpacing="4" VerticalSpacing="4"/>
|
||||||
</ItemsPanelTemplate>
|
</ItemsPanelTemplate>
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
using Snap.Hutao.Win32;
|
|
||||||
using Windows.UI;
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Control.Theme;
|
|
||||||
|
|
||||||
internal static class SystemColors
|
|
||||||
{
|
|
||||||
public static Color BaseLowColor(bool isDarkMode)
|
|
||||||
{
|
|
||||||
return isDarkMode ? StructMarshal.Color(0x33FFFFFF) : StructMarshal.Color(0x33000000);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Color BaseMediumLowColor(bool isDarkMode)
|
|
||||||
{
|
|
||||||
return isDarkMode ? StructMarshal.Color(0x66FFFFFF) : StructMarshal.Color(0x66000000);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Color BaseHighColor(bool isDarkMode)
|
|
||||||
{
|
|
||||||
return isDarkMode ? StructMarshal.Color(0xFFFFFFFF) : StructMarshal.Color(0xFF000000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -32,14 +32,6 @@ internal sealed class HutaoException : Exception
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ThrowIfNot(bool condition, HutaoExceptionKind kind, string message, Exception? innerException = default)
|
|
||||||
{
|
|
||||||
if (!condition)
|
|
||||||
{
|
|
||||||
throw new HutaoException(kind, message, innerException);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static HutaoException ServiceTypeCastFailed<TFrom, TTo>(string name, Exception? innerException = default)
|
public static HutaoException ServiceTypeCastFailed<TFrom, TTo>(string name, Exception? innerException = default)
|
||||||
{
|
{
|
||||||
string message = $"This instance of '{typeof(TFrom).FullName}' '{name}' doesn't implement '{typeof(TTo).FullName}'";
|
string message = $"This instance of '{typeof(TFrom).FullName}' '{name}' doesn't implement '{typeof(TTo).FullName}'";
|
||||||
|
|||||||
@@ -6,15 +6,8 @@ namespace Snap.Hutao.Core.ExceptionService;
|
|||||||
internal enum HutaoExceptionKind
|
internal enum HutaoExceptionKind
|
||||||
{
|
{
|
||||||
None,
|
None,
|
||||||
|
|
||||||
// Foundation
|
|
||||||
ServiceTypeCastFailed,
|
ServiceTypeCastFailed,
|
||||||
|
|
||||||
// IO
|
|
||||||
FileSystemCreateFileInsufficientPermissions,
|
FileSystemCreateFileInsufficientPermissions,
|
||||||
PrivateNamedPipeContentHashIncorrect,
|
PrivateNamedPipeContentHashIncorrect,
|
||||||
|
|
||||||
// Service
|
|
||||||
GachaStatisticsInvalidItemId,
|
GachaStatisticsInvalidItemId,
|
||||||
GameFpsUnlockingFailed,
|
|
||||||
}
|
}
|
||||||
@@ -9,7 +9,6 @@ namespace Snap.Hutao.Core.Validation;
|
|||||||
/// 封装验证方法,简化微软验证
|
/// 封装验证方法,简化微软验证
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[HighQuality]
|
[HighQuality]
|
||||||
[Obsolete("Use HutaoException instead")]
|
|
||||||
internal static class Must
|
internal static class Must
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ using Snap.Hutao.Win32;
|
|||||||
using Snap.Hutao.Win32.Foundation;
|
using Snap.Hutao.Win32.Foundation;
|
||||||
using Snap.Hutao.Win32.Graphics.Dwm;
|
using Snap.Hutao.Win32.Graphics.Dwm;
|
||||||
using Snap.Hutao.Win32.UI.WindowsAndMessaging;
|
using Snap.Hutao.Win32.UI.WindowsAndMessaging;
|
||||||
using System.Collections.Frozen;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using Windows.Graphics;
|
using Windows.Graphics;
|
||||||
using Windows.UI;
|
using Windows.UI;
|
||||||
@@ -57,22 +56,25 @@ internal sealed class WindowController
|
|||||||
private void InitializeCore()
|
private void InitializeCore()
|
||||||
{
|
{
|
||||||
RuntimeOptions runtimeOptions = serviceProvider.GetRequiredService<RuntimeOptions>();
|
RuntimeOptions runtimeOptions = serviceProvider.GetRequiredService<RuntimeOptions>();
|
||||||
AppOptions appOptions = serviceProvider.GetRequiredService<AppOptions>();
|
|
||||||
|
|
||||||
window.AppWindow.Title = SH.FormatAppNameAndVersion(runtimeOptions.Version);
|
window.AppWindow.Title = SH.FormatAppNameAndVersion(runtimeOptions.Version);
|
||||||
window.AppWindow.SetIcon(Path.Combine(runtimeOptions.InstalledLocation, "Assets/Logo.ico"));
|
window.AppWindow.SetIcon(Path.Combine(runtimeOptions.InstalledLocation, "Assets/Logo.ico"));
|
||||||
ExtendsContentIntoTitleBar();
|
ExtendsContentIntoTitleBar();
|
||||||
|
|
||||||
RecoverOrInitWindowSize();
|
RecoverOrInitWindowSize();
|
||||||
UpdateElementTheme(appOptions.ElementTheme);
|
|
||||||
UpdateImmersiveDarkMode(options.TitleBar, default!);
|
UpdateImmersiveDarkMode(options.TitleBar, default!);
|
||||||
|
|
||||||
// appWindow.Show(true);
|
// appWindow.Show(true);
|
||||||
// appWindow.Show can't bring window to top.
|
// appWindow.Show can't bring window to top.
|
||||||
window.Activate();
|
window.Activate();
|
||||||
options.BringToForeground();
|
options.BringToForeground();
|
||||||
UpdateSystemBackdrop(appOptions.BackdropType);
|
|
||||||
appOptions.PropertyChanged += OnOptionsPropertyChanged;
|
if (options.UseSystemBackdrop)
|
||||||
|
{
|
||||||
|
AppOptions appOptions = serviceProvider.GetRequiredService<AppOptions>();
|
||||||
|
UpdateSystemBackdrop(appOptions.BackdropType);
|
||||||
|
appOptions.PropertyChanged += OnOptionsPropertyChanged;
|
||||||
|
}
|
||||||
|
|
||||||
subclass.Initialize();
|
subclass.Initialize();
|
||||||
|
|
||||||
@@ -188,12 +190,12 @@ internal sealed class WindowController
|
|||||||
appTitleBar.ButtonBackgroundColor = Colors.Transparent;
|
appTitleBar.ButtonBackgroundColor = Colors.Transparent;
|
||||||
appTitleBar.ButtonInactiveBackgroundColor = Colors.Transparent;
|
appTitleBar.ButtonInactiveBackgroundColor = Colors.Transparent;
|
||||||
|
|
||||||
bool isDarkMode = Control.Theme.ThemeHelper.IsDarkMode(options.TitleBar.ActualTheme);
|
IAppResourceProvider resourceProvider = serviceProvider.GetRequiredService<IAppResourceProvider>();
|
||||||
|
|
||||||
Color systemBaseLowColor = Control.Theme.SystemColors.BaseLowColor(isDarkMode);
|
Color systemBaseLowColor = resourceProvider.GetResource<Color>("SystemBaseLowColor");
|
||||||
appTitleBar.ButtonHoverBackgroundColor = systemBaseLowColor;
|
appTitleBar.ButtonHoverBackgroundColor = systemBaseLowColor;
|
||||||
|
|
||||||
Color systemBaseMediumLowColor = Control.Theme.SystemColors.BaseMediumLowColor(isDarkMode);
|
Color systemBaseMediumLowColor = resourceProvider.GetResource<Color>("SystemBaseMediumLowColor");
|
||||||
appTitleBar.ButtonPressedBackgroundColor = systemBaseMediumLowColor;
|
appTitleBar.ButtonPressedBackgroundColor = systemBaseMediumLowColor;
|
||||||
|
|
||||||
// The Foreground doesn't accept Alpha channel. So we translate it to gray.
|
// The Foreground doesn't accept Alpha channel. So we translate it to gray.
|
||||||
@@ -201,7 +203,7 @@ internal sealed class WindowController
|
|||||||
byte result = (byte)((systemBaseMediumLowColor.A / 255.0) * light);
|
byte result = (byte)((systemBaseMediumLowColor.A / 255.0) * light);
|
||||||
appTitleBar.ButtonInactiveForegroundColor = Color.FromArgb(0xFF, result, result, result);
|
appTitleBar.ButtonInactiveForegroundColor = Color.FromArgb(0xFF, result, result, result);
|
||||||
|
|
||||||
Color systemBaseHighColor = Control.Theme.SystemColors.BaseHighColor(isDarkMode);
|
Color systemBaseHighColor = resourceProvider.GetResource<Color>("SystemBaseHighColor");
|
||||||
appTitleBar.ButtonForegroundColor = systemBaseHighColor;
|
appTitleBar.ButtonForegroundColor = systemBaseHighColor;
|
||||||
appTitleBar.ButtonHoverForegroundColor = systemBaseHighColor;
|
appTitleBar.ButtonHoverForegroundColor = systemBaseHighColor;
|
||||||
appTitleBar.ButtonPressedForegroundColor = systemBaseHighColor;
|
appTitleBar.ButtonPressedForegroundColor = systemBaseHighColor;
|
||||||
|
|||||||
@@ -41,18 +41,21 @@ internal readonly struct WindowOptions
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly bool PersistSize;
|
public readonly bool PersistSize;
|
||||||
|
|
||||||
|
public readonly bool UseSystemBackdrop;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否使用 Win UI 3 自带的拓展标题栏实现
|
/// 是否使用 Win UI 3 自带的拓展标题栏实现
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly bool UseLegacyDragBarImplementation = !AppWindowTitleBar.IsCustomizationSupported();
|
public readonly bool UseLegacyDragBarImplementation = !AppWindowTitleBar.IsCustomizationSupported();
|
||||||
|
|
||||||
public WindowOptions(Window window, FrameworkElement titleBar, SizeInt32 initSize, bool persistSize = false)
|
public WindowOptions(Window window, FrameworkElement titleBar, SizeInt32 initSize, bool persistSize = false, bool useSystemBackdrop = true)
|
||||||
{
|
{
|
||||||
Hwnd = WindowNative.GetWindowHandle(window);
|
Hwnd = WindowNative.GetWindowHandle(window);
|
||||||
InputNonClientPointerSource = InputNonClientPointerSource.GetForWindowId(window.AppWindow.Id);
|
InputNonClientPointerSource = InputNonClientPointerSource.GetForWindowId(window.AppWindow.Id);
|
||||||
TitleBar = titleBar;
|
TitleBar = titleBar;
|
||||||
InitSize = initSize;
|
InitSize = initSize;
|
||||||
PersistSize = persistSize;
|
PersistSize = persistSize;
|
||||||
|
UseSystemBackdrop = useSystemBackdrop;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -2381,9 +2381,6 @@
|
|||||||
<data name="ViewPageSettingBackgroundImageHeader" xml:space="preserve">
|
<data name="ViewPageSettingBackgroundImageHeader" xml:space="preserve">
|
||||||
<value>背景图片</value>
|
<value>背景图片</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="ViewPageSettingBackgroundImageLocalFolderCopyrightHeader" xml:space="preserve">
|
|
||||||
<value>当前背景为本地图片,如遇版权问题由用户个人负责</value>
|
|
||||||
</data>
|
|
||||||
<data name="ViewPageSettingCacheFolderDescription" xml:space="preserve">
|
<data name="ViewPageSettingCacheFolderDescription" xml:space="preserve">
|
||||||
<value>图片缓存 在此处存放</value>
|
<value>图片缓存 在此处存放</value>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ internal sealed class GachaTypeComparer : IComparer<GachaType>
|
|||||||
KeyValuePair.Create(GachaType.ActivityAvatar, 0),
|
KeyValuePair.Create(GachaType.ActivityAvatar, 0),
|
||||||
KeyValuePair.Create(GachaType.SpecialActivityAvatar, 1),
|
KeyValuePair.Create(GachaType.SpecialActivityAvatar, 1),
|
||||||
KeyValuePair.Create(GachaType.ActivityWeapon, 2),
|
KeyValuePair.Create(GachaType.ActivityWeapon, 2),
|
||||||
KeyValuePair.Create(GachaType.ActivityCity, 3),
|
KeyValuePair.Create(GachaType.Standard, 3),
|
||||||
KeyValuePair.Create(GachaType.Standard, 4),
|
KeyValuePair.Create(GachaType.NewBie, 4),
|
||||||
KeyValuePair.Create(GachaType.NewBie, 5),
|
KeyValuePair.Create(GachaType.ActivityCity, 5),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -38,10 +38,6 @@ internal sealed class PullPrediction
|
|||||||
typedWishSummary.PredictedPullLeftToOrange = result.PredictedPullLeftToOrange;
|
typedWishSummary.PredictedPullLeftToOrange = result.PredictedPullLeftToOrange;
|
||||||
typedWishSummary.IsPredictPullAvailable = true;
|
typedWishSummary.IsPredictPullAvailable = true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
await barrier.SignalAndWaitAsync().ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static PredictResult PredictCore(List<PullCount> distribution, TypedWishSummary typedWishSummary)
|
private static PredictResult PredictCore(List<PullCount> distribution, TypedWishSummary typedWishSummary)
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ internal sealed class LaunchOptions : DbStoreOptions
|
|||||||
|
|
||||||
public bool IsEnabled
|
public bool IsEnabled
|
||||||
{
|
{
|
||||||
get => GetOption(ref isEnabled, SettingEntry.LaunchIsLaunchOptionsEnabled, false);
|
get => GetOption(ref isEnabled, SettingEntry.LaunchIsLaunchOptionsEnabled, true);
|
||||||
set => SetOption(ref isEnabled, SettingEntry.LaunchIsLaunchOptionsEnabled, value);
|
set => SetOption(ref isEnabled, SettingEntry.LaunchIsLaunchOptionsEnabled, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,9 +17,9 @@ internal sealed class LaunchStatus
|
|||||||
|
|
||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
|
|
||||||
public static LaunchStatus FromUnlockState(GameFpsUnlockerState unlockerState)
|
public static LaunchStatus FromUnlockStatus(UnlockerStatus unlockerStatus)
|
||||||
{
|
{
|
||||||
if (unlockerState.FindModuleResult == FindModuleResult.Ok)
|
if (unlockerStatus.FindModuleState == FindModuleResult.Ok)
|
||||||
{
|
{
|
||||||
return new(LaunchPhase.UnlockFpsSucceed, SH.ServiceGameLaunchPhaseUnlockFpsSucceed);
|
return new(LaunchPhase.UnlockFpsSucceed, SH.ServiceGameLaunchPhaseUnlockFpsSucceed);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ internal sealed class LaunchExecutionBetterGenshinImpactAutomationHandlder : ILa
|
|||||||
}
|
}
|
||||||
catch (InvalidOperationException)
|
catch (InvalidOperationException)
|
||||||
{
|
{
|
||||||
context.Logger.LogInformation("Failed to wait Input idle waiting");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,27 +1,18 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
// Copyright (c) DGP Studio. All rights reserved.
|
||||||
// Licensed under the MIT license.
|
// Licensed under the MIT license.
|
||||||
|
|
||||||
using System.Diagnostics;
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Service.Game.Launching.Handler;
|
namespace Snap.Hutao.Service.Game.Launching.Handler;
|
||||||
|
|
||||||
internal sealed class LaunchExecutionEnsureGameNotRunningHandler : ILaunchExecutionDelegateHandler
|
internal sealed class LaunchExecutionEnsureGameNotRunningHandler : ILaunchExecutionDelegateHandler
|
||||||
{
|
{
|
||||||
public static bool IsGameRunning([NotNullWhen(true)] out Process? runningProcess)
|
public static bool IsGameRunning([NotNullWhen(true)] out System.Diagnostics.Process? runningProcess)
|
||||||
{
|
{
|
||||||
int currentSessionId = Process.GetCurrentProcess().SessionId;
|
|
||||||
|
|
||||||
// GetProcesses once and manually loop is O(n)
|
// GetProcesses once and manually loop is O(n)
|
||||||
foreach (ref readonly Process process in Process.GetProcesses().AsSpan())
|
foreach (ref readonly System.Diagnostics.Process process in System.Diagnostics.Process.GetProcesses().AsSpan())
|
||||||
{
|
{
|
||||||
if (string.Equals(process.ProcessName, GameConstants.YuanShenProcessName, StringComparison.OrdinalIgnoreCase) ||
|
if (string.Equals(process.ProcessName, GameConstants.YuanShenProcessName, StringComparison.OrdinalIgnoreCase) ||
|
||||||
string.Equals(process.ProcessName, GameConstants.GenshinImpactProcessName, StringComparison.OrdinalIgnoreCase))
|
string.Equals(process.ProcessName, GameConstants.GenshinImpactProcessName, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
if (process.SessionId != currentSessionId)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
runningProcess = process;
|
runningProcess = process;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -33,7 +24,7 @@ internal sealed class LaunchExecutionEnsureGameNotRunningHandler : ILaunchExecut
|
|||||||
|
|
||||||
public async ValueTask OnExecutionAsync(LaunchExecutionContext context, LaunchExecutionDelegate next)
|
public async ValueTask OnExecutionAsync(LaunchExecutionContext context, LaunchExecutionDelegate next)
|
||||||
{
|
{
|
||||||
if (IsGameRunning(out Process? process))
|
if (IsGameRunning(out System.Diagnostics.Process? process))
|
||||||
{
|
{
|
||||||
context.Logger.LogInformation("Game process detected, id: {Id}", process.Id);
|
context.Logger.LogInformation("Game process detected, id: {Id}", process.Id);
|
||||||
|
|
||||||
|
|||||||
@@ -18,13 +18,12 @@ internal sealed class LaunchExecutionUnlockFpsHandler : ILaunchExecutionDelegate
|
|||||||
context.Progress.Report(new(LaunchPhase.UnlockingFps, SH.ServiceGameLaunchPhaseUnlockingFps));
|
context.Progress.Report(new(LaunchPhase.UnlockingFps, SH.ServiceGameLaunchPhaseUnlockingFps));
|
||||||
|
|
||||||
IProgressFactory progressFactory = context.ServiceProvider.GetRequiredService<IProgressFactory>();
|
IProgressFactory progressFactory = context.ServiceProvider.GetRequiredService<IProgressFactory>();
|
||||||
IProgress<GameFpsUnlockerState> progress = progressFactory.CreateForMainThread<GameFpsUnlockerState>(status => context.Progress.Report(LaunchStatus.FromUnlockState(status)));
|
IProgress<UnlockerStatus> progress = progressFactory.CreateForMainThread<UnlockerStatus>(status => context.Progress.Report(LaunchStatus.FromUnlockStatus(status)));
|
||||||
GameFpsUnlocker unlocker = new(context.ServiceProvider, context.Process, new(100, 20000, 3000), progress);
|
GameFpsUnlocker unlocker = context.ServiceProvider.CreateInstance<GameFpsUnlocker>(context.Process);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await unlocker.UnlockAsync(context.CancellationToken).ConfigureAwait(false);
|
await unlocker.UnlockAsync(new(100, 20000, 3000), progress, context.CancellationToken).ConfigureAwait(false);
|
||||||
unlocker.PostUnlockAsync(context.CancellationToken).SafeForget();
|
|
||||||
}
|
}
|
||||||
catch (InvalidOperationException ex)
|
catch (InvalidOperationException ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -24,25 +24,25 @@ internal sealed class LaunchExecutionInvoker
|
|||||||
handlers.Enqueue(new LaunchExecutionGameProcessInitializationHandler());
|
handlers.Enqueue(new LaunchExecutionGameProcessInitializationHandler());
|
||||||
handlers.Enqueue(new LaunchExecutionSetDiscordActivityHandler());
|
handlers.Enqueue(new LaunchExecutionSetDiscordActivityHandler());
|
||||||
handlers.Enqueue(new LaunchExecutionGameProcessStartHandler());
|
handlers.Enqueue(new LaunchExecutionGameProcessStartHandler());
|
||||||
handlers.Enqueue(new LaunchExecutionUnlockFpsHandler());
|
|
||||||
handlers.Enqueue(new LaunchExecutionStarwardPlayTimeStatisticsHandler());
|
handlers.Enqueue(new LaunchExecutionStarwardPlayTimeStatisticsHandler());
|
||||||
handlers.Enqueue(new LaunchExecutionBetterGenshinImpactAutomationHandlder());
|
handlers.Enqueue(new LaunchExecutionBetterGenshinImpactAutomationHandlder());
|
||||||
|
handlers.Enqueue(new LaunchExecutionUnlockFpsHandler());
|
||||||
handlers.Enqueue(new LaunchExecutionGameProcessExitHandler());
|
handlers.Enqueue(new LaunchExecutionGameProcessExitHandler());
|
||||||
}
|
}
|
||||||
|
|
||||||
public async ValueTask<LaunchExecutionResult> InvokeAsync(LaunchExecutionContext context)
|
public async ValueTask<LaunchExecutionResult> InvokeAsync(LaunchExecutionContext context)
|
||||||
{
|
{
|
||||||
await RecursiveInvokeHandlerAsync(context).ConfigureAwait(false);
|
await InvokeHandlerAsync(context).ConfigureAwait(false);
|
||||||
return context.Result;
|
return context.Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async ValueTask<LaunchExecutionContext> RecursiveInvokeHandlerAsync(LaunchExecutionContext context)
|
private async ValueTask<LaunchExecutionContext> InvokeHandlerAsync(LaunchExecutionContext context)
|
||||||
{
|
{
|
||||||
if (handlers.TryDequeue(out ILaunchExecutionDelegateHandler? handler))
|
if (handlers.TryDequeue(out ILaunchExecutionDelegateHandler? handler))
|
||||||
{
|
{
|
||||||
string typeName = TypeNameHelper.GetTypeDisplayName(handler, false);
|
string typeName = TypeNameHelper.GetTypeDisplayName(handler, false);
|
||||||
context.Logger.LogInformation("Handler [{Handler}] begin execution", typeName);
|
context.Logger.LogInformation("Handler [{Handler}] begin execution", typeName);
|
||||||
await handler.OnExecutionAsync(context, () => RecursiveInvokeHandlerAsync(context)).ConfigureAwait(false);
|
await handler.OnExecutionAsync(context, () => InvokeHandlerAsync(context)).ConfigureAwait(false);
|
||||||
context.Logger.LogInformation("Handler [{Handler}] end execution", typeName);
|
context.Logger.LogInformation("Handler [{Handler}] end execution", typeName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,82 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
using Snap.Hutao.Core.ExceptionService;
|
|
||||||
using Snap.Hutao.Win32.Foundation;
|
|
||||||
using Snap.Hutao.Win32.Memory;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using static Snap.Hutao.Win32.Kernel32;
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Service.Game.Unlocker;
|
|
||||||
|
|
||||||
internal static class GameFpsAddress
|
|
||||||
{
|
|
||||||
#pragma warning disable SA1310
|
|
||||||
private const byte ASM_CALL = 0xE8;
|
|
||||||
private const byte ASM_JMP = 0xE9;
|
|
||||||
#pragma warning restore SA1310
|
|
||||||
|
|
||||||
public static unsafe void UnsafeFindFpsAddress(GameFpsUnlockerState state, in RequiredGameModule requiredGameModule)
|
|
||||||
{
|
|
||||||
bool readOk = UnsafeReadModulesMemory(state.GameProcess, requiredGameModule, out VirtualMemory localMemory);
|
|
||||||
HutaoException.ThrowIfNot(readOk, HutaoExceptionKind.GameFpsUnlockingFailed, SH.ServiceGameUnlockerReadModuleMemoryCopyVirtualMemoryFailed);
|
|
||||||
|
|
||||||
using (localMemory)
|
|
||||||
{
|
|
||||||
int offset = IndexOfPattern(localMemory.AsSpan()[(int)requiredGameModule.UnityPlayer.Size..]);
|
|
||||||
HutaoException.ThrowIfNot(offset >= 0, HutaoExceptionKind.GameFpsUnlockingFailed, SH.ServiceGameUnlockerInterestedPatternNotFound);
|
|
||||||
|
|
||||||
byte* pLocalMemory = (byte*)localMemory.Pointer;
|
|
||||||
ref readonly Module unityPlayer = ref requiredGameModule.UnityPlayer;
|
|
||||||
ref readonly Module userAssembly = ref requiredGameModule.UserAssembly;
|
|
||||||
|
|
||||||
nuint localMemoryUnityPlayerAddress = (nuint)pLocalMemory;
|
|
||||||
nuint localMemoryUserAssemblyAddress = localMemoryUnityPlayerAddress + unityPlayer.Size;
|
|
||||||
|
|
||||||
nuint rip = localMemoryUserAssemblyAddress + (uint)offset;
|
|
||||||
rip += 5U;
|
|
||||||
rip += (nuint)(*(int*)(rip + 2U) + 6);
|
|
||||||
|
|
||||||
nuint address = userAssembly.Address + (rip - localMemoryUserAssemblyAddress);
|
|
||||||
|
|
||||||
nuint ptr = 0;
|
|
||||||
SpinWait.SpinUntil(() => UnsafeReadProcessMemory(state.GameProcess, address, out ptr) && ptr != 0);
|
|
||||||
|
|
||||||
rip = ptr - unityPlayer.Address + localMemoryUnityPlayerAddress;
|
|
||||||
|
|
||||||
while (*(byte*)rip is ASM_CALL or ASM_JMP)
|
|
||||||
{
|
|
||||||
rip += (nuint)(*(int*)(rip + 1) + 5);
|
|
||||||
}
|
|
||||||
|
|
||||||
nuint localMemoryActualAddress = rip + *(uint*)(rip + 2) + 6;
|
|
||||||
nuint actualOffset = localMemoryActualAddress - localMemoryUnityPlayerAddress;
|
|
||||||
state.FpsAddress = unityPlayer.Address + actualOffset;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static int IndexOfPattern(in ReadOnlySpan<byte> memory)
|
|
||||||
{
|
|
||||||
// B9 3C 00 00 00 FF 15
|
|
||||||
ReadOnlySpan<byte> part = [0xB9, 0x3C, 0x00, 0x00, 0x00, 0xFF, 0x15];
|
|
||||||
return memory.IndexOf(part);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static unsafe bool UnsafeReadModulesMemory(Process process, in RequiredGameModule moduleEntryInfo, out VirtualMemory memory)
|
|
||||||
{
|
|
||||||
ref readonly Module unityPlayer = ref moduleEntryInfo.UnityPlayer;
|
|
||||||
ref readonly Module userAssembly = ref moduleEntryInfo.UserAssembly;
|
|
||||||
|
|
||||||
memory = new VirtualMemory(unityPlayer.Size + userAssembly.Size);
|
|
||||||
return ReadProcessMemory(process.Handle, (void*)unityPlayer.Address, memory.AsSpan()[..(int)unityPlayer.Size], out _)
|
|
||||||
&& ReadProcessMemory(process.Handle, (void*)userAssembly.Address, memory.AsSpan()[(int)unityPlayer.Size..], out _);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static unsafe bool UnsafeReadProcessMemory(Process process, nuint baseAddress, out nuint value)
|
|
||||||
{
|
|
||||||
value = 0;
|
|
||||||
bool result = ReadProcessMemory((HANDLE)process.Handle, (void*)baseAddress, ref value, out _);
|
|
||||||
HutaoException.ThrowIfNot(result, HutaoExceptionKind.GameFpsUnlockingFailed, SH.ServiceGameUnlockerReadProcessMemoryPointerAddressFailed);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +1,11 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
// Copyright (c) DGP Studio. All rights reserved.
|
||||||
// Licensed under the MIT license.
|
// Licensed under the MIT license.
|
||||||
|
|
||||||
using Snap.Hutao.Core.ExceptionService;
|
using Snap.Hutao.Core.Diagnostics;
|
||||||
using Snap.Hutao.Win32.Foundation;
|
using Snap.Hutao.Win32.Foundation;
|
||||||
using System.Diagnostics;
|
using Snap.Hutao.Win32.Memory;
|
||||||
|
using Snap.Hutao.Win32.System.ProcessStatus;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
using static Snap.Hutao.Win32.Kernel32;
|
using static Snap.Hutao.Win32.Kernel32;
|
||||||
|
|
||||||
namespace Snap.Hutao.Service.Game.Unlocker;
|
namespace Snap.Hutao.Service.Game.Unlocker;
|
||||||
@@ -15,54 +17,255 @@ namespace Snap.Hutao.Service.Game.Unlocker;
|
|||||||
[HighQuality]
|
[HighQuality]
|
||||||
internal sealed class GameFpsUnlocker : IGameFpsUnlocker
|
internal sealed class GameFpsUnlocker : IGameFpsUnlocker
|
||||||
{
|
{
|
||||||
|
private readonly System.Diagnostics.Process gameProcess;
|
||||||
private readonly LaunchOptions launchOptions;
|
private readonly LaunchOptions launchOptions;
|
||||||
private readonly GameFpsUnlockerState state = new();
|
private readonly UnlockerStatus status = new();
|
||||||
|
|
||||||
public GameFpsUnlocker(IServiceProvider serviceProvider, Process gameProcess, in UnlockTimingOptions options, IProgress<GameFpsUnlockerState> progress)
|
/// <summary>
|
||||||
|
/// 构造一个新的 <see cref="GameFpsUnlocker"/> 对象,
|
||||||
|
/// 每个解锁器只能解锁一次原神的进程,
|
||||||
|
/// 再次解锁需要重新创建对象
|
||||||
|
/// <para/>
|
||||||
|
/// 解锁器需要在管理员模式下才能正确的完成解锁操作,
|
||||||
|
/// 非管理员模式不能解锁
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="serviceProvider">服务提供器</param>
|
||||||
|
/// <param name="gameProcess">游戏进程</param>
|
||||||
|
public GameFpsUnlocker(IServiceProvider serviceProvider, System.Diagnostics.Process gameProcess)
|
||||||
{
|
{
|
||||||
launchOptions = serviceProvider.GetRequiredService<LaunchOptions>();
|
launchOptions = serviceProvider.GetRequiredService<LaunchOptions>();
|
||||||
|
this.gameProcess = gameProcess;
|
||||||
state.GameProcess = gameProcess;
|
|
||||||
state.TimingOptions = options;
|
|
||||||
state.Progress = progress;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public async ValueTask UnlockAsync(CancellationToken token = default)
|
public async ValueTask UnlockAsync(UnlockTimingOptions options, IProgress<UnlockerStatus> progress, CancellationToken token = default)
|
||||||
{
|
{
|
||||||
HutaoException.ThrowIfNot(state.IsUnlockerValid, HutaoExceptionKind.GameFpsUnlockingFailed, "This Unlocker is invalid");
|
Verify.Operation(status.IsUnlockerValid, "This Unlocker is invalid");
|
||||||
(FindModuleResult result, RequiredGameModule gameModule) = await GameProcessModule.FindModuleAsync(state).ConfigureAwait(false);
|
|
||||||
HutaoException.ThrowIfNot(result != FindModuleResult.TimeLimitExeeded, HutaoExceptionKind.GameFpsUnlockingFailed, SH.ServiceGameUnlockerFindModuleTimeLimitExeeded);
|
|
||||||
HutaoException.ThrowIfNot(result != FindModuleResult.NoModuleFound, HutaoExceptionKind.GameFpsUnlockingFailed, SH.ServiceGameUnlockerFindModuleNoModuleFound);
|
|
||||||
|
|
||||||
GameFpsAddress.UnsafeFindFpsAddress(state, gameModule);
|
(FindModuleResult result, GameModule moduleEntryInfo) = await FindModuleAsync(options.FindModuleDelay, options.FindModuleLimit).ConfigureAwait(false);
|
||||||
state.Report();
|
Verify.Operation(result != FindModuleResult.TimeLimitExeeded, SH.ServiceGameUnlockerFindModuleTimeLimitExeeded);
|
||||||
|
Verify.Operation(result != FindModuleResult.NoModuleFound, SH.ServiceGameUnlockerFindModuleNoModuleFound);
|
||||||
|
|
||||||
|
// Read UnityPlayer.dll
|
||||||
|
UnsafeFindFpsAddress(moduleEntryInfo);
|
||||||
|
progress.Report(status);
|
||||||
|
|
||||||
|
// When player switch between scenes, we have to re adjust the fps
|
||||||
|
// So we keep a loop here
|
||||||
|
await LoopAdjustFpsAsync(options.AdjustFpsDelay, progress, token).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async ValueTask PostUnlockAsync(CancellationToken token = default)
|
private static unsafe bool UnsafeReadModulesMemory(System.Diagnostics.Process process, in GameModule moduleEntryInfo, out VirtualMemory memory)
|
||||||
{
|
{
|
||||||
using (PeriodicTimer timer = new(state.TimingOptions.AdjustFpsDelay))
|
ref readonly Module unityPlayer = ref moduleEntryInfo.UnityPlayer;
|
||||||
|
ref readonly Module userAssembly = ref moduleEntryInfo.UserAssembly;
|
||||||
|
|
||||||
|
memory = new VirtualMemory(unityPlayer.Size + userAssembly.Size);
|
||||||
|
return ReadProcessMemory(process.Handle, (void*)unityPlayer.Address, memory.AsSpan()[..(int)unityPlayer.Size], out _)
|
||||||
|
&& ReadProcessMemory(process.Handle, (void*)userAssembly.Address, memory.AsSpan()[(int)unityPlayer.Size..], out _);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static unsafe bool UnsafeReadProcessMemory(System.Diagnostics.Process process, nuint baseAddress, out nuint value)
|
||||||
|
{
|
||||||
|
value = 0;
|
||||||
|
bool result = ReadProcessMemory((HANDLE)process.Handle, (void*)baseAddress, ref value, out _);
|
||||||
|
Verify.Operation(result, SH.ServiceGameUnlockerReadProcessMemoryPointerAddressFailed);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static unsafe bool UnsafeWriteProcessMemory(System.Diagnostics.Process process, nuint baseAddress, int value)
|
||||||
|
{
|
||||||
|
return WriteProcessMemory((HANDLE)process.Handle, (void*)baseAddress, ref value, out _);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static unsafe FindModuleResult UnsafeTryFindModule(in HANDLE hProcess, in ReadOnlySpan<char> moduleName, out Module module)
|
||||||
|
{
|
||||||
|
HMODULE[] buffer = new HMODULE[128];
|
||||||
|
if (!K32EnumProcessModules(hProcess, buffer, out uint actualSize))
|
||||||
|
{
|
||||||
|
Marshal.ThrowExceptionForHR(Marshal.GetLastPInvokeError());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (actualSize == 0)
|
||||||
|
{
|
||||||
|
module = default!;
|
||||||
|
return FindModuleResult.NoModuleFound;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (ref readonly HMODULE hModule in buffer.AsSpan()[..(int)(actualSize / sizeof(HMODULE))])
|
||||||
|
{
|
||||||
|
char[] baseName = new char[256];
|
||||||
|
|
||||||
|
if (K32GetModuleBaseNameW(hProcess, hModule, baseName) == 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
fixed (char* lpBaseName = baseName)
|
||||||
|
{
|
||||||
|
ReadOnlySpan<char> szModuleName = MemoryMarshal.CreateReadOnlySpanFromNullTerminated(lpBaseName);
|
||||||
|
if (!szModuleName.SequenceEqual(moduleName))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!K32GetModuleInformation(hProcess, hModule, out MODULEINFO moduleInfo))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
module = new((nuint)moduleInfo.lpBaseOfDll, moduleInfo.SizeOfImage);
|
||||||
|
return FindModuleResult.Ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
module = default;
|
||||||
|
return FindModuleResult.ModuleNotLoaded;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int IndexOfPattern(in ReadOnlySpan<byte> memory)
|
||||||
|
{
|
||||||
|
// B9 3C 00 00 00 FF 15
|
||||||
|
ReadOnlySpan<byte> part = [0xB9, 0x3C, 0x00, 0x00, 0x00, 0xFF, 0x15];
|
||||||
|
return memory.IndexOf(part);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static FindModuleResult UnsafeGetGameModuleInfo(in HANDLE hProcess, out GameModule info)
|
||||||
|
{
|
||||||
|
FindModuleResult unityPlayerResult = UnsafeTryFindModule(hProcess, "UnityPlayer.dll", out Module unityPlayer);
|
||||||
|
FindModuleResult userAssemblyResult = UnsafeTryFindModule(hProcess, "UserAssembly.dll", out Module userAssembly);
|
||||||
|
|
||||||
|
if (unityPlayerResult == FindModuleResult.Ok && userAssemblyResult == FindModuleResult.Ok)
|
||||||
|
{
|
||||||
|
info = new(unityPlayer, userAssembly);
|
||||||
|
return FindModuleResult.Ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (unityPlayerResult == FindModuleResult.NoModuleFound && userAssemblyResult == FindModuleResult.NoModuleFound)
|
||||||
|
{
|
||||||
|
info = default;
|
||||||
|
return FindModuleResult.NoModuleFound;
|
||||||
|
}
|
||||||
|
|
||||||
|
info = default;
|
||||||
|
return FindModuleResult.ModuleNotLoaded;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async ValueTask<ValueResult<FindModuleResult, GameModule>> FindModuleAsync(TimeSpan findModuleDelay, TimeSpan findModuleLimit)
|
||||||
|
{
|
||||||
|
ValueStopwatch watch = ValueStopwatch.StartNew();
|
||||||
|
using (PeriodicTimer timer = new(findModuleDelay))
|
||||||
|
{
|
||||||
|
while (await timer.WaitForNextTickAsync().ConfigureAwait(false))
|
||||||
|
{
|
||||||
|
FindModuleResult result = UnsafeGetGameModuleInfo((HANDLE)gameProcess.Handle, out GameModule gameModule);
|
||||||
|
if (result == FindModuleResult.Ok)
|
||||||
|
{
|
||||||
|
return new(FindModuleResult.Ok, gameModule);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result == FindModuleResult.NoModuleFound)
|
||||||
|
{
|
||||||
|
return new(FindModuleResult.NoModuleFound, default);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (watch.GetElapsedTime() > findModuleLimit)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new(FindModuleResult.TimeLimitExeeded, default);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async ValueTask LoopAdjustFpsAsync(TimeSpan adjustFpsDelay, IProgress<UnlockerStatus> progress, CancellationToken token)
|
||||||
|
{
|
||||||
|
using (PeriodicTimer timer = new(adjustFpsDelay))
|
||||||
{
|
{
|
||||||
while (await timer.WaitForNextTickAsync(token).ConfigureAwait(false))
|
while (await timer.WaitForNextTickAsync(token).ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
if (!state.GameProcess.HasExited && state.FpsAddress != 0U)
|
if (!gameProcess.HasExited && status.FpsAddress != 0U)
|
||||||
{
|
{
|
||||||
UnsafeWriteProcessMemory(state.GameProcess, state.FpsAddress, launchOptions.TargetFps);
|
UnsafeWriteProcessMemory(gameProcess, status.FpsAddress, launchOptions.TargetFps);
|
||||||
state.Report();
|
progress.Report(status);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
state.IsUnlockerValid = false;
|
status.IsUnlockerValid = false;
|
||||||
state.FpsAddress = 0;
|
status.FpsAddress = 0;
|
||||||
state.Report();
|
progress.Report(status);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static unsafe bool UnsafeWriteProcessMemory(Process process, nuint baseAddress, int value)
|
private unsafe void UnsafeFindFpsAddress(in GameModule moduleEntryInfo)
|
||||||
{
|
{
|
||||||
return WriteProcessMemory((HANDLE)process.Handle, (void*)baseAddress, ref value, out _);
|
bool readOk = UnsafeReadModulesMemory(gameProcess, moduleEntryInfo, out VirtualMemory localMemory);
|
||||||
|
Verify.Operation(readOk, SH.ServiceGameUnlockerReadModuleMemoryCopyVirtualMemoryFailed);
|
||||||
|
|
||||||
|
using (localMemory)
|
||||||
|
{
|
||||||
|
int offset = IndexOfPattern(localMemory.AsSpan()[(int)moduleEntryInfo.UnityPlayer.Size..]);
|
||||||
|
Must.Range(offset >= 0, SH.ServiceGameUnlockerInterestedPatternNotFound);
|
||||||
|
|
||||||
|
byte* pLocalMemory = (byte*)localMemory.Pointer;
|
||||||
|
ref readonly Module unityPlayer = ref moduleEntryInfo.UnityPlayer;
|
||||||
|
ref readonly Module userAssembly = ref moduleEntryInfo.UserAssembly;
|
||||||
|
|
||||||
|
nuint localMemoryUnityPlayerAddress = (nuint)pLocalMemory;
|
||||||
|
nuint localMemoryUserAssemblyAddress = localMemoryUnityPlayerAddress + unityPlayer.Size;
|
||||||
|
|
||||||
|
nuint rip = localMemoryUserAssemblyAddress + (uint)offset;
|
||||||
|
rip += 5U;
|
||||||
|
rip += (nuint)(*(int*)(rip + 2U) + 6);
|
||||||
|
|
||||||
|
nuint address = userAssembly.Address + (rip - localMemoryUserAssemblyAddress);
|
||||||
|
|
||||||
|
nuint ptr = 0;
|
||||||
|
SpinWait.SpinUntil(() => UnsafeReadProcessMemory(gameProcess, address, out ptr) && ptr != 0);
|
||||||
|
|
||||||
|
rip = ptr - unityPlayer.Address + localMemoryUnityPlayerAddress;
|
||||||
|
|
||||||
|
// CALL or JMP
|
||||||
|
while (*(byte*)rip == 0xE8 || *(byte*)rip == 0xE9)
|
||||||
|
{
|
||||||
|
rip += (nuint)(*(int*)(rip + 1) + 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
nuint localMemoryActualAddress = rip + *(uint*)(rip + 2) + 6;
|
||||||
|
nuint actualOffset = localMemoryActualAddress - localMemoryUnityPlayerAddress;
|
||||||
|
status.FpsAddress = unityPlayer.Address + actualOffset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private readonly struct GameModule
|
||||||
|
{
|
||||||
|
public readonly bool HasValue = false;
|
||||||
|
public readonly Module UnityPlayer;
|
||||||
|
public readonly Module UserAssembly;
|
||||||
|
|
||||||
|
public GameModule(in Module unityPlayer, in Module userAssembly)
|
||||||
|
{
|
||||||
|
HasValue = true;
|
||||||
|
UnityPlayer = unityPlayer;
|
||||||
|
UserAssembly = userAssembly;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private readonly struct Module
|
||||||
|
{
|
||||||
|
public readonly bool HasValue = false;
|
||||||
|
public readonly nuint Address;
|
||||||
|
public readonly uint Size;
|
||||||
|
|
||||||
|
public Module(nuint address, uint size)
|
||||||
|
{
|
||||||
|
HasValue = true;
|
||||||
|
Address = address;
|
||||||
|
Size = size;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
using System.Diagnostics;
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Service.Game.Unlocker;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 解锁状态
|
|
||||||
/// </summary>
|
|
||||||
internal sealed class GameFpsUnlockerState
|
|
||||||
{
|
|
||||||
public string Description { get; set; } = default!;
|
|
||||||
|
|
||||||
public FindModuleResult FindModuleResult { get; set; }
|
|
||||||
|
|
||||||
public bool IsUnlockerValid { get; set; } = true;
|
|
||||||
|
|
||||||
public nuint FpsAddress { get; set; }
|
|
||||||
|
|
||||||
public UnlockTimingOptions TimingOptions { get; set; }
|
|
||||||
|
|
||||||
public Process GameProcess { get; set; } = default!;
|
|
||||||
|
|
||||||
public IProgress<GameFpsUnlockerState> Progress { get; set; } = default!;
|
|
||||||
|
|
||||||
public void Report()
|
|
||||||
{
|
|
||||||
Progress.Report(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,108 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
using Snap.Hutao.Core.Diagnostics;
|
|
||||||
using Snap.Hutao.Win32.Foundation;
|
|
||||||
using Snap.Hutao.Win32.Memory;
|
|
||||||
using Snap.Hutao.Win32.System.ProcessStatus;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using static Snap.Hutao.Win32.Kernel32;
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Service.Game.Unlocker;
|
|
||||||
|
|
||||||
internal static class GameProcessModule
|
|
||||||
{
|
|
||||||
public static async ValueTask<ValueResult<FindModuleResult, RequiredGameModule>> FindModuleAsync(GameFpsUnlockerState state)
|
|
||||||
{
|
|
||||||
ValueStopwatch watch = ValueStopwatch.StartNew();
|
|
||||||
using (PeriodicTimer timer = new(state.TimingOptions.FindModuleDelay))
|
|
||||||
{
|
|
||||||
while (await timer.WaitForNextTickAsync().ConfigureAwait(false))
|
|
||||||
{
|
|
||||||
FindModuleResult result = UnsafeGetGameModuleInfo((HANDLE)state.GameProcess.Handle, out RequiredGameModule gameModule);
|
|
||||||
if (result == FindModuleResult.Ok)
|
|
||||||
{
|
|
||||||
return new(FindModuleResult.Ok, gameModule);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result == FindModuleResult.NoModuleFound)
|
|
||||||
{
|
|
||||||
return new(FindModuleResult.NoModuleFound, default);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (watch.GetElapsedTime() > state.TimingOptions.FindModuleLimit)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return new(FindModuleResult.TimeLimitExeeded, default);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static FindModuleResult UnsafeGetGameModuleInfo(in HANDLE hProcess, out RequiredGameModule info)
|
|
||||||
{
|
|
||||||
FindModuleResult unityPlayerResult = UnsafeFindModule(hProcess, "UnityPlayer.dll", out Module unityPlayer);
|
|
||||||
FindModuleResult userAssemblyResult = UnsafeFindModule(hProcess, "UserAssembly.dll", out Module userAssembly);
|
|
||||||
|
|
||||||
if (unityPlayerResult is FindModuleResult.Ok && userAssemblyResult is FindModuleResult.Ok)
|
|
||||||
{
|
|
||||||
info = new(unityPlayer, userAssembly);
|
|
||||||
return FindModuleResult.Ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (unityPlayerResult is FindModuleResult.NoModuleFound && userAssemblyResult is FindModuleResult.NoModuleFound)
|
|
||||||
{
|
|
||||||
info = default;
|
|
||||||
return FindModuleResult.NoModuleFound;
|
|
||||||
}
|
|
||||||
|
|
||||||
info = default;
|
|
||||||
return FindModuleResult.ModuleNotLoaded;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static unsafe FindModuleResult UnsafeFindModule(in HANDLE hProcess, in ReadOnlySpan<char> moduleName, out Module module)
|
|
||||||
{
|
|
||||||
HMODULE[] buffer = new HMODULE[128];
|
|
||||||
if (!K32EnumProcessModules(hProcess, buffer, out uint actualSize))
|
|
||||||
{
|
|
||||||
Marshal.ThrowExceptionForHR(Marshal.GetLastPInvokeError());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (actualSize == 0)
|
|
||||||
{
|
|
||||||
module = default!;
|
|
||||||
return FindModuleResult.NoModuleFound;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (ref readonly HMODULE hModule in buffer.AsSpan()[..(int)(actualSize / sizeof(HMODULE))])
|
|
||||||
{
|
|
||||||
char[] baseName = new char[256];
|
|
||||||
|
|
||||||
if (K32GetModuleBaseNameW(hProcess, hModule, baseName) == 0)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
fixed (char* lpBaseName = baseName)
|
|
||||||
{
|
|
||||||
if (!moduleName.SequenceEqual(MemoryMarshal.CreateReadOnlySpanFromNullTerminated(lpBaseName)))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!K32GetModuleInformation(hProcess, hModule, out MODULEINFO moduleInfo))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
module = new((nuint)moduleInfo.lpBaseOfDll, moduleInfo.SizeOfImage);
|
|
||||||
return FindModuleResult.Ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
module = default;
|
|
||||||
return FindModuleResult.ModuleNotLoaded;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -9,7 +9,12 @@ namespace Snap.Hutao.Service.Game.Unlocker;
|
|||||||
[HighQuality]
|
[HighQuality]
|
||||||
internal interface IGameFpsUnlocker
|
internal interface IGameFpsUnlocker
|
||||||
{
|
{
|
||||||
ValueTask PostUnlockAsync(CancellationToken token = default);
|
/// <summary>
|
||||||
|
/// 异步的解锁帧数限制
|
||||||
ValueTask UnlockAsync(CancellationToken token = default);
|
/// </summary>
|
||||||
|
/// <param name="options">选项</param>
|
||||||
|
/// <param name="progress">进度</param>
|
||||||
|
/// <param name="token">取消令牌</param>
|
||||||
|
/// <returns>解锁的结果</returns>
|
||||||
|
ValueTask UnlockAsync(UnlockTimingOptions options, IProgress<UnlockerStatus> progress, CancellationToken token = default);
|
||||||
}
|
}
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Service.Game.Unlocker;
|
|
||||||
|
|
||||||
internal readonly struct Module
|
|
||||||
{
|
|
||||||
public readonly bool HasValue = false;
|
|
||||||
public readonly nuint Address;
|
|
||||||
public readonly uint Size;
|
|
||||||
|
|
||||||
public Module(nuint address, uint size)
|
|
||||||
{
|
|
||||||
HasValue = true;
|
|
||||||
Address = address;
|
|
||||||
Size = size;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Service.Game.Unlocker;
|
|
||||||
|
|
||||||
internal readonly struct RequiredGameModule
|
|
||||||
{
|
|
||||||
public readonly bool HasValue = false;
|
|
||||||
public readonly Module UnityPlayer;
|
|
||||||
public readonly Module UserAssembly;
|
|
||||||
|
|
||||||
public RequiredGameModule(in Module unityPlayer, in Module userAssembly)
|
|
||||||
{
|
|
||||||
HasValue = true;
|
|
||||||
UnityPlayer = unityPlayer;
|
|
||||||
UserAssembly = userAssembly;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
// Copyright (c) DGP Studio. All rights reserved.
|
||||||
|
// Licensed under the MIT license.
|
||||||
|
|
||||||
|
namespace Snap.Hutao.Service.Game.Unlocker;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 解锁状态
|
||||||
|
/// </summary>
|
||||||
|
internal sealed class UnlockerStatus
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 状态描述
|
||||||
|
/// </summary>
|
||||||
|
public string Description { get; set; } = default!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找模块状态
|
||||||
|
/// </summary>
|
||||||
|
public FindModuleResult FindModuleState { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 当前解锁器是否有效
|
||||||
|
/// </summary>
|
||||||
|
public bool IsUnlockerValid { get; set; } = true;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// FPS 字节地址
|
||||||
|
/// </summary>
|
||||||
|
public nuint FpsAddress { get; set; }
|
||||||
|
}
|
||||||
@@ -15,7 +15,6 @@
|
|||||||
HorizontalContentAlignment="Stretch"
|
HorizontalContentAlignment="Stretch"
|
||||||
d:DataContext="{d:DesignInstance shva:AchievementViewModelSlim}"
|
d:DataContext="{d:DesignInstance shva:AchievementViewModelSlim}"
|
||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
BorderBrush="{x:Null}"
|
|
||||||
Command="{Binding NavigateCommand}"
|
Command="{Binding NavigateCommand}"
|
||||||
Style="{ThemeResource DefaultButtonStyle}"
|
Style="{ThemeResource DefaultButtonStyle}"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
HorizontalContentAlignment="Stretch"
|
HorizontalContentAlignment="Stretch"
|
||||||
d:DataContext="{d:DesignInstance shvd:DailyNoteViewModelSlim}"
|
d:DataContext="{d:DesignInstance shvd:DailyNoteViewModelSlim}"
|
||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
BorderBrush="{x:Null}"
|
|
||||||
Command="{Binding NavigateCommand}"
|
Command="{Binding NavigateCommand}"
|
||||||
Style="{ThemeResource DefaultButtonStyle}"
|
Style="{ThemeResource DefaultButtonStyle}"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
HorizontalContentAlignment="Stretch"
|
HorizontalContentAlignment="Stretch"
|
||||||
d:DataContext="{d:DesignInstance shvg:GachaLogViewModelSlim}"
|
d:DataContext="{d:DesignInstance shvg:GachaLogViewModelSlim}"
|
||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
BorderBrush="{x:Null}"
|
|
||||||
Command="{Binding NavigateCommand}"
|
Command="{Binding NavigateCommand}"
|
||||||
Style="{ThemeResource DefaultButtonStyle}"
|
Style="{ThemeResource DefaultButtonStyle}"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
VerticalContentAlignment="Stretch"
|
VerticalContentAlignment="Stretch"
|
||||||
d:DataContext="{d:DesignInstance shvg:LaunchGameViewModelSlim}"
|
d:DataContext="{d:DesignInstance shvg:LaunchGameViewModelSlim}"
|
||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
BorderBrush="{x:Null}"
|
|
||||||
Command="{Binding LaunchCommand}"
|
Command="{Binding LaunchCommand}"
|
||||||
Style="{ThemeResource DefaultButtonStyle}"
|
Style="{ThemeResource DefaultButtonStyle}"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
|
|||||||
@@ -21,12 +21,6 @@
|
|||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
|
|
||||||
<UserControl.Resources>
|
<UserControl.Resources>
|
||||||
<shvconv:BoolToGridLengthConverter x:Key="BoolToGridLengthConverter"/>
|
|
||||||
<shvconv:BoolToGridLengthConverter
|
|
||||||
x:Key="BoolToGridLengthSpacingConverter"
|
|
||||||
FalseValue="0"
|
|
||||||
TrueValue="4"/>
|
|
||||||
|
|
||||||
<shvconv:Int32ToGradientColorConverter x:Key="Int32ToGradientColorConverter" MaximumValue="{Binding GuaranteeOrangeThreshold}"/>
|
<shvconv:Int32ToGradientColorConverter x:Key="Int32ToGradientColorConverter" MaximumValue="{Binding GuaranteeOrangeThreshold}"/>
|
||||||
|
|
||||||
<DataTemplate x:Key="OrangeListTemplate" d:DataType="shvg:SummaryItem">
|
<DataTemplate x:Key="OrangeListTemplate" d:DataType="shvg:SummaryItem">
|
||||||
@@ -232,12 +226,10 @@
|
|||||||
Padding="0,12"
|
Padding="0,12"
|
||||||
Value="{x:Bind StatisticsSegmented.SelectedIndex, Mode=OneWay}">
|
Value="{x:Bind StatisticsSegmented.SelectedIndex, Mode=OneWay}">
|
||||||
<cwcont:Case Value="{shcm:Int32 Value=0}">
|
<cwcont:Case Value="{shcm:Int32 Value=0}">
|
||||||
<Grid>
|
<Grid ColumnSpacing="2">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition/>
|
<ColumnDefinition/>
|
||||||
<ColumnDefinition Width="{x:Bind ShowUpPull, Converter={StaticResource BoolToGridLengthSpacingConverter}}"/>
|
<ColumnDefinition/>
|
||||||
<ColumnDefinition Width="{x:Bind ShowUpPull, Converter={StaticResource BoolToGridLengthConverter}}"/>
|
|
||||||
<ColumnDefinition Width="4"/>
|
|
||||||
<ColumnDefinition/>
|
<ColumnDefinition/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Border Grid.Column="0" Style="{ThemeResource BorderCardStyle}">
|
<Border Grid.Column="0" Style="{ThemeResource BorderCardStyle}">
|
||||||
@@ -251,7 +243,7 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Viewbox>
|
</Viewbox>
|
||||||
</Border>
|
</Border>
|
||||||
<Border Grid.Column="2" Style="{ThemeResource BorderCardStyle}">
|
<Border Grid.Column="1" Style="{ThemeResource BorderCardStyle}">
|
||||||
<Viewbox Margin="8,0" StretchDirection="DownOnly">
|
<Viewbox Margin="8,0" StretchDirection="DownOnly">
|
||||||
<Grid>
|
<Grid>
|
||||||
<StackPanel
|
<StackPanel
|
||||||
@@ -274,7 +266,7 @@
|
|||||||
</Viewbox>
|
</Viewbox>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<Grid Grid.Column="4" RowSpacing="4">
|
<Grid Grid.Column="2" RowSpacing="2">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition/>
|
<RowDefinition/>
|
||||||
<RowDefinition/>
|
<RowDefinition/>
|
||||||
@@ -306,7 +298,7 @@
|
|||||||
<RowDefinition/>
|
<RowDefinition/>
|
||||||
<RowDefinition Height="auto"/>
|
<RowDefinition Height="auto"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Grid ColumnSpacing="4">
|
<Grid ColumnSpacing="2">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition/>
|
<ColumnDefinition/>
|
||||||
<ColumnDefinition/>
|
<ColumnDefinition/>
|
||||||
@@ -368,7 +360,7 @@
|
|||||||
|
|
||||||
</cwcont:Case>
|
</cwcont:Case>
|
||||||
<cwcont:Case Value="{shcm:Int32 Value=2}">
|
<cwcont:Case Value="{shcm:Int32 Value=2}">
|
||||||
<Grid RowSpacing="4">
|
<Grid RowSpacing="2">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition/>
|
<RowDefinition/>
|
||||||
<RowDefinition/>
|
<RowDefinition/>
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
using CommunityToolkit.WinUI.Converters;
|
|
||||||
using Microsoft.UI.Xaml;
|
|
||||||
|
|
||||||
namespace Snap.Hutao.View.Converter;
|
|
||||||
|
|
||||||
internal sealed class BoolToGridLengthConverter : BoolToObjectConverter
|
|
||||||
{
|
|
||||||
public BoolToGridLengthConverter()
|
|
||||||
{
|
|
||||||
TrueValue = new GridLength(1D, GridUnitType.Star);
|
|
||||||
FalseValue = new GridLength(0D);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -212,7 +212,7 @@
|
|||||||
LocalSettingKeySuffixForCurrent="AchievementPage.AchievementGoals"/>
|
LocalSettingKeySuffixForCurrent="AchievementPage.AchievementGoals"/>
|
||||||
<Viewbox
|
<Viewbox
|
||||||
Height="32"
|
Height="32"
|
||||||
MaxWidth="190"
|
MaxWidth="192"
|
||||||
Margin="8,0,0,0"
|
Margin="8,0,0,0"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
Stretch="Uniform"
|
Stretch="Uniform"
|
||||||
|
|||||||
@@ -43,7 +43,6 @@
|
|||||||
cw:VisualExtensions.NormalizedCenterPoint="0.5">
|
cw:VisualExtensions.NormalizedCenterPoint="0.5">
|
||||||
<cww:ConstrainedBox AspectRatio="1080:390" CornerRadius="{ThemeResource ControlCornerRadiusTop}">
|
<cww:ConstrainedBox AspectRatio="1080:390" CornerRadius="{ThemeResource ControlCornerRadiusTop}">
|
||||||
<shci:CachedImage
|
<shci:CachedImage
|
||||||
Margin="-1"
|
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
PlaceholderMargin="16"
|
PlaceholderMargin="16"
|
||||||
PlaceholderSource="{StaticResource UI_EmotionIcon271}"
|
PlaceholderSource="{StaticResource UI_EmotionIcon271}"
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:clw="using:CommunityToolkit.Labs.WinUI"
|
xmlns:clw="using:CommunityToolkit.Labs.WinUI"
|
||||||
xmlns:cw="using:CommunityToolkit.WinUI"
|
|
||||||
xmlns:cwcont="using:CommunityToolkit.WinUI.Controls"
|
xmlns:cwcont="using:CommunityToolkit.WinUI.Controls"
|
||||||
xmlns:cwconv="using:CommunityToolkit.WinUI.Converters"
|
xmlns:cwconv="using:CommunityToolkit.WinUI.Converters"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
@@ -51,248 +50,240 @@
|
|||||||
<SplitView.Pane>
|
<SplitView.Pane>
|
||||||
<ScrollViewer>
|
<ScrollViewer>
|
||||||
<StackPanel Margin="16" Spacing="3">
|
<StackPanel Margin="16" Spacing="3">
|
||||||
<Border cw:Effects.Shadow="{ThemeResource CompatCardShadow}">
|
<Border Style="{ThemeResource AcrylicBorderCardStyle}">
|
||||||
<Border Style="{ThemeResource AcrylicBorderCardStyle}">
|
<cwcont:SettingsExpander
|
||||||
<cwcont:SettingsExpander
|
Description="{Binding RuntimeOptions.Version}"
|
||||||
Description="{Binding RuntimeOptions.Version}"
|
Header="{shcm:ResourceString Name=AppName}"
|
||||||
Header="{shcm:ResourceString Name=AppName}"
|
HeaderIcon="{shcm:FontIcon Glyph=}"
|
||||||
HeaderIcon="{shcm:FontIcon Glyph=}"
|
IsExpanded="True">
|
||||||
IsExpanded="True">
|
<cwcont:SettingsExpander.Items>
|
||||||
<cwcont:SettingsExpander.Items>
|
<cwcont:SettingsCard
|
||||||
<cwcont:SettingsCard
|
ActionIcon="{shcm:FontIcon Glyph=}"
|
||||||
ActionIcon="{shcm:FontIcon Glyph=}"
|
ActionIconToolTip="{shcm:ResourceString Name=ViewPageSettingCopyDeviceIdAction}"
|
||||||
ActionIconToolTip="{shcm:ResourceString Name=ViewPageSettingCopyDeviceIdAction}"
|
Command="{Binding CopyDeviceIdCommand}"
|
||||||
Command="{Binding CopyDeviceIdCommand}"
|
Description="{Binding RuntimeOptions.DeviceId}"
|
||||||
Description="{Binding RuntimeOptions.DeviceId}"
|
Header="{shcm:ResourceString Name=ViewPageSettingDeviceIdHeader}"
|
||||||
Header="{shcm:ResourceString Name=ViewPageSettingDeviceIdHeader}"
|
IsClickEnabled="True"/>
|
||||||
IsClickEnabled="True"/>
|
<cwcont:SettingsCard Description="{Binding IPInformation}" Header="{shcm:ResourceString Name=ViewPageSettingDeviceIpHeader}"/>
|
||||||
<cwcont:SettingsCard Description="{Binding IPInformation}" Header="{shcm:ResourceString Name=ViewPageSettingDeviceIpHeader}"/>
|
<cwcont:SettingsCard Description="{Binding DynamicHttpProxy.CurrentProxyUri}" Header="{shcm:ResourceString Name=ViewPageFeedbackCurrentProxyHeader}"/>
|
||||||
<cwcont:SettingsCard Description="{Binding DynamicHttpProxy.CurrentProxyUri}" Header="{shcm:ResourceString Name=ViewPageFeedbackCurrentProxyHeader}"/>
|
<cwcont:SettingsCard
|
||||||
<cwcont:SettingsCard
|
Command="{Binding EnableLoopbackCommand}"
|
||||||
Command="{Binding EnableLoopbackCommand}"
|
Header="{shcm:ResourceString Name=ViewPageFeedbackEnableLoopbackHeader}"
|
||||||
Header="{shcm:ResourceString Name=ViewPageFeedbackEnableLoopbackHeader}"
|
IsClickEnabled="True"
|
||||||
IsClickEnabled="True"
|
IsEnabled="{Binding LoopbackManager.IsLoopbackEnabled, Converter={StaticResource BoolNegationConverter}, Mode=OneWay}">
|
||||||
IsEnabled="{Binding LoopbackManager.IsLoopbackEnabled, Converter={StaticResource BoolNegationConverter}, Mode=OneWay}">
|
<cwcont:SettingsCard.Description>
|
||||||
<cwcont:SettingsCard.Description>
|
<UserControl Content="{Binding LoopbackManager.IsLoopbackEnabled, Converter={StaticResource BoolToLoopbackDescriptionControlConverter}, Mode=OneWay}"/>
|
||||||
<UserControl Content="{Binding LoopbackManager.IsLoopbackEnabled, Converter={StaticResource BoolToLoopbackDescriptionControlConverter}, Mode=OneWay}"/>
|
</cwcont:SettingsCard.Description>
|
||||||
</cwcont:SettingsCard.Description>
|
</cwcont:SettingsCard>
|
||||||
</cwcont:SettingsCard>
|
<cwcont:SettingsCard Description="{Binding RuntimeOptions.WebView2Version}" Header="{shcm:ResourceString Name=ViewPageSettingWebview2Header}"/>
|
||||||
<cwcont:SettingsCard Description="{Binding RuntimeOptions.WebView2Version}" Header="{shcm:ResourceString Name=ViewPageSettingWebview2Header}"/>
|
</cwcont:SettingsExpander.Items>
|
||||||
</cwcont:SettingsExpander.Items>
|
</cwcont:SettingsExpander>
|
||||||
</cwcont:SettingsExpander>
|
|
||||||
</Border>
|
|
||||||
</Border>
|
</Border>
|
||||||
<Border cw:Effects.Shadow="{ThemeResource CompatCardShadow}">
|
<Border Style="{ThemeResource AcrylicBorderCardStyle}">
|
||||||
<Border Style="{ThemeResource AcrylicBorderCardStyle}">
|
<cwcont:SettingsExpander
|
||||||
<cwcont:SettingsExpander
|
Description="{shcm:ResourceString Name=ViewPageFeedbackEngageWithUsDescription}"
|
||||||
Description="{shcm:ResourceString Name=ViewPageFeedbackEngageWithUsDescription}"
|
Header="{shcm:ResourceString Name=ViewPageFeedbackCommonLinksHeader}"
|
||||||
Header="{shcm:ResourceString Name=ViewPageFeedbackCommonLinksHeader}"
|
HeaderIcon="{shcm:FontIcon Glyph=}"
|
||||||
HeaderIcon="{shcm:FontIcon Glyph=}"
|
IsExpanded="True">
|
||||||
IsExpanded="True">
|
<cwcont:SettingsExpander.Items>
|
||||||
<cwcont:SettingsExpander.Items>
|
<cwcont:SettingsCard
|
||||||
<cwcont:SettingsCard
|
Command="{Binding NavigateToUriCommand}"
|
||||||
Command="{Binding NavigateToUriCommand}"
|
CommandParameter="https://github.com/DGP-Studio/Snap.Hutao/issues/new/choose"
|
||||||
CommandParameter="https://github.com/DGP-Studio/Snap.Hutao/issues/new/choose"
|
Description="{shcm:ResourceString Name=ViewPageFeedbackGithubIssuesDescription}"
|
||||||
Description="{shcm:ResourceString Name=ViewPageFeedbackGithubIssuesDescription}"
|
Header="GitHub Issues"
|
||||||
Header="GitHub Issues"
|
IsClickEnabled="True"/>
|
||||||
IsClickEnabled="True"/>
|
<cwcont:SettingsCard
|
||||||
<cwcont:SettingsCard
|
Command="{Binding NavigateToUriCommand}"
|
||||||
Command="{Binding NavigateToUriCommand}"
|
CommandParameter="https://github.com/orgs/DGP-Studio/projects/2"
|
||||||
CommandParameter="https://github.com/orgs/DGP-Studio/projects/2"
|
Description="{shcm:ResourceString Name=ViewPageFeedbackRoadmapDescription}"
|
||||||
Description="{shcm:ResourceString Name=ViewPageFeedbackRoadmapDescription}"
|
Header="GitHub Projects"
|
||||||
Header="GitHub Projects"
|
IsClickEnabled="True"/>
|
||||||
IsClickEnabled="True"/>
|
<cwcont:SettingsCard
|
||||||
<cwcont:SettingsCard
|
Command="{Binding NavigateToUriCommand}"
|
||||||
Command="{Binding NavigateToUriCommand}"
|
CommandParameter="https://status.hut.ao"
|
||||||
CommandParameter="https://status.hut.ao"
|
Description="{shcm:ResourceString Name=ViewPageFeedbackServerStatusDescription}"
|
||||||
Description="{shcm:ResourceString Name=ViewPageFeedbackServerStatusDescription}"
|
Header="{shcm:ResourceString Name=ViewPageFeedbackServerStatusHeader}"
|
||||||
Header="{shcm:ResourceString Name=ViewPageFeedbackServerStatusHeader}"
|
IsClickEnabled="True"/>
|
||||||
IsClickEnabled="True"/>
|
</cwcont:SettingsExpander.Items>
|
||||||
</cwcont:SettingsExpander.Items>
|
</cwcont:SettingsExpander>
|
||||||
</cwcont:SettingsExpander>
|
|
||||||
</Border>
|
|
||||||
</Border>
|
</Border>
|
||||||
<Border cw:Effects.Shadow="{ThemeResource CompatCardShadow}">
|
<Border Style="{ThemeResource AcrylicBorderCardStyle}">
|
||||||
<Border Style="{ThemeResource AcrylicBorderCardStyle}">
|
<cwcont:SettingsExpander
|
||||||
<cwcont:SettingsExpander
|
Header="{shcm:ResourceString Name=ViewPageFeedbackFeatureGuideHeader}"
|
||||||
Header="{shcm:ResourceString Name=ViewPageFeedbackFeatureGuideHeader}"
|
HeaderIcon="{shcm:FontIcon Glyph=}"
|
||||||
HeaderIcon="{shcm:FontIcon Glyph=}"
|
IsExpanded="True">
|
||||||
IsExpanded="True">
|
<cwcont:SettingsExpander.Items>
|
||||||
<cwcont:SettingsExpander.Items>
|
<cwcont:SettingsCard
|
||||||
<cwcont:SettingsCard
|
Padding="{ThemeResource SettingsExpanderItemHasIconPadding}"
|
||||||
Padding="{ThemeResource SettingsExpanderItemHasIconPadding}"
|
Command="{Binding NavigateToUriCommand}"
|
||||||
Command="{Binding NavigateToUriCommand}"
|
CommandParameter="https://hut.ao/features/dashboard.html"
|
||||||
CommandParameter="https://hut.ao/features/dashboard.html"
|
Header="{shcm:ResourceString Name=ViewAnnouncementHeader}"
|
||||||
Header="{shcm:ResourceString Name=ViewAnnouncementHeader}"
|
HeaderIcon="{shcm:BitmapIcon Source=ms-appx:///Resource/Navigation/Announcement.png}"
|
||||||
HeaderIcon="{shcm:BitmapIcon Source=ms-appx:///Resource/Navigation/Announcement.png}"
|
IsClickEnabled="True"/>
|
||||||
IsClickEnabled="True"/>
|
<cwcont:SettingsCard
|
||||||
<cwcont:SettingsCard
|
Padding="{ThemeResource SettingsExpanderItemHasIconPadding}"
|
||||||
Padding="{ThemeResource SettingsExpanderItemHasIconPadding}"
|
Command="{Binding NavigateToUriCommand}"
|
||||||
Command="{Binding NavigateToUriCommand}"
|
CommandParameter="https://hut.ao/features/game-launcher.html"
|
||||||
CommandParameter="https://hut.ao/features/game-launcher.html"
|
Header="{shcm:ResourceString Name=ViewLaunchGameHeader}"
|
||||||
Header="{shcm:ResourceString Name=ViewLaunchGameHeader}"
|
IsClickEnabled="True">
|
||||||
IsClickEnabled="True">
|
<cwcont:SettingsCard.HeaderIcon>
|
||||||
<cwcont:SettingsCard.HeaderIcon>
|
<!-- This icon is not a square -->
|
||||||
<!-- This icon is not a square -->
|
<BitmapIcon
|
||||||
<BitmapIcon
|
Width="24"
|
||||||
Width="24"
|
Height="24"
|
||||||
Height="24"
|
ShowAsMonochrome="False"
|
||||||
ShowAsMonochrome="False"
|
UriSource="ms-appx:///Resource/Navigation/LaunchGame.png"/>
|
||||||
UriSource="ms-appx:///Resource/Navigation/LaunchGame.png"/>
|
</cwcont:SettingsCard.HeaderIcon>
|
||||||
</cwcont:SettingsCard.HeaderIcon>
|
</cwcont:SettingsCard>
|
||||||
</cwcont:SettingsCard>
|
<cwcont:SettingsCard
|
||||||
<cwcont:SettingsCard
|
Padding="{ThemeResource SettingsExpanderItemHasIconPadding}"
|
||||||
Padding="{ThemeResource SettingsExpanderItemHasIconPadding}"
|
Command="{Binding NavigateToUriCommand}"
|
||||||
Command="{Binding NavigateToUriCommand}"
|
CommandParameter="https://hut.ao/features/wish-export.html"
|
||||||
CommandParameter="https://hut.ao/features/wish-export.html"
|
Header="{shcm:ResourceString Name=ViewGachaLogHeader}"
|
||||||
Header="{shcm:ResourceString Name=ViewGachaLogHeader}"
|
HeaderIcon="{shcm:BitmapIcon Source=ms-appx:///Resource/Navigation/GachaLog.png}"
|
||||||
HeaderIcon="{shcm:BitmapIcon Source=ms-appx:///Resource/Navigation/GachaLog.png}"
|
IsClickEnabled="True"/>
|
||||||
IsClickEnabled="True"/>
|
<cwcont:SettingsCard
|
||||||
<cwcont:SettingsCard
|
Padding="{ThemeResource SettingsExpanderItemHasIconPadding}"
|
||||||
Padding="{ThemeResource SettingsExpanderItemHasIconPadding}"
|
Command="{Binding NavigateToUriCommand}"
|
||||||
Command="{Binding NavigateToUriCommand}"
|
CommandParameter="https://hut.ao/features/achievements.html"
|
||||||
CommandParameter="https://hut.ao/features/achievements.html"
|
Header="{shcm:ResourceString Name=ViewAchievementHeader}"
|
||||||
Header="{shcm:ResourceString Name=ViewAchievementHeader}"
|
HeaderIcon="{shcm:BitmapIcon Source=ms-appx:///Resource/Navigation/Achievement.png}"
|
||||||
HeaderIcon="{shcm:BitmapIcon Source=ms-appx:///Resource/Navigation/Achievement.png}"
|
IsClickEnabled="True"/>
|
||||||
IsClickEnabled="True"/>
|
<cwcont:SettingsCard
|
||||||
<cwcont:SettingsCard
|
Padding="{ThemeResource SettingsExpanderItemHasIconPadding}"
|
||||||
Padding="{ThemeResource SettingsExpanderItemHasIconPadding}"
|
Command="{Binding NavigateToUriCommand}"
|
||||||
Command="{Binding NavigateToUriCommand}"
|
CommandParameter="https://hut.ao/features/real-time-notes.html"
|
||||||
CommandParameter="https://hut.ao/features/real-time-notes.html"
|
Header="{shcm:ResourceString Name=ViewDailyNoteHeader}"
|
||||||
Header="{shcm:ResourceString Name=ViewDailyNoteHeader}"
|
HeaderIcon="{shcm:BitmapIcon Source=ms-appx:///Resource/Navigation/DailyNote.png}"
|
||||||
HeaderIcon="{shcm:BitmapIcon Source=ms-appx:///Resource/Navigation/DailyNote.png}"
|
IsClickEnabled="True"/>
|
||||||
IsClickEnabled="True"/>
|
<cwcont:SettingsCard
|
||||||
<cwcont:SettingsCard
|
Padding="{ThemeResource SettingsExpanderItemHasIconPadding}"
|
||||||
Padding="{ThemeResource SettingsExpanderItemHasIconPadding}"
|
Command="{Binding NavigateToUriCommand}"
|
||||||
Command="{Binding NavigateToUriCommand}"
|
CommandParameter="https://hut.ao/features/character-data.html"
|
||||||
CommandParameter="https://hut.ao/features/character-data.html"
|
Header="{shcm:ResourceString Name=ViewAvatarPropertyHeader}"
|
||||||
Header="{shcm:ResourceString Name=ViewAvatarPropertyHeader}"
|
HeaderIcon="{shcm:BitmapIcon Source=ms-appx:///Resource/Navigation/AvatarProperty.png}"
|
||||||
HeaderIcon="{shcm:BitmapIcon Source=ms-appx:///Resource/Navigation/AvatarProperty.png}"
|
IsClickEnabled="True"/>
|
||||||
IsClickEnabled="True"/>
|
<cwcont:SettingsCard
|
||||||
<cwcont:SettingsCard
|
Padding="{ThemeResource SettingsExpanderItemHasIconPadding}"
|
||||||
Padding="{ThemeResource SettingsExpanderItemHasIconPadding}"
|
Command="{Binding NavigateToUriCommand}"
|
||||||
Command="{Binding NavigateToUriCommand}"
|
CommandParameter="https://hut.ao/features/hutao-API.html"
|
||||||
CommandParameter="https://hut.ao/features/hutao-API.html"
|
Header="{shcm:ResourceString Name=ViewSpiralAbyssHeader}"
|
||||||
Header="{shcm:ResourceString Name=ViewSpiralAbyssHeader}"
|
HeaderIcon="{shcm:BitmapIcon Source=ms-appx:///Resource/Navigation/SpiralAbyss.png}"
|
||||||
HeaderIcon="{shcm:BitmapIcon Source=ms-appx:///Resource/Navigation/SpiralAbyss.png}"
|
IsClickEnabled="True"/>
|
||||||
IsClickEnabled="True"/>
|
<cwcont:SettingsCard
|
||||||
<cwcont:SettingsCard
|
Padding="{ThemeResource SettingsExpanderItemHasIconPadding}"
|
||||||
Padding="{ThemeResource SettingsExpanderItemHasIconPadding}"
|
Command="{Binding NavigateToUriCommand}"
|
||||||
Command="{Binding NavigateToUriCommand}"
|
CommandParameter="https://hut.ao/features/develop-plan.html"
|
||||||
CommandParameter="https://hut.ao/features/develop-plan.html"
|
Header="{shcm:ResourceString Name=ViewCultivationHeader}"
|
||||||
Header="{shcm:ResourceString Name=ViewCultivationHeader}"
|
HeaderIcon="{shcm:BitmapIcon Source=ms-appx:///Resource/Navigation/Cultivation.png}"
|
||||||
HeaderIcon="{shcm:BitmapIcon Source=ms-appx:///Resource/Navigation/Cultivation.png}"
|
IsClickEnabled="True"/>
|
||||||
IsClickEnabled="True"/>
|
<cwcont:SettingsCard
|
||||||
<cwcont:SettingsCard
|
Padding="{ThemeResource SettingsExpanderItemHasIconPadding}"
|
||||||
Padding="{ThemeResource SettingsExpanderItemHasIconPadding}"
|
Command="{Binding NavigateToUriCommand}"
|
||||||
Command="{Binding NavigateToUriCommand}"
|
CommandParameter="https://hut.ao/features/character-wiki.html"
|
||||||
CommandParameter="https://hut.ao/features/character-wiki.html"
|
Header="{shcm:ResourceString Name=ViewWikiAvatarHeader}"
|
||||||
Header="{shcm:ResourceString Name=ViewWikiAvatarHeader}"
|
HeaderIcon="{shcm:BitmapIcon Source=ms-appx:///Resource/Navigation/WikiAvatar.png}"
|
||||||
HeaderIcon="{shcm:BitmapIcon Source=ms-appx:///Resource/Navigation/WikiAvatar.png}"
|
IsClickEnabled="True"/>
|
||||||
IsClickEnabled="True"/>
|
<cwcont:SettingsCard
|
||||||
<cwcont:SettingsCard
|
Padding="{ThemeResource SettingsExpanderItemHasIconPadding}"
|
||||||
Padding="{ThemeResource SettingsExpanderItemHasIconPadding}"
|
Command="{Binding NavigateToUriCommand}"
|
||||||
Command="{Binding NavigateToUriCommand}"
|
CommandParameter="https://hut.ao/features/weapon-wiki.html"
|
||||||
CommandParameter="https://hut.ao/features/weapon-wiki.html"
|
Header="{shcm:ResourceString Name=ViewWikiWeaponHeader}"
|
||||||
Header="{shcm:ResourceString Name=ViewWikiWeaponHeader}"
|
HeaderIcon="{shcm:BitmapIcon Source=ms-appx:///Resource/Navigation/WikiWeapon.png}"
|
||||||
HeaderIcon="{shcm:BitmapIcon Source=ms-appx:///Resource/Navigation/WikiWeapon.png}"
|
IsClickEnabled="True"/>
|
||||||
IsClickEnabled="True"/>
|
<cwcont:SettingsCard
|
||||||
<cwcont:SettingsCard
|
Padding="{ThemeResource SettingsExpanderItemHasIconPadding}"
|
||||||
Padding="{ThemeResource SettingsExpanderItemHasIconPadding}"
|
Command="{Binding NavigateToUriCommand}"
|
||||||
Command="{Binding NavigateToUriCommand}"
|
CommandParameter="https://hut.ao/features/monster-wiki.html"
|
||||||
CommandParameter="https://hut.ao/features/monster-wiki.html"
|
Header="{shcm:ResourceString Name=ViewWikiMonsterHeader}"
|
||||||
Header="{shcm:ResourceString Name=ViewWikiMonsterHeader}"
|
HeaderIcon="{shcm:BitmapIcon Source=ms-appx:///Resource/Navigation/WikiMonster.png}"
|
||||||
HeaderIcon="{shcm:BitmapIcon Source=ms-appx:///Resource/Navigation/WikiMonster.png}"
|
IsClickEnabled="True"/>
|
||||||
IsClickEnabled="True"/>
|
<cwcont:SettingsCard
|
||||||
<cwcont:SettingsCard
|
Padding="{ThemeResource SettingsExpanderItemHasIconPadding}"
|
||||||
Padding="{ThemeResource SettingsExpanderItemHasIconPadding}"
|
Command="{Binding NavigateToUriCommand}"
|
||||||
Command="{Binding NavigateToUriCommand}"
|
CommandParameter="https://hut.ao/features/hutao-settings.html"
|
||||||
CommandParameter="https://hut.ao/features/hutao-settings.html"
|
Header="{shcm:ResourceString Name=ViewSettingHeader}"
|
||||||
Header="{shcm:ResourceString Name=ViewSettingHeader}"
|
HeaderIcon="{shcm:FontIcon Glyph=}"
|
||||||
HeaderIcon="{shcm:FontIcon Glyph=}"
|
IsClickEnabled="True"/>
|
||||||
IsClickEnabled="True"/>
|
</cwcont:SettingsExpander.Items>
|
||||||
</cwcont:SettingsExpander.Items>
|
</cwcont:SettingsExpander>
|
||||||
</cwcont:SettingsExpander>
|
|
||||||
</Border>
|
|
||||||
</Border>
|
</Border>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
</SplitView.Pane>
|
</SplitView.Pane>
|
||||||
<Border Margin="16,16,0,16" cw:Effects.Shadow="{ThemeResource CompatCardShadow}">
|
<Grid Margin="16,16,0,16" Style="{ThemeResource AcrylicGridCardStyle}">
|
||||||
<Grid Style="{ThemeResource AcrylicGridCardStyle}">
|
<Grid
|
||||||
<Grid
|
Padding="16"
|
||||||
Padding="16"
|
RowSpacing="8"
|
||||||
RowSpacing="8"
|
Visibility="{Binding IsInitialized, Converter={StaticResource BoolToVisibilityConverter}, Mode=OneWay}">
|
||||||
Visibility="{Binding IsInitialized, Converter={StaticResource BoolToVisibilityConverter}, Mode=OneWay}">
|
<Grid.RowDefinitions>
|
||||||
<Grid.RowDefinitions>
|
<RowDefinition Height="auto"/>
|
||||||
<RowDefinition Height="auto"/>
|
<RowDefinition/>
|
||||||
<RowDefinition/>
|
</Grid.RowDefinitions>
|
||||||
</Grid.RowDefinitions>
|
<AutoSuggestBox
|
||||||
<AutoSuggestBox
|
Grid.Row="0"
|
||||||
Grid.Row="0"
|
Height="36"
|
||||||
Height="36"
|
Margin="0,0,0,8"
|
||||||
Margin="0,0,0,8"
|
HorizontalAlignment="Stretch"
|
||||||
HorizontalAlignment="Stretch"
|
VerticalContentAlignment="Center"
|
||||||
VerticalContentAlignment="Center"
|
PlaceholderText="{shcm:ResourceString Name=ViewPageFeedbackAutoSuggestBoxPlaceholder}"
|
||||||
PlaceholderText="{shcm:ResourceString Name=ViewPageFeedbackAutoSuggestBoxPlaceholder}"
|
QueryIcon="{shcm:FontIcon Glyph=}"
|
||||||
QueryIcon="{shcm:FontIcon Glyph=}"
|
Style="{StaticResource DefaultAutoSuggestBoxStyle}"
|
||||||
Style="{StaticResource DefaultAutoSuggestBoxStyle}"
|
Text="{Binding SearchText, Mode=TwoWay}">
|
||||||
Text="{Binding SearchText, Mode=TwoWay}">
|
<mxi:Interaction.Behaviors>
|
||||||
<mxi:Interaction.Behaviors>
|
<mxic:EventTriggerBehavior EventName="QuerySubmitted">
|
||||||
<mxic:EventTriggerBehavior EventName="QuerySubmitted">
|
<mxic:InvokeCommandAction Command="{Binding SearchDocumentCommand}" CommandParameter="{Binding SearchText}"/>
|
||||||
<mxic:InvokeCommandAction Command="{Binding SearchDocumentCommand}" CommandParameter="{Binding SearchText}"/>
|
</mxic:EventTriggerBehavior>
|
||||||
</mxic:EventTriggerBehavior>
|
</mxi:Interaction.Behaviors>
|
||||||
</mxi:Interaction.Behaviors>
|
</AutoSuggestBox>
|
||||||
</AutoSuggestBox>
|
<StackPanel
|
||||||
<StackPanel
|
Grid.Row="1"
|
||||||
Grid.Row="1"
|
VerticalAlignment="Center"
|
||||||
VerticalAlignment="Center"
|
Visibility="{Binding SearchResults.Count, Converter={StaticResource Int32ToVisibilityRevertConverter}}">
|
||||||
Visibility="{Binding SearchResults.Count, Converter={StaticResource Int32ToVisibilityRevertConverter}}">
|
<shci:CachedImage
|
||||||
<shci:CachedImage
|
Height="120"
|
||||||
Height="120"
|
MinWidth="{ThemeResource SettingsCardContentControlMinWidth}"
|
||||||
MinWidth="{ThemeResource SettingsCardContentControlMinWidth}"
|
EnableLazyLoading="False"
|
||||||
EnableLazyLoading="False"
|
Source="{StaticResource UI_EmotionIcon52}"/>
|
||||||
Source="{StaticResource UI_EmotionIcon52}"/>
|
<TextBlock
|
||||||
<TextBlock
|
Margin="0,5,0,21"
|
||||||
Margin="0,5,0,21"
|
HorizontalAlignment="Center"
|
||||||
HorizontalAlignment="Center"
|
Style="{StaticResource SubtitleTextBlockStyle}"
|
||||||
Style="{StaticResource SubtitleTextBlockStyle}"
|
Text="{shcm:ResourceString Name=ViewPageFeedbackSearchResultPlaceholderTitle}"/>
|
||||||
Text="{shcm:ResourceString Name=ViewPageFeedbackSearchResultPlaceholderTitle}"/>
|
</StackPanel>
|
||||||
</StackPanel>
|
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Hidden">
|
||||||
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Hidden">
|
<ItemsControl
|
||||||
<ItemsControl
|
ItemContainerTransitions="{ThemeResource ListViewLikeThemeTransitions}"
|
||||||
ItemContainerTransitions="{ThemeResource ListViewLikeThemeTransitions}"
|
ItemsPanel="{ThemeResource StackPanelSpacing8Template}"
|
||||||
ItemsPanel="{ThemeResource StackPanelSpacing8Template}"
|
ItemsSource="{Binding SearchResults}">
|
||||||
ItemsSource="{Binding SearchResults}">
|
<ItemsControl.ItemTemplate>
|
||||||
<ItemsControl.ItemTemplate>
|
<DataTemplate>
|
||||||
<DataTemplate>
|
<Border Style="{ThemeResource BorderCardStyle}">
|
||||||
<Border Style="{ThemeResource BorderCardStyle}">
|
<HyperlinkButton
|
||||||
<HyperlinkButton
|
HorizontalAlignment="Stretch"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalContentAlignment="Stretch"
|
||||||
HorizontalContentAlignment="Stretch"
|
NavigateUri="{Binding Url}">
|
||||||
NavigateUri="{Binding Url}">
|
<Grid>
|
||||||
<Grid>
|
<Grid.ColumnDefinitions>
|
||||||
<Grid.ColumnDefinitions>
|
<ColumnDefinition/>
|
||||||
<ColumnDefinition/>
|
<ColumnDefinition Width="auto"/>
|
||||||
<ColumnDefinition Width="auto"/>
|
</Grid.ColumnDefinitions>
|
||||||
</Grid.ColumnDefinitions>
|
<BreadcrumbBar
|
||||||
<BreadcrumbBar
|
Grid.Column="0"
|
||||||
Grid.Column="0"
|
Margin="4,8,8,4"
|
||||||
Margin="4,8,8,4"
|
IsHitTestVisible="False"
|
||||||
IsHitTestVisible="False"
|
ItemsSource="{Binding Hierarchy.DisplayLevels}"/>
|
||||||
ItemsSource="{Binding Hierarchy.DisplayLevels}"/>
|
</Grid>
|
||||||
</Grid>
|
</HyperlinkButton>
|
||||||
</HyperlinkButton>
|
</Border>
|
||||||
</Border>
|
</DataTemplate>
|
||||||
</DataTemplate>
|
</ItemsControl.ItemTemplate>
|
||||||
</ItemsControl.ItemTemplate>
|
</ItemsControl>
|
||||||
</ItemsControl>
|
</ScrollViewer>
|
||||||
</ScrollViewer>
|
|
||||||
</Grid>
|
|
||||||
|
|
||||||
<clw:Shimmer IsActive="{Binding IsInitialized, Converter={StaticResource BoolNegationConverter}, Mode=OneWay}" Visibility="{Binding IsInitialized, Converter={StaticResource BoolToVisibilityRevertConverter}, Mode=OneWay}"/>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
|
||||||
|
<clw:Shimmer IsActive="{Binding IsInitialized, Converter={StaticResource BoolNegationConverter}, Mode=OneWay}" Visibility="{Binding IsInitialized, Converter={StaticResource BoolToVisibilityRevertConverter}, Mode=OneWay}"/>
|
||||||
|
</Grid>
|
||||||
</SplitView>
|
</SplitView>
|
||||||
</Grid>
|
</Grid>
|
||||||
</shc:ScopedPage>
|
</shc:ScopedPage>
|
||||||
@@ -12,7 +12,6 @@
|
|||||||
xmlns:shcb="using:Snap.Hutao.Control.Behavior"
|
xmlns:shcb="using:Snap.Hutao.Control.Behavior"
|
||||||
xmlns:shci="using:Snap.Hutao.Control.Image"
|
xmlns:shci="using:Snap.Hutao.Control.Image"
|
||||||
xmlns:shcm="using:Snap.Hutao.Control.Markup"
|
xmlns:shcm="using:Snap.Hutao.Control.Markup"
|
||||||
xmlns:shcp="using:Snap.Hutao.Control.Panel"
|
|
||||||
xmlns:shvc="using:Snap.Hutao.View.Control"
|
xmlns:shvc="using:Snap.Hutao.View.Control"
|
||||||
xmlns:shvg="using:Snap.Hutao.ViewModel.GachaLog"
|
xmlns:shvg="using:Snap.Hutao.ViewModel.GachaLog"
|
||||||
d:DataContext="{d:DesignInstance shvg:GachaLogViewModel}"
|
d:DataContext="{d:DesignInstance shvg:GachaLogViewModel}"
|
||||||
@@ -143,8 +142,8 @@
|
|||||||
<Border Width="40" Style="{StaticResource BorderCardStyle}">
|
<Border Width="40" Style="{StaticResource BorderCardStyle}">
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<shvc:ItemIcon
|
<shvc:ItemIcon
|
||||||
Width="38"
|
Width="40"
|
||||||
Height="38"
|
Height="40"
|
||||||
Icon="{Binding Icon}"
|
Icon="{Binding Icon}"
|
||||||
Quality="{Binding Quality}"/>
|
Quality="{Binding Quality}"/>
|
||||||
<TextBlock
|
<TextBlock
|
||||||
@@ -183,19 +182,17 @@
|
|||||||
Text="{Binding TotalCountFormatted}"/>
|
Text="{Binding TotalCountFormatted}"/>
|
||||||
<ItemsControl
|
<ItemsControl
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
MaxWidth="124"
|
|
||||||
Margin="0,6,0,0"
|
Margin="0,6,0,0"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
ItemTemplate="{StaticResource HistoryWishItemTemplate}"
|
ItemTemplate="{StaticResource HistoryWishItemTemplate}"
|
||||||
ItemsPanel="{StaticResource WrapPanelSpacing2Template}"
|
ItemsPanel="{StaticResource HorizontalStackPanelSpacing2Template}"
|
||||||
ItemsSource="{Binding OrangeUpList}"/>
|
ItemsSource="{Binding OrangeUpList}"/>
|
||||||
<ItemsControl
|
<ItemsControl
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
MaxWidth="252"
|
|
||||||
Margin="0,6,0,0"
|
Margin="0,6,0,0"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
ItemTemplate="{StaticResource HistoryWishItemTemplate}"
|
ItemTemplate="{StaticResource HistoryWishItemTemplate}"
|
||||||
ItemsPanel="{StaticResource WrapPanelSpacing2Template}"
|
ItemsPanel="{StaticResource HorizontalStackPanelSpacing2Template}"
|
||||||
ItemsSource="{Binding PurpleUpList}"/>
|
ItemsSource="{Binding PurpleUpList}"/>
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Grid.Row="2"
|
Grid.Row="2"
|
||||||
@@ -288,21 +285,26 @@
|
|||||||
</CommandBar>
|
</CommandBar>
|
||||||
</Pivot.RightHeader>
|
</Pivot.RightHeader>
|
||||||
<PivotItem Header="{shcm:ResourceString Name=ViewPageGahcaLogPivotOverview}">
|
<PivotItem Header="{shcm:ResourceString Name=ViewPageGahcaLogPivotOverview}">
|
||||||
<ScrollViewer
|
<Grid Margin="0,0,16,0">
|
||||||
Margin="16,0"
|
<Grid.ColumnDefinitions>
|
||||||
HorizontalScrollBarVisibility="Auto"
|
<ColumnDefinition/>
|
||||||
HorizontalScrollMode="Enabled"
|
<ColumnDefinition/>
|
||||||
VerticalScrollMode="Disabled">
|
<ColumnDefinition/>
|
||||||
<shcp:HorizontalEqualPanel
|
</Grid.ColumnDefinitions>
|
||||||
Margin="0,16"
|
<shvc:StatisticsCard
|
||||||
MinItemWidth="302"
|
Grid.Column="0"
|
||||||
Spacing="16">
|
Margin="16,16,0,16"
|
||||||
<shvc:StatisticsCard DataContext="{Binding Statistics.AvatarWish}"/>
|
DataContext="{Binding Statistics.AvatarWish}"/>
|
||||||
<shvc:StatisticsCard DataContext="{Binding Statistics.WeaponWish}"/>
|
<shvc:StatisticsCard
|
||||||
<shvc:StatisticsCard DataContext="{Binding Statistics.StandardWish}" ShowUpPull="False"/>
|
Grid.Column="1"
|
||||||
<shvc:StatisticsCard DataContext="{Binding Statistics.ChronicledWish}" ShowUpPull="False"/>
|
Margin="16,16,0,16"
|
||||||
</shcp:HorizontalEqualPanel>
|
DataContext="{Binding Statistics.WeaponWish}"/>
|
||||||
</ScrollViewer>
|
<shvc:StatisticsCard
|
||||||
|
Grid.Column="2"
|
||||||
|
Margin="16,16,0,16"
|
||||||
|
DataContext="{Binding Statistics.StandardWish}"
|
||||||
|
ShowUpPull="False"/>
|
||||||
|
</Grid>
|
||||||
</PivotItem>
|
</PivotItem>
|
||||||
<PivotItem Header="{shcm:ResourceString Name=ViewPageGahcaLogPivotHistory}">
|
<PivotItem Header="{shcm:ResourceString Name=ViewPageGahcaLogPivotHistory}">
|
||||||
<Border Margin="16" cw:Effects.Shadow="{ThemeResource CompatCardShadow}">
|
<Border Margin="16" cw:Effects.Shadow="{ThemeResource CompatCardShadow}">
|
||||||
@@ -310,7 +312,7 @@
|
|||||||
<SplitView
|
<SplitView
|
||||||
DisplayMode="Inline"
|
DisplayMode="Inline"
|
||||||
IsPaneOpen="True"
|
IsPaneOpen="True"
|
||||||
OpenPaneLength="408"
|
OpenPaneLength="323"
|
||||||
PaneBackground="{ThemeResource CardBackgroundFillColorSecondaryBrush}">
|
PaneBackground="{ThemeResource CardBackgroundFillColorSecondaryBrush}">
|
||||||
<SplitView.Pane>
|
<SplitView.Pane>
|
||||||
<ListView
|
<ListView
|
||||||
@@ -377,6 +379,7 @@
|
|||||||
</SplitView>
|
</SplitView>
|
||||||
</Border>
|
</Border>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
</PivotItem>
|
</PivotItem>
|
||||||
<PivotItem Header="{shcm:ResourceString Name=ViewPageGahcaLogPivotAvatar}">
|
<PivotItem Header="{shcm:ResourceString Name=ViewPageGahcaLogPivotAvatar}">
|
||||||
<ScrollViewer>
|
<ScrollViewer>
|
||||||
@@ -484,6 +487,7 @@
|
|||||||
<shvc:HutaoStatisticsCard Grid.Column="2" DataContext="{Binding HutaoCloudStatisticsViewModel.Statistics.WeaponEvent}"/>
|
<shvc:HutaoStatisticsCard Grid.Column="2" DataContext="{Binding HutaoCloudStatisticsViewModel.Statistics.WeaponEvent}"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
</PivotItem>
|
</PivotItem>
|
||||||
</Pivot>
|
</Pivot>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -348,7 +348,6 @@
|
|||||||
</mxic:EventTriggerBehavior>
|
</mxic:EventTriggerBehavior>
|
||||||
</mxi:Interaction.Behaviors>
|
</mxi:Interaction.Behaviors>
|
||||||
</cwc:SettingsCard>
|
</cwc:SettingsCard>
|
||||||
<cwc:SettingsCard Header="{shcm:ResourceString Name=ViewPageSettingBackgroundImageLocalFolderCopyrightHeader}" Visibility="{Binding BackgroundImageOptions.Wallpaper, Converter={StaticResource EmptyObjectToBoolRevertConverter}}"/>
|
|
||||||
</cwc:SettingsExpander.Items>
|
</cwc:SettingsExpander.Items>
|
||||||
</cwc:SettingsExpander>
|
</cwc:SettingsExpander>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|||||||
@@ -203,23 +203,19 @@
|
|||||||
</Border>
|
</Border>
|
||||||
</cwc:Case>
|
</cwc:Case>
|
||||||
<cwc:Case Value="Grid">
|
<cwc:Case Value="Grid">
|
||||||
<Border Margin="16,0,16,16" cw:Effects.Shadow="{ThemeResource CompatCardShadow}">
|
<GridView
|
||||||
<Border Style="{ThemeResource AcrylicBorderCardStyle}">
|
Padding="16,16,4,4"
|
||||||
<GridView
|
HorizontalAlignment="Stretch"
|
||||||
Padding="16,16,4,4"
|
HorizontalContentAlignment="Left"
|
||||||
HorizontalAlignment="Stretch"
|
ItemContainerStyle="{StaticResource LargeGridViewItemStyle}"
|
||||||
HorizontalContentAlignment="Left"
|
ItemTemplate="{StaticResource MonsterGridTemplate}"
|
||||||
ItemContainerStyle="{StaticResource LargeGridViewItemStyle}"
|
ItemsSource="{Binding Monsters}"
|
||||||
ItemTemplate="{StaticResource MonsterGridTemplate}"
|
SelectedItem="{Binding Selected, Mode=TwoWay}"
|
||||||
ItemsSource="{Binding Monsters}"
|
SelectionMode="Single">
|
||||||
SelectedItem="{Binding Selected, Mode=TwoWay}"
|
<mxi:Interaction.Behaviors>
|
||||||
SelectionMode="Single">
|
<shcb:SelectedItemInViewBehavior/>
|
||||||
<mxi:Interaction.Behaviors>
|
</mxi:Interaction.Behaviors>
|
||||||
<shcb:SelectedItemInViewBehavior/>
|
</GridView>
|
||||||
</mxi:Interaction.Behaviors>
|
|
||||||
</GridView>
|
|
||||||
</Border>
|
|
||||||
</Border>
|
|
||||||
</cwc:Case>
|
</cwc:Case>
|
||||||
</cwc:SwitchPresenter>
|
</cwc:SwitchPresenter>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Web.Hoyolab.SdkStatic.Hk4e.Launcher.Resource;
|
|
||||||
|
|
||||||
internal static class LatestPackageExtension
|
|
||||||
{
|
|
||||||
public static void Patch(this LatestPackage latest)
|
|
||||||
{
|
|
||||||
StringBuilder pathBuilder = new();
|
|
||||||
foreach (PackageSegment segment in latest.Segments)
|
|
||||||
{
|
|
||||||
pathBuilder.AppendLine(segment.Path);
|
|
||||||
}
|
|
||||||
|
|
||||||
latest.Path = pathBuilder.ToStringTrimEndReturn();
|
|
||||||
latest.Name = latest.Segments[0].Path[..^4]; // .00X
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -46,16 +46,18 @@ internal sealed partial class ResourceClient
|
|||||||
.TryCatchSendAsync<Response<GameResource>>(httpClient, logger, token)
|
.TryCatchSendAsync<Response<GameResource>>(httpClient, logger, token)
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
// 最新版完整包
|
// 补全缺失的信息
|
||||||
if (resp is { Data.Game.Latest: LatestPackage latest })
|
if (resp is { Data.Game.Latest: LatestPackage latest })
|
||||||
{
|
{
|
||||||
latest.Patch();
|
StringBuilder pathBuilder = new();
|
||||||
}
|
foreach (PackageSegment segment in latest.Segments)
|
||||||
|
{
|
||||||
|
pathBuilder.AppendLine(segment.Path);
|
||||||
|
}
|
||||||
|
|
||||||
// 预下载完整包
|
latest.Path = pathBuilder.ToStringTrimEndReturn();
|
||||||
if (resp is { Data.PreDownloadGame.Latest: LatestPackage preDownloadLatest })
|
string path = latest.Segments[0].Path[..^4]; // .00X
|
||||||
{
|
latest.Name = Path.GetFileName(path);
|
||||||
preDownloadLatest.Patch();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Response.Response.DefaultIfNull(resp);
|
return Response.Response.DefaultIfNull(resp);
|
||||||
|
|||||||
Reference in New Issue
Block a user