diff --git a/src/Snap.Hutao/Snap.Hutao/Core/IO/DataTransfer/Clipboard.cs b/src/Snap.Hutao/Snap.Hutao/Core/IO/DataTransfer/Clipboard.cs index 72b3fd3a..c9f17637 100644 --- a/src/Snap.Hutao/Snap.Hutao/Core/IO/DataTransfer/Clipboard.cs +++ b/src/Snap.Hutao/Snap.Hutao/Core/IO/DataTransfer/Clipboard.cs @@ -1,6 +1,7 @@ // Copyright (c) DGP Studio. All rights reserved. // Licensed under the MIT license. +using System.IO; using Windows.ApplicationModel.DataTransfer; using Windows.Storage.Streams; @@ -51,7 +52,7 @@ internal static class Clipboard /// 设置位图 /// /// 位图流 - public static void SetBitmapStream(IRandomAccessStream stream) + public static void SetBitmap(IRandomAccessStream stream) { RandomAccessStreamReference reference = RandomAccessStreamReference.CreateFromStream(stream); DataPackage content = new() { RequestedOperation = DataPackageOperation.Copy }; @@ -59,4 +60,16 @@ internal static class Clipboard Windows.ApplicationModel.DataTransfer.Clipboard.SetContent(content); Windows.ApplicationModel.DataTransfer.Clipboard.Flush(); } + + /// + /// 设置位图 + /// + /// 文件 + public static void SetBitmap(string file) + { + using (IRandomAccessStream stream = File.OpenRead(file).AsRandomAccessStream()) + { + SetBitmap(stream); + } + } } diff --git a/src/Snap.Hutao/Snap.Hutao/Core/LifeCycle/Activation.cs b/src/Snap.Hutao/Snap.Hutao/Core/LifeCycle/Activation.cs index 342871ba..a50406f5 100644 --- a/src/Snap.Hutao/Snap.Hutao/Core/LifeCycle/Activation.cs +++ b/src/Snap.Hutao/Snap.Hutao/Core/LifeCycle/Activation.cs @@ -270,7 +270,7 @@ internal static class Activation private static async Task HandleLaunchGameActionAsync(string? uid = null) { - Ioc.Default.GetRequiredService().Set(ViewModel.LaunchGameViewModel.DesiredUid, uid); + Ioc.Default.GetRequiredService().Set(ViewModel.Game.LaunchGameViewModel.DesiredUid, uid); await ThreadHelper.SwitchToMainThreadAsync(); if (!MainWindow.IsPresent) diff --git a/src/Snap.Hutao/Snap.Hutao/Core/Validation/Must.cs b/src/Snap.Hutao/Snap.Hutao/Core/Validation/Must.cs index 0c8047d7..4dde9d4f 100644 --- a/src/Snap.Hutao/Snap.Hutao/Core/Validation/Must.cs +++ b/src/Snap.Hutao/Snap.Hutao/Core/Validation/Must.cs @@ -18,7 +18,7 @@ internal static class Must /// message /// The name of the parameter to blame in the exception, if thrown. [MethodImpl(MethodImplOptions.NoInlining)] - public static void Argument([DoesNotReturnIf(false)] bool condition, string? message, [CallerArgumentExpression("condition")] string? parameterName = null) + public static void Argument([DoesNotReturnIf(false)] bool condition, string? message, [CallerArgumentExpression(nameof(condition))] string? parameterName = null) { if (!condition) { @@ -33,7 +33,7 @@ internal static class Must /// message /// The name of the parameter to blame in the exception, if thrown. [MethodImpl(MethodImplOptions.NoInlining)] - public static void Range([DoesNotReturnIf(false)] bool condition, string? message, [CallerArgumentExpression("condition")] string? parameterName = null) + public static void Range([DoesNotReturnIf(false)] bool condition, string? message, [CallerArgumentExpression(nameof(condition))] string? parameterName = null) { if (!condition) { @@ -62,7 +62,7 @@ internal static class Must /// The value of the parameter. /// Thrown if is null. [MethodImpl(MethodImplOptions.NoInlining)] - public static T NotNull([NotNull] T value, [CallerArgumentExpression("value")] string? parameterName = null) + public static T NotNull([NotNull] T value, [CallerArgumentExpression(nameof(value))] string? parameterName = null) where T : class // ensures value-types aren't passed to a null checking method { return value ?? throw new ArgumentNullException(parameterName); diff --git a/src/Snap.Hutao/Snap.Hutao/LaunchGameWindow.xaml b/src/Snap.Hutao/Snap.Hutao/LaunchGameWindow.xaml index e3d1c358..df1bf4a5 100644 --- a/src/Snap.Hutao/Snap.Hutao/LaunchGameWindow.xaml +++ b/src/Snap.Hutao/Snap.Hutao/LaunchGameWindow.xaml @@ -7,10 +7,10 @@ xmlns:mxi="using:Microsoft.Xaml.Interactivity" xmlns:shcb="using:Snap.Hutao.Control.Behavior" xmlns:shcm="using:Snap.Hutao.Control.Markup" - xmlns:shv="using:Snap.Hutao.ViewModel" + xmlns:shvg="using:Snap.Hutao.ViewModel.Game" mc:Ignorable="d"> - + diff --git a/src/Snap.Hutao/Snap.Hutao/LaunchGameWindow.xaml.cs b/src/Snap.Hutao/Snap.Hutao/LaunchGameWindow.xaml.cs index ffb507f8..b7e2f7e9 100644 --- a/src/Snap.Hutao/Snap.Hutao/LaunchGameWindow.xaml.cs +++ b/src/Snap.Hutao/Snap.Hutao/LaunchGameWindow.xaml.cs @@ -4,7 +4,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.UI.Xaml; using Snap.Hutao.Core.Windowing; -using Snap.Hutao.ViewModel; +using Snap.Hutao.ViewModel.Game; using Windows.Graphics; using Windows.Win32.UI.WindowsAndMessaging; diff --git a/src/Snap.Hutao/Snap.Hutao/Program.cs b/src/Snap.Hutao/Snap.Hutao/Program.cs index da799c5c..83eb4dfb 100644 --- a/src/Snap.Hutao/Snap.Hutao/Program.cs +++ b/src/Snap.Hutao/Snap.Hutao/Program.cs @@ -69,6 +69,7 @@ public static partial class Program .AddDatabase() .AddInjections() .AddHttpClients() + // Discrete services .AddSingleton(WeakReferenceMessenger.Default) diff --git a/src/Snap.Hutao/Snap.Hutao/Resource/Localization/SH.Designer.cs b/src/Snap.Hutao/Snap.Hutao/Resource/Localization/SH.Designer.cs index 3d3392ad..badfac9d 100644 --- a/src/Snap.Hutao/Snap.Hutao/Resource/Localization/SH.Designer.cs +++ b/src/Snap.Hutao/Snap.Hutao/Resource/Localization/SH.Designer.cs @@ -3921,6 +3921,15 @@ namespace Snap.Hutao.Resource.Localization { } } + /// + /// 查找类似 打开截图文件夹 的本地化字符串。 + /// + internal static string ViewPageOpenScreenshotFolderAction { + get { + return ResourceManager.GetString("ViewPageOpenScreenshotFolderAction", resourceCulture); + } + } + /// /// 查找类似 关于 胡桃 的本地化字符串。 /// diff --git a/src/Snap.Hutao/Snap.Hutao/Resource/Localization/SH.resx b/src/Snap.Hutao/Snap.Hutao/Resource/Localization/SH.resx index a22afecb..1f69167a 100644 --- a/src/Snap.Hutao/Snap.Hutao/Resource/Localization/SH.resx +++ b/src/Snap.Hutao/Snap.Hutao/Resource/Localization/SH.resx @@ -1404,6 +1404,9 @@ 在下方登录米哈游通行证 + + 打开截图文件夹 + 关于 胡桃 diff --git a/src/Snap.Hutao/Snap.Hutao/Service/GachaLog/Factory/GachaStatisticsFactory.cs b/src/Snap.Hutao/Snap.Hutao/Service/GachaLog/Factory/GachaStatisticsFactory.cs index 9a001084..8059a507 100644 --- a/src/Snap.Hutao/Snap.Hutao/Service/GachaLog/Factory/GachaStatisticsFactory.cs +++ b/src/Snap.Hutao/Snap.Hutao/Service/GachaLog/Factory/GachaStatisticsFactory.cs @@ -45,9 +45,9 @@ internal sealed class GachaStatisticsFactory : IGachaStatisticsFactory Dictionary nameAvatarMap = await metadataService.GetNameToAvatarMapAsync().ConfigureAwait(false); Dictionary nameWeaponMap = await metadataService.GetNameToWeaponMapAsync().ConfigureAwait(false); - List gachaevents = await metadataService.GetGachaEventsAsync().ConfigureAwait(false); + List gachaEvents = await metadataService.GetGachaEventsAsync().ConfigureAwait(false); - List historyWishBuilders = gachaevents.Select(g => new HistoryWishBuilder(g, nameAvatarMap, nameWeaponMap)).ToList(); + List historyWishBuilders = gachaEvents.Select(g => new HistoryWishBuilder(g, nameAvatarMap, nameWeaponMap)).ToList(); SettingEntry entry = await appDbContext.Settings .SingleOrAddAsync(SettingEntry.IsEmptyHistoryWishVisible, Core.StringLiterals.True) diff --git a/src/Snap.Hutao/Snap.Hutao/Service/GachaLog/GachaLogService.cs b/src/Snap.Hutao/Snap.Hutao/Service/GachaLog/GachaLogService.cs index 1aa7b655..c7785c81 100644 --- a/src/Snap.Hutao/Snap.Hutao/Service/GachaLog/GachaLogService.cs +++ b/src/Snap.Hutao/Snap.Hutao/Service/GachaLog/GachaLogService.cs @@ -253,12 +253,12 @@ internal sealed class GachaLogService : IGachaLogService { state.ConfigType = configType; long? dbEndId = null; - GachaLogQueryOptions configration = new(query, configType); + GachaLogQueryOptions options = new(query, configType); List itemsToAdd = new(); do { - Response response = await gachaInfoClient.GetGachaLogPageAsync(configration, token).ConfigureAwait(false); + Response response = await gachaInfoClient.GetGachaLogPageAsync(options, token).ConfigureAwait(false); if (response.IsOk()) { @@ -277,7 +277,7 @@ internal sealed class GachaLogService : IGachaLogService { itemsToAdd.Add(GachaItem.Create(archive.InnerId, item, GetItemId(item))); state.Items.Add(GetItemBaseByName(item.Name, item.ItemType)); - configration.EndId = item.Id; + options.EndId = item.Id; } else { @@ -311,7 +311,7 @@ internal sealed class GachaLogService : IGachaLogService } token.ThrowIfCancellationRequested(); - SaveGachaItems(itemsToAdd, isLazy, archive, configration.EndId); + SaveGachaItems(itemsToAdd, isLazy, archive, options.EndId); await RandomDelayAsync(token).ConfigureAwait(false); } diff --git a/src/Snap.Hutao/Snap.Hutao/Service/Game/GameService.cs b/src/Snap.Hutao/Snap.Hutao/Service/Game/GameService.cs index 1707b3f8..46c10a46 100644 --- a/src/Snap.Hutao/Snap.Hutao/Service/Game/GameService.cs +++ b/src/Snap.Hutao/Snap.Hutao/Service/Game/GameService.cs @@ -8,7 +8,6 @@ using Snap.Hutao.Core; using Snap.Hutao.Core.Database; using Snap.Hutao.Core.ExceptionService; using Snap.Hutao.Core.IO.Ini; -using Snap.Hutao.Model.Binding.LaunchGame; using Snap.Hutao.Model.Entity; using Snap.Hutao.Model.Entity.Database; using Snap.Hutao.Service.Game.Locator; diff --git a/src/Snap.Hutao/Snap.Hutao/Service/Game/IGameService.cs b/src/Snap.Hutao/Snap.Hutao/Service/Game/IGameService.cs index 46f403c5..5a32b18e 100644 --- a/src/Snap.Hutao/Snap.Hutao/Service/Game/IGameService.cs +++ b/src/Snap.Hutao/Snap.Hutao/Service/Game/IGameService.cs @@ -1,7 +1,6 @@ // Copyright (c) DGP Studio. All rights reserved. // Licensed under the MIT license. -using Snap.Hutao.Model.Binding.LaunchGame; using Snap.Hutao.Model.Entity; using Snap.Hutao.Service.Game.Package; using System.Collections.ObjectModel; diff --git a/src/Snap.Hutao/Snap.Hutao/Model/Binding/LaunchGame/LaunchScheme.cs b/src/Snap.Hutao/Snap.Hutao/Service/Game/LaunchScheme.cs similarity index 97% rename from src/Snap.Hutao/Snap.Hutao/Model/Binding/LaunchGame/LaunchScheme.cs rename to src/Snap.Hutao/Snap.Hutao/Service/Game/LaunchScheme.cs index d27eec31..83ca97e4 100644 --- a/src/Snap.Hutao/Snap.Hutao/Model/Binding/LaunchGame/LaunchScheme.cs +++ b/src/Snap.Hutao/Snap.Hutao/Service/Game/LaunchScheme.cs @@ -3,7 +3,7 @@ using System.Collections.Immutable; -namespace Snap.Hutao.Model.Binding.LaunchGame; +namespace Snap.Hutao.Service.Game; /// /// 启动方案 diff --git a/src/Snap.Hutao/Snap.Hutao/Service/Game/Package/PackageConverter.cs b/src/Snap.Hutao/Snap.Hutao/Service/Game/Package/PackageConverter.cs index 148b9720..6451d8cd 100644 --- a/src/Snap.Hutao/Snap.Hutao/Service/Game/Package/PackageConverter.cs +++ b/src/Snap.Hutao/Snap.Hutao/Service/Game/Package/PackageConverter.cs @@ -4,7 +4,6 @@ using Snap.Hutao.Core.DependencyInjection.Annotation.HttpClient; using Snap.Hutao.Core.ExceptionService; using Snap.Hutao.Core.IO; -using Snap.Hutao.Model.Binding.LaunchGame; using Snap.Hutao.Web.Hoyolab.SdkStatic.Hk4e.Launcher; using System.IO; using System.IO.Compression; diff --git a/src/Snap.Hutao/Snap.Hutao/Service/Metadata/MetadataService.cs b/src/Snap.Hutao/Snap.Hutao/Service/Metadata/MetadataService.cs index 9c147df1..2e613867 100644 --- a/src/Snap.Hutao/Snap.Hutao/Service/Metadata/MetadataService.cs +++ b/src/Snap.Hutao/Snap.Hutao/Service/Metadata/MetadataService.cs @@ -23,7 +23,6 @@ namespace Snap.Hutao.Service.Metadata; internal sealed partial class MetadataService : IMetadataService, IMetadataServiceInitialization { private const string MetaFileName = "Meta.json"; - private readonly string metadataFolderPath; private readonly IInfoBarService infoBarService; private readonly HttpClient httpClient; diff --git a/src/Snap.Hutao/Snap.Hutao/Snap.Hutao.csproj b/src/Snap.Hutao/Snap.Hutao/Snap.Hutao.csproj index e1496d3b..71d36e46 100644 --- a/src/Snap.Hutao/Snap.Hutao/Snap.Hutao.csproj +++ b/src/Snap.Hutao/Snap.Hutao/Snap.Hutao.csproj @@ -433,6 +433,7 @@ + diff --git a/src/Snap.Hutao/Snap.Hutao/View/Page/LaunchGamePage.xaml b/src/Snap.Hutao/Snap.Hutao/View/Page/LaunchGamePage.xaml index 2f4a17a6..b8e58b5a 100644 --- a/src/Snap.Hutao/Snap.Hutao/View/Page/LaunchGamePage.xaml +++ b/src/Snap.Hutao/Snap.Hutao/View/Page/LaunchGamePage.xaml @@ -2,7 +2,6 @@ x:Class="Snap.Hutao.View.Page.LaunchGamePage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:cwub="using:CommunityToolkit.WinUI.UI.Behaviors" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mxi="using:Microsoft.Xaml.Interactivity" @@ -11,10 +10,10 @@ xmlns:shc="using:Snap.Hutao.Control" xmlns:shcb="using:Snap.Hutao.Control.Behavior" xmlns:shcm="using:Snap.Hutao.Control.Markup" - xmlns:shv="using:Snap.Hutao.ViewModel" xmlns:shvc="using:Snap.Hutao.View.Control" + xmlns:shvg="using:Snap.Hutao.ViewModel.Game" xmlns:wsc="using:WinUICommunity.SettingsUI.Controls" - d:DataContext="{d:DesignInstance shv:LaunchGameViewModel}" + d:DataContext="{d:DesignInstance shvg:LaunchGameViewModel}" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" mc:Ignorable="d"> @@ -25,6 +24,7 @@ Collapsed + @@ -44,6 +44,10 @@ + diff --git a/src/Snap.Hutao/Snap.Hutao/ViewModel/AvatarProperty/AvatarPropertyViewModel.cs b/src/Snap.Hutao/Snap.Hutao/ViewModel/AvatarProperty/AvatarPropertyViewModel.cs index 0b2f2c7e..564100e3 100644 --- a/src/Snap.Hutao/Snap.Hutao/ViewModel/AvatarProperty/AvatarPropertyViewModel.cs +++ b/src/Snap.Hutao/Snap.Hutao/ViewModel/AvatarProperty/AvatarPropertyViewModel.cs @@ -284,7 +284,7 @@ internal sealed class AvatarPropertyViewModel : Abstraction.ViewModel, IRecipien try { - Clipboard.SetBitmapStream(memory); + Clipboard.SetBitmap(memory); clipboardOpened = true; } catch (COMException) diff --git a/src/Snap.Hutao/Snap.Hutao/ViewModel/GachaLog/GachaStatistics.cs b/src/Snap.Hutao/Snap.Hutao/ViewModel/GachaLog/GachaStatistics.cs index 3b1b2b51..74881165 100644 --- a/src/Snap.Hutao/Snap.Hutao/ViewModel/GachaLog/GachaStatistics.cs +++ b/src/Snap.Hutao/Snap.Hutao/ViewModel/GachaLog/GachaStatistics.cs @@ -1,6 +1,9 @@ // Copyright (c) DGP Studio. All rights reserved. // Licensed under the MIT license. +using Snap.Hutao.Model.Entity; +using Snap.Hutao.Web.Hoyolab.Hk4e.Event.GachaInfo; + namespace Snap.Hutao.ViewModel.GachaLog; /// diff --git a/src/Snap.Hutao/Snap.Hutao/ViewModel/GachaLog/StatisticsItem.cs b/src/Snap.Hutao/Snap.Hutao/ViewModel/GachaLog/StatisticsItem.cs index f1eb1a28..3a14a1f4 100644 --- a/src/Snap.Hutao/Snap.Hutao/ViewModel/GachaLog/StatisticsItem.cs +++ b/src/Snap.Hutao/Snap.Hutao/ViewModel/GachaLog/StatisticsItem.cs @@ -15,4 +15,4 @@ internal sealed class StatisticsItem : Item /// 获取物品的个数 /// public int Count { get; set; } -} +} \ No newline at end of file diff --git a/src/Snap.Hutao/Snap.Hutao/ViewModel/GachaLog/SummaryItem.cs b/src/Snap.Hutao/Snap.Hutao/ViewModel/GachaLog/SummaryItem.cs index a97d5b23..3a34e4df 100644 --- a/src/Snap.Hutao/Snap.Hutao/ViewModel/GachaLog/SummaryItem.cs +++ b/src/Snap.Hutao/Snap.Hutao/ViewModel/GachaLog/SummaryItem.cs @@ -43,4 +43,4 @@ internal sealed class SummaryItem : Item /// 获取时间 /// internal DateTimeOffset Time { get; set; } -} +} \ No newline at end of file diff --git a/src/Snap.Hutao/Snap.Hutao/ViewModel/LaunchGameViewModel.cs b/src/Snap.Hutao/Snap.Hutao/ViewModel/Game/LaunchGameViewModel.cs similarity index 94% rename from src/Snap.Hutao/Snap.Hutao/ViewModel/LaunchGameViewModel.cs rename to src/Snap.Hutao/Snap.Hutao/ViewModel/Game/LaunchGameViewModel.cs index 2d49c29d..4126282e 100644 --- a/src/Snap.Hutao/Snap.Hutao/ViewModel/LaunchGameViewModel.cs +++ b/src/Snap.Hutao/Snap.Hutao/ViewModel/Game/LaunchGameViewModel.cs @@ -7,9 +7,7 @@ using Microsoft.Extensions.DependencyInjection; using Snap.Hutao.Control.Extension; using Snap.Hutao.Core.ExceptionService; using Snap.Hutao.Core.LifeCycle; -using Snap.Hutao.Model.Binding.LaunchGame; using Snap.Hutao.Model.Entity; -using Snap.Hutao.Model.Entity.Database; using Snap.Hutao.Service.Abstraction; using Snap.Hutao.Service.Game; using Snap.Hutao.Service.Navigation; @@ -20,7 +18,7 @@ using Snap.Hutao.Web.Hoyolab.Takumi.Binding; using System.Collections.ObjectModel; using System.IO; -namespace Snap.Hutao.ViewModel; +namespace Snap.Hutao.ViewModel.Game; /// /// 启动游戏视图模型 @@ -61,6 +59,7 @@ internal sealed class LaunchGameViewModel : Abstraction.ViewModel ModifyGameAccountCommand = new AsyncRelayCommand(ModifyGameAccountAsync); RemoveGameAccountCommand = new AsyncRelayCommand(RemoveGameAccountAsync); AttachGameAccountCommand = new RelayCommand(AttachGameAccountToCurrentUserGameRole); + OpenScreenshotFolderCommand = new AsyncRelayCommand(OpenScreenshotFolderAsync); } /// @@ -136,10 +135,14 @@ internal sealed class LaunchGameViewModel : Abstraction.ViewModel /// public ICommand AttachGameAccountCommand { get; } + /// + /// 打开截图文件夹命令 + /// + public ICommand OpenScreenshotFolderCommand { get; } + /// protected override async Task OpenUIAsync() { - await ThreadHelper.SwitchToBackgroundAsync(); if (File.Exists(gameService.GetGamePathSkipLocator())) { try @@ -149,7 +152,6 @@ internal sealed class LaunchGameViewModel : Abstraction.ViewModel MultiChannel multi = gameService.GetMultiChannel(); if (string.IsNullOrEmpty(multi.ConfigFilePath)) { - await ThreadHelper.SwitchToMainThreadAsync(); SelectedScheme = KnownSchemes.FirstOrDefault(s => s.Channel == multi.Channel && s.SubChannel == multi.SubChannel); } else @@ -161,6 +163,7 @@ internal sealed class LaunchGameViewModel : Abstraction.ViewModel await ThreadHelper.SwitchToMainThreadAsync(); GameAccounts = accounts; + // Sync uid if (memoryCache.TryGetValue(DesiredUid, out object? value) && value is string uid) { @@ -294,4 +297,14 @@ internal sealed class LaunchGameViewModel : Abstraction.ViewModel await gameService.RemoveGameAccountAsync(gameAccount).ConfigureAwait(false); } } + + private async Task OpenScreenshotFolderAsync() + { + string game = gameService.GetGamePathSkipLocator(); + string screenshot = Path.Combine(Path.GetDirectoryName(game)!, "ScreenShot"); + if (Directory.Exists(screenshot)) + { + await Windows.System.Launcher.LaunchFolderPathAsync(screenshot); + } + } } \ No newline at end of file diff --git a/src/Snap.Hutao/Snap.Hutao/ViewModel/Game/Screenshot.cs b/src/Snap.Hutao/Snap.Hutao/ViewModel/Game/Screenshot.cs new file mode 100644 index 00000000..9c3594bd --- /dev/null +++ b/src/Snap.Hutao/Snap.Hutao/ViewModel/Game/Screenshot.cs @@ -0,0 +1,31 @@ +// Copyright (c) DGP Studio. All rights reserved. +// Licensed under the MIT license. + +using Snap.Hutao.Model.Binding; +using Snap.Hutao.Service.Game; +using System.IO; +using System.Text; + +namespace Snap.Hutao.ViewModel.Game; + +/// +/// 截图 +/// +internal sealed class Screenshot : INameIcon +{ + /// + /// 构造一个新的截图 + /// + /// 路径 + public Screenshot(string path) + { + Name = $"{new FileInfo(path).CreationTime}"; + Icon = path.ToUri(); + } + + /// + public string Name { get; } + + /// + public Uri Icon { get; } +} \ No newline at end of file diff --git a/src/Snap.Hutao/Snap.Hutao/ViewModel/Game/ScreenshotViewModel.cs b/src/Snap.Hutao/Snap.Hutao/ViewModel/Game/ScreenshotViewModel.cs new file mode 100644 index 00000000..dd5b1228 --- /dev/null +++ b/src/Snap.Hutao/Snap.Hutao/ViewModel/Game/ScreenshotViewModel.cs @@ -0,0 +1,28 @@ +// Copyright (c) DGP Studio. All rights reserved. +// Licensed under the MIT license. + +using Snap.Hutao.Service.Game; + +namespace Snap.Hutao.ViewModel.Game; + +/// +/// 截图视图模型 +/// +[Injection(InjectAs.Scoped)] +internal sealed class ScreenshotViewModel : Abstraction.ViewModel +{ + /// + /// 构造一个新的截图视图模型 + /// + /// 游戏服务 + public ScreenshotViewModel(IGameService gameService) + { + + } + + /// + protected override async Task OpenUIAsync() + { + + } +} \ No newline at end of file diff --git a/src/Snap.Hutao/Snap.Hutao/Web/ApiEndpoints.cs b/src/Snap.Hutao/Snap.Hutao/Web/ApiEndpoints.cs index e59f595e..21dd5f16 100644 --- a/src/Snap.Hutao/Snap.Hutao/Web/ApiEndpoints.cs +++ b/src/Snap.Hutao/Snap.Hutao/Web/ApiEndpoints.cs @@ -2,6 +2,7 @@ // Licensed under the MIT license. using Snap.Hutao.Model.Primitive; +using Snap.Hutao.Service.Game; using Snap.Hutao.Web.Hoyolab; namespace Snap.Hutao.Web; @@ -320,7 +321,7 @@ internal static class ApiEndpoints /// /// 启动方案 /// 启动器资源字符串 - public static string SdkStaticLauncherResource(Model.Binding.LaunchGame.LaunchScheme scheme) + public static string SdkStaticLauncherResource(LaunchScheme scheme) { return $"{SdkStaticLauncherApi}/resource?key={scheme.Key}&launcher_id={scheme.LauncherId}&channel_id={scheme.Channel}&sub_channel_id={scheme.SubChannel}"; } diff --git a/src/Snap.Hutao/Snap.Hutao/Web/ApiOsEndpoints.cs b/src/Snap.Hutao/Snap.Hutao/Web/ApiOsEndpoints.cs index b9b19c5c..6743bd2d 100644 --- a/src/Snap.Hutao/Snap.Hutao/Web/ApiOsEndpoints.cs +++ b/src/Snap.Hutao/Snap.Hutao/Web/ApiOsEndpoints.cs @@ -1,6 +1,8 @@ // Copyright (c) DGP Studio. All rights reserved. // Licensed under the MIT license. +using Snap.Hutao.Service.Game; + namespace Snap.Hutao.Web; /// @@ -31,7 +33,7 @@ internal static class ApiOsEndpoints /// /// 启动方案 /// 启动器资源字符串 - public static string SdkOsStaticLauncherResource(Model.Binding.LaunchGame.LaunchScheme scheme) + public static string SdkOsStaticLauncherResource(LaunchScheme scheme) { return $"{SdkOsStaticLauncherApi}/resource?key={scheme.Key}&launcher_id={scheme.LauncherId}&channel_id={scheme.Channel}&sub_channel_id={scheme.SubChannel}"; } diff --git a/src/Snap.Hutao/Snap.Hutao/Web/Hoyolab/SdkStatic/Hk4e/Launcher/ResourceClient.cs b/src/Snap.Hutao/Snap.Hutao/Web/Hoyolab/SdkStatic/Hk4e/Launcher/ResourceClient.cs index 9ab391d0..06a76df3 100644 --- a/src/Snap.Hutao/Snap.Hutao/Web/Hoyolab/SdkStatic/Hk4e/Launcher/ResourceClient.cs +++ b/src/Snap.Hutao/Snap.Hutao/Web/Hoyolab/SdkStatic/Hk4e/Launcher/ResourceClient.cs @@ -2,7 +2,7 @@ // Licensed under the MIT license. using Snap.Hutao.Core.DependencyInjection.Annotation.HttpClient; -using Snap.Hutao.Model.Binding.LaunchGame; +using Snap.Hutao.Service.Game; using Snap.Hutao.Web.Response; using System.Net.Http;