mirror of
https://jihulab.com/DGP-Studio/Snap.Hutao.git
synced 2025-11-19 21:02:53 +08:00
remove MemoryExtension [skip ci]
This commit is contained in:
@@ -84,7 +84,9 @@ internal sealed class GameFpsUnlocker : IGameFpsUnlocker
|
||||
|
||||
foreach (MODULEENTRY32 entry in StructMarshal.EnumerateModuleEntry32(snapshot))
|
||||
{
|
||||
if (entry.th32ProcessID == processId && entry.szModule.AsNullTerminatedReadOnlySpan().SequenceEqual(moduleName))
|
||||
__CHAR_256* pszModule = &entry.szModule;
|
||||
ReadOnlySpan<byte> szModuleLocal = MemoryMarshal.CreateReadOnlySpanFromNullTerminated((byte*)pszModule);
|
||||
if (entry.th32ProcessID == processId && szModuleLocal.SequenceEqual(moduleName))
|
||||
{
|
||||
return entry;
|
||||
}
|
||||
|
||||
@@ -244,7 +244,7 @@
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.VisualStudio.Validation" Version="17.6.4-alpha" />
|
||||
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.2.188-beta">
|
||||
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.2.206-beta">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
|
||||
@@ -50,7 +50,7 @@ internal sealed class AchievementImporter
|
||||
{
|
||||
if (await GetUIAFFromClipboardAsync().ConfigureAwait(false) is UIAF uiaf)
|
||||
{
|
||||
return await ImportAsync(achievementService.CurrentArchive!, uiaf).ConfigureAwait(false);
|
||||
return await TryImportAsync(achievementService.CurrentArchive!, uiaf).ConfigureAwait(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -85,7 +85,7 @@ internal sealed class AchievementImporter
|
||||
|
||||
if (isOk)
|
||||
{
|
||||
return await ImportAsync(achievementService.CurrentArchive, uiaf!).ConfigureAwait(false);
|
||||
return await TryImportAsync(achievementService.CurrentArchive, uiaf!).ConfigureAwait(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -114,7 +114,7 @@ internal sealed class AchievementImporter
|
||||
}
|
||||
}
|
||||
|
||||
private async Task<bool> ImportAsync(EntityAchievementArchive archive, UIAF uiaf)
|
||||
private async Task<bool> TryImportAsync(EntityAchievementArchive archive, UIAF uiaf)
|
||||
{
|
||||
if (uiaf.IsCurrentVersionSupported())
|
||||
{
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using System.Runtime.InteropServices;
|
||||
using Windows.Win32.Foundation;
|
||||
|
||||
namespace Snap.Hutao.Win32;
|
||||
|
||||
/// <summary>
|
||||
/// 内存拓展 for <see cref="Memory{T}"/> and <see cref="Span{T}"/>
|
||||
/// </summary>
|
||||
[HighQuality]
|
||||
internal static class MemoryExtension
|
||||
{
|
||||
/// <summary>
|
||||
/// 将 __CHAR_256 转换到 字符串
|
||||
/// </summary>
|
||||
/// <param name="char256">目标字符数组</param>
|
||||
/// <returns>结果字符串</returns>
|
||||
public static unsafe ReadOnlySpan<byte> AsNullTerminatedReadOnlySpan(this in __CHAR_256 char256)
|
||||
{
|
||||
fixed (CHAR* pszChar = &char256._0)
|
||||
{
|
||||
return MemoryMarshal.CreateReadOnlySpanFromNullTerminated((byte*)pszChar);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user