mirror of
https://jihulab.com/DGP-Studio/Snap.Hutao.git
synced 2025-11-19 21:02:53 +08:00
refactor
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Snap.Hutao.Core.Abstraction.Extension;
|
||||
namespace Snap.Hutao.Core.Abstraction;
|
||||
|
||||
internal static class BuilderExtension
|
||||
{
|
||||
@@ -4,7 +4,7 @@
|
||||
using Windows.ApplicationModel.DataTransfer;
|
||||
using Windows.Storage.Streams;
|
||||
|
||||
namespace Snap.Hutao.Core.IO.DataTransfer;
|
||||
namespace Snap.Hutao.Core.DataTransfer;
|
||||
|
||||
[ConstructorGenerated]
|
||||
[Injection(InjectAs.Transient, typeof(IClipboardProvider))]
|
||||
@@ -13,7 +13,6 @@ internal sealed partial class ClipboardProvider : IClipboardProvider
|
||||
private readonly JsonSerializerOptions options;
|
||||
private readonly ITaskContext taskContext;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public async ValueTask<T?> DeserializeFromJsonAsync<T>()
|
||||
where T : class
|
||||
{
|
||||
@@ -31,7 +30,6 @@ internal sealed partial class ClipboardProvider : IClipboardProvider
|
||||
return JsonSerializer.Deserialize<T>(json, options);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool SetText(string text)
|
||||
{
|
||||
try
|
||||
@@ -48,7 +46,23 @@ internal sealed partial class ClipboardProvider : IClipboardProvider
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public async ValueTask<bool> SetTextAsync(string text)
|
||||
{
|
||||
try
|
||||
{
|
||||
await taskContext.SwitchToMainThreadAsync();
|
||||
DataPackage content = new() { RequestedOperation = DataPackageOperation.Copy };
|
||||
content.SetText(text);
|
||||
Clipboard.SetContent(content);
|
||||
Clipboard.Flush();
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool SetBitmap(IRandomAccessStream stream)
|
||||
{
|
||||
try
|
||||
@@ -65,4 +79,22 @@ internal sealed partial class ClipboardProvider : IClipboardProvider
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public async ValueTask<bool> SetBitmapAsync(IRandomAccessStream stream)
|
||||
{
|
||||
try
|
||||
{
|
||||
await taskContext.SwitchToMainThreadAsync();
|
||||
RandomAccessStreamReference reference = RandomAccessStreamReference.CreateFromStream(stream);
|
||||
DataPackage content = new() { RequestedOperation = DataPackageOperation.Copy };
|
||||
content.SetBitmap(reference);
|
||||
Clipboard.SetContent(content);
|
||||
Clipboard.Flush();
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using Windows.Storage.Streams;
|
||||
|
||||
namespace Snap.Hutao.Core.DataTransfer;
|
||||
|
||||
internal interface IClipboardProvider
|
||||
{
|
||||
ValueTask<T?> DeserializeFromJsonAsync<T>()
|
||||
where T : class;
|
||||
|
||||
bool SetBitmap(IRandomAccessStream stream);
|
||||
|
||||
ValueTask<bool> SetBitmapAsync(IRandomAccessStream stream);
|
||||
|
||||
bool SetText(string text);
|
||||
|
||||
ValueTask<bool> SetTextAsync(string text);
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
namespace Snap.Hutao.Core.Database;
|
||||
namespace Snap.Hutao.Core.Database.Abstraction;
|
||||
|
||||
internal interface IReorderable
|
||||
{
|
||||
@@ -0,0 +1,11 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
namespace Snap.Hutao.Core.Database.Abstraction;
|
||||
|
||||
internal interface ISelectable
|
||||
{
|
||||
Guid InnerId { get; }
|
||||
|
||||
bool IsSelected { get; set; }
|
||||
}
|
||||
@@ -20,6 +20,7 @@ internal static class DbSetExtension
|
||||
return dbSet.SaveChangesAndClearChangeTracker();
|
||||
}
|
||||
|
||||
[Obsolete("Async operation over ssqlite is meaningless")]
|
||||
public static ValueTask<int> AddAndSaveAsync<TEntity>(this DbSet<TEntity> dbSet, TEntity entity, CancellationToken token = default)
|
||||
where TEntity : class
|
||||
{
|
||||
@@ -34,6 +35,7 @@ internal static class DbSetExtension
|
||||
return dbSet.SaveChangesAndClearChangeTracker();
|
||||
}
|
||||
|
||||
[Obsolete("Async operation over ssqlite is meaningless")]
|
||||
public static ValueTask<int> AddRangeAndSaveAsync<TEntity>(this DbSet<TEntity> dbSet, IEnumerable<TEntity> entities, CancellationToken token = default)
|
||||
where TEntity : class
|
||||
{
|
||||
@@ -48,6 +50,7 @@ internal static class DbSetExtension
|
||||
return dbSet.SaveChangesAndClearChangeTracker();
|
||||
}
|
||||
|
||||
[Obsolete("Async operation over ssqlite is meaningless")]
|
||||
public static ValueTask<int> RemoveAndSaveAsync<TEntity>(this DbSet<TEntity> dbSet, TEntity entity, CancellationToken token = default)
|
||||
where TEntity : class
|
||||
{
|
||||
@@ -62,6 +65,7 @@ internal static class DbSetExtension
|
||||
return dbSet.SaveChangesAndClearChangeTracker();
|
||||
}
|
||||
|
||||
[Obsolete("Async operation over ssqlite is meaningless")]
|
||||
public static ValueTask<int> UpdateAndSaveAsync<TEntity>(this DbSet<TEntity> dbSet, TEntity entity, CancellationToken token = default)
|
||||
where TEntity : class
|
||||
{
|
||||
@@ -79,6 +83,7 @@ internal static class DbSetExtension
|
||||
return count;
|
||||
}
|
||||
|
||||
[Obsolete("Async operation over ssqlite is meaningless")]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private static async ValueTask<int> SaveChangesAndClearChangeTrackerAsync<TEntity>(this DbSet<TEntity> dbSet, CancellationToken token = default)
|
||||
where TEntity : class
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
namespace Snap.Hutao.Core.Database;
|
||||
|
||||
/// <summary>
|
||||
/// 可选择的项
|
||||
/// 若要使用 <see cref="ScopedDbCurrent{TEntity, TMessage}"/>
|
||||
/// 必须实现该接口
|
||||
/// </summary>
|
||||
[HighQuality]
|
||||
internal interface ISelectable
|
||||
{
|
||||
/// <summary>
|
||||
/// 数据库内部Id
|
||||
/// </summary>
|
||||
Guid InnerId { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置当前项的选中状态
|
||||
/// </summary>
|
||||
bool IsSelected { get; set; }
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
using CommunityToolkit.WinUI.Collections;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Snap.Hutao.Core.Database.Abstraction;
|
||||
using Snap.Hutao.Model;
|
||||
using Snap.Hutao.Model.Entity.Database;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Linq.Expressions;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Snap.Hutao.Core.Database;
|
||||
|
||||
/// <summary>
|
||||
/// 可查询扩展
|
||||
/// </summary>
|
||||
[HighQuality]
|
||||
internal static class QueryableExtension
|
||||
{
|
||||
/// <summary>
|
||||
/// <code>source.Where(predicate).ExecuteDelete()</code>
|
||||
/// </summary>
|
||||
/// <typeparam name="TSource">源类型</typeparam>
|
||||
/// <param name="source">源</param>
|
||||
/// <param name="predicate">条件</param>
|
||||
/// <returns>SQL返回个数</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static int ExecuteDeleteWhere<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
|
||||
{
|
||||
return source.Where(predicate).ExecuteDelete();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <code>source.Where(predicate).ExecuteDeleteAsync(token)</code>
|
||||
/// </summary>
|
||||
/// <typeparam name="TSource">源类型</typeparam>
|
||||
/// <param name="source">源</param>
|
||||
/// <param name="predicate">条件</param>
|
||||
/// <param name="token">取消令牌</param>
|
||||
/// <returns>SQL返回个数</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static ValueTask<int> ExecuteDeleteWhereAsync<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate, CancellationToken token = default)
|
||||
{
|
||||
return source.Where(predicate).ExecuteDeleteAsync(token).AsValueTask();
|
||||
}
|
||||
}
|
||||
@@ -3,17 +3,12 @@
|
||||
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Snap.Hutao.Core.Database.Abstraction;
|
||||
using Snap.Hutao.Model;
|
||||
using Snap.Hutao.Model.Entity.Database;
|
||||
|
||||
namespace Snap.Hutao.Core.Database;
|
||||
|
||||
/// <summary>
|
||||
/// 范围化的数据库当前项
|
||||
/// 简化对数据库中选中项的管理
|
||||
/// </summary>
|
||||
/// <typeparam name="TEntity">实体的类型</typeparam>
|
||||
/// <typeparam name="TMessage">消息的类型</typeparam>
|
||||
[ConstructorGenerated]
|
||||
internal sealed partial class ScopedDbCurrent<TEntity, TMessage>
|
||||
where TEntity : class, ISelectable
|
||||
@@ -24,9 +19,6 @@ internal sealed partial class ScopedDbCurrent<TEntity, TMessage>
|
||||
|
||||
private TEntity? current;
|
||||
|
||||
/// <summary>
|
||||
/// 当前选中的项
|
||||
/// </summary>
|
||||
public TEntity? Current
|
||||
{
|
||||
get => current;
|
||||
@@ -82,9 +74,6 @@ internal sealed partial class ScopedDbCurrent<TEntityOnly, TEntity, TMessage>
|
||||
|
||||
private TEntityOnly? current;
|
||||
|
||||
/// <summary>
|
||||
/// 当前选中的项
|
||||
/// </summary>
|
||||
public TEntityOnly? Current
|
||||
{
|
||||
get => current;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using Snap.Hutao.Core.Database.Abstraction;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Snap.Hutao.Core.Database;
|
||||
@@ -11,13 +12,6 @@ namespace Snap.Hutao.Core.Database;
|
||||
[HighQuality]
|
||||
internal static class SelectableExtension
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取选中的值或默认值
|
||||
/// </summary>
|
||||
/// <typeparam name="TSource">源类型</typeparam>
|
||||
/// <param name="source">源</param>
|
||||
/// <returns>选中的值或默认值</returns>
|
||||
/// <exception cref="InvalidOperationException">存在多个选中的值</exception>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static TSource? SelectedOrDefault<TSource>(this IEnumerable<TSource> source)
|
||||
where TSource : ISelectable
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
namespace Snap.Hutao.Core.DependencyInjection.Abstraction;
|
||||
|
||||
/// <summary>
|
||||
/// 可转换类型服务
|
||||
/// </summary>
|
||||
[Obsolete("Not useful anymore")]
|
||||
internal interface ICastService
|
||||
{
|
||||
}
|
||||
@@ -20,7 +20,7 @@ internal abstract class OverseaSupportFactory<TClient, TClientCN, TClientOS> : I
|
||||
this.serviceProvider = serviceProvider;
|
||||
}
|
||||
|
||||
public TClient Create(bool isOversea)
|
||||
public virtual TClient Create(bool isOversea)
|
||||
{
|
||||
return isOversea
|
||||
? serviceProvider.GetRequiredService<TClientOS>()
|
||||
|
||||
@@ -38,11 +38,6 @@ internal static partial class IocHttpClientConfiguration
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public static partial IServiceCollection AddHttpClients(this IServiceCollection services);
|
||||
|
||||
/// <summary>
|
||||
/// 默认配置
|
||||
/// </summary>
|
||||
/// <param name="serviceProvider">服务提供器</param>
|
||||
/// <param name="client">配置后的客户端</param>
|
||||
private static void DefaultConfiguration(IServiceProvider serviceProvider, HttpClient client)
|
||||
{
|
||||
RuntimeOptions runtimeOptions = serviceProvider.GetRequiredService<RuntimeOptions>();
|
||||
@@ -51,10 +46,6 @@ internal static partial class IocHttpClientConfiguration
|
||||
client.DefaultRequestHeaders.UserAgent.ParseAdd(runtimeOptions.UserAgent);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 对于需要添加动态密钥1的客户端使用此配置
|
||||
/// </summary>
|
||||
/// <param name="client">配置后的客户端</param>
|
||||
private static void XRpcConfiguration(HttpClient client)
|
||||
{
|
||||
client.Timeout = Timeout.InfiniteTimeSpan;
|
||||
@@ -65,10 +56,6 @@ internal static partial class IocHttpClientConfiguration
|
||||
client.DefaultRequestHeaders.Add("x-rpc-device_id", HoyolabOptions.DeviceId36);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 对于需要添加动态密钥2的客户端使用此配置
|
||||
/// </summary>
|
||||
/// <param name="client">配置后的客户端</param>
|
||||
private static void XRpc2Configuration(HttpClient client)
|
||||
{
|
||||
client.Timeout = Timeout.InfiniteTimeSpan;
|
||||
@@ -84,11 +71,6 @@ internal static partial class IocHttpClientConfiguration
|
||||
client.DefaultRequestHeaders.Add("x-rpc-sdk_version", "2.16.0");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 对于需要添加动态密钥1的客户端使用此配置
|
||||
/// HoYoLAB app
|
||||
/// </summary>
|
||||
/// <param name="client">配置后的客户端</param>
|
||||
private static void XRpc3Configuration(HttpClient client)
|
||||
{
|
||||
client.Timeout = Timeout.InfiniteTimeSpan;
|
||||
@@ -100,11 +82,6 @@ internal static partial class IocHttpClientConfiguration
|
||||
client.DefaultRequestHeaders.Add("x-rpc-device_id", HoyolabOptions.DeviceId36);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 对于需要添加动态密钥2的客户端使用此配置
|
||||
/// HoYoLAB web
|
||||
/// </summary>
|
||||
/// <param name="client">配置后的客户端</param>
|
||||
[SuppressMessage("", "IDE0051")]
|
||||
private static void XRpc4Configuration(HttpClient client)
|
||||
{
|
||||
|
||||
@@ -10,11 +10,6 @@ namespace Snap.Hutao.Core.DependencyInjection;
|
||||
[HighQuality]
|
||||
internal static partial class ServiceCollectionExtension
|
||||
{
|
||||
/// <summary>
|
||||
/// 向容器注册服务
|
||||
/// 此方法将会自动生成
|
||||
/// </summary>
|
||||
/// <param name="services">容器</param>
|
||||
/// <returns>可继续操作的服务集合</returns>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public static partial IServiceCollection AddInjections(this IServiceCollection services);
|
||||
}
|
||||
@@ -12,17 +12,19 @@ internal static class ServiceProviderExtension
|
||||
{
|
||||
/// <inheritdoc cref="ActivatorUtilities.CreateInstance{T}(IServiceProvider, object[])"/>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[Obsolete("Use ActivatorUtilities.CreateInstance<T>(IServiceProvider, params object[]) instead")]
|
||||
public static T CreateInstance<T>(this IServiceProvider serviceProvider, params object[] parameters)
|
||||
{
|
||||
return ActivatorUtilities.CreateInstance<T>(serviceProvider, parameters);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool IsDisposed(this IServiceProvider? serviceProvider)
|
||||
[Obsolete]
|
||||
public static bool IsDisposed(this IServiceProvider? serviceProvider, bool treatNullAsDisposed = true)
|
||||
{
|
||||
if (serviceProvider is null)
|
||||
{
|
||||
return true;
|
||||
return treatNullAsDisposed;
|
||||
}
|
||||
|
||||
if (serviceProvider is ServiceProvider serviceProviderImpl)
|
||||
|
||||
@@ -6,6 +6,7 @@ namespace Snap.Hutao.Core.Diagnostics.CodeAnalysis;
|
||||
/// <summary>
|
||||
/// 指示此特性附加的属性会在属性改变后会异步地设置的其他属性
|
||||
/// </summary>
|
||||
[Obsolete]
|
||||
[AttributeUsage(AttributeTargets.Property, Inherited = false)]
|
||||
internal sealed class AlsoAsyncSetsAttribute : Attribute
|
||||
{
|
||||
|
||||
@@ -6,6 +6,7 @@ namespace Snap.Hutao.Core.Diagnostics.CodeAnalysis;
|
||||
/// <summary>
|
||||
/// 指示此特性附加的属性会在属性改变后会设置的其他属性
|
||||
/// </summary>
|
||||
[Obsolete]
|
||||
[AttributeUsage(AttributeTargets.Property, Inherited = false)]
|
||||
internal sealed class AlsoSetsAttribute : Attribute
|
||||
{
|
||||
|
||||
@@ -2,13 +2,10 @@
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using Microsoft.UI.Xaml;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Snap.Hutao.Core.ExceptionService;
|
||||
|
||||
/// <summary>
|
||||
/// 异常记录器
|
||||
/// </summary>
|
||||
[HighQuality]
|
||||
[ConstructorGenerated]
|
||||
[Injection(InjectAs.Singleton)]
|
||||
internal sealed partial class ExceptionRecorder
|
||||
@@ -16,13 +13,15 @@ internal sealed partial class ExceptionRecorder
|
||||
private readonly ILogger<ExceptionRecorder> logger;
|
||||
private readonly IServiceProvider serviceProvider;
|
||||
|
||||
/// <summary>
|
||||
/// 记录应用程序异常
|
||||
/// </summary>
|
||||
/// <param name="app">应用程序</param>
|
||||
public void Record(Application app)
|
||||
{
|
||||
app.UnhandledException += OnAppUnhandledException;
|
||||
ConfigureDebugSettings(app);
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
private void ConfigureDebugSettings(Application app)
|
||||
{
|
||||
app.DebugSettings.FailFastOnErrors = false;
|
||||
|
||||
app.DebugSettings.IsBindingTracingEnabled = true;
|
||||
@@ -35,19 +34,15 @@ internal sealed partial class ExceptionRecorder
|
||||
app.DebugSettings.LayoutCycleDebugBreakLevel = LayoutCycleDebugBreakLevel.High;
|
||||
}
|
||||
|
||||
[SuppressMessage("", "CA2012")]
|
||||
private void OnAppUnhandledException(object? sender, Microsoft.UI.Xaml.UnhandledExceptionEventArgs e)
|
||||
{
|
||||
ValueTask<string?> task = serviceProvider
|
||||
.GetRequiredService<Web.Hutao.Log.HutaoLogUploadClient>()
|
||||
.UploadLogAsync(e.Exception);
|
||||
|
||||
if (!task.IsCompleted)
|
||||
{
|
||||
task.GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
logger.LogError("未经处理的全局异常:\r\n{Detail}", ExceptionFormat.Format(e.Exception));
|
||||
|
||||
_ = serviceProvider
|
||||
.GetRequiredService<Web.Hutao.Log.HutaoLogUploadClient>()
|
||||
.UploadLogAsync(e.Exception)
|
||||
.GetAwaiter()
|
||||
.GetResult();
|
||||
}
|
||||
|
||||
private void OnXamlBindingFailed(object? sender, BindingFailedEventArgs e)
|
||||
|
||||
@@ -9,17 +9,8 @@ using WinRT;
|
||||
|
||||
namespace Snap.Hutao.Core.Graphics.Imaging;
|
||||
|
||||
/// <summary>
|
||||
/// 软件位图拓展
|
||||
/// </summary>
|
||||
[HighQuality]
|
||||
internal static class SoftwareBitmapExtension
|
||||
{
|
||||
/// <summary>
|
||||
/// 混合模式 正常
|
||||
/// </summary>
|
||||
/// <param name="softwareBitmap">软件位图</param>
|
||||
/// <param name="tint">底色</param>
|
||||
public static unsafe void NormalBlend(this SoftwareBitmap softwareBitmap, Bgra32 tint)
|
||||
{
|
||||
using (BitmapBuffer buffer = softwareBitmap.LockBuffer(BitmapBufferAccessMode.ReadWrite))
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using Windows.Storage.Streams;
|
||||
|
||||
namespace Snap.Hutao.Core.IO.DataTransfer;
|
||||
|
||||
/// <summary>
|
||||
/// 剪贴板互操作
|
||||
/// </summary>
|
||||
internal interface IClipboardProvider
|
||||
{
|
||||
/// <summary>
|
||||
/// 从剪贴板文本中反序列化
|
||||
/// </summary>
|
||||
/// <typeparam name="T">目标类型</typeparam>
|
||||
/// <returns>实例</returns>
|
||||
ValueTask<T?> DeserializeFromJsonAsync<T>()
|
||||
where T : class;
|
||||
|
||||
/// <summary>
|
||||
/// 设置位图
|
||||
/// </summary>
|
||||
/// <param name="stream">图片流</param>
|
||||
/// <returns>是否设置成功</returns>
|
||||
bool SetBitmap(IRandomAccessStream stream);
|
||||
|
||||
/// <summary>
|
||||
/// 设置文本
|
||||
/// </summary>
|
||||
/// <param name="text">文本</param>
|
||||
/// <returns>是否设置成功</returns>
|
||||
bool SetText(string text);
|
||||
}
|
||||
@@ -7,7 +7,7 @@ using System.Text;
|
||||
namespace Snap.Hutao.Core.IO.Hashing;
|
||||
|
||||
#if NET9_0_OR_GREATER
|
||||
[Obsolete]
|
||||
[Obsolete("Use CryptographicOperations.HashData()")]
|
||||
#endif
|
||||
internal static class Hash
|
||||
{
|
||||
|
||||
@@ -8,7 +8,9 @@ namespace Snap.Hutao.Core.IO.Hashing;
|
||||
/// <summary>
|
||||
/// 摘要
|
||||
/// </summary>
|
||||
[HighQuality]
|
||||
#if NET9_0_OR_GREATER
|
||||
[Obsolete("Use CryptographicOperations.HashData()")]
|
||||
#endif
|
||||
internal static class MD5
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -5,6 +5,9 @@ using System.IO;
|
||||
|
||||
namespace Snap.Hutao.Core.IO.Hashing;
|
||||
|
||||
#if NET9_0_OR_GREATER
|
||||
[Obsolete("Use CryptographicOperations.HashData()")]
|
||||
#endif
|
||||
internal static class SHA256
|
||||
{
|
||||
public static async ValueTask<string> HashFileAsync(string filePath, CancellationToken token = default)
|
||||
|
||||
@@ -9,6 +9,9 @@ namespace Snap.Hutao.Core.IO.Hashing;
|
||||
/// <summary>
|
||||
/// XXH64 摘要
|
||||
/// </summary>
|
||||
#if NET9_0_OR_GREATER
|
||||
[Obsolete("Use CryptographicOperations.HashData()")]
|
||||
#endif
|
||||
internal static class XXH64
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -8,6 +8,7 @@ using Snap.Hutao.Win32.Security;
|
||||
using System.Runtime.InteropServices;
|
||||
using static Snap.Hutao.Win32.AdvApi32;
|
||||
using static Snap.Hutao.Win32.FirewallApi;
|
||||
using static Snap.Hutao.Win32.Kernel32;
|
||||
using static Snap.Hutao.Win32.Macros;
|
||||
|
||||
namespace Snap.Hutao.Core.IO.Http.Loopback;
|
||||
@@ -26,45 +27,7 @@ internal sealed unsafe class LoopbackManager : ObservableObject
|
||||
runtimeOptions = serviceProvider.GetRequiredService<RuntimeOptions>();
|
||||
taskContext = serviceProvider.GetRequiredService<ITaskContext>();
|
||||
|
||||
INET_FIREWALL_APP_CONTAINER* pContainers = default;
|
||||
try
|
||||
{
|
||||
{
|
||||
WIN32_ERROR error = NetworkIsolationEnumAppContainers(NETISO_FLAG.NETISO_FLAG_MAX, out uint acCount, out pContainers);
|
||||
Marshal.ThrowExceptionForHR(HRESULT_FROM_WIN32(error));
|
||||
for (uint i = 0; i < acCount; i++)
|
||||
{
|
||||
INET_FIREWALL_APP_CONTAINER* pContainer = pContainers + i;
|
||||
ReadOnlySpan<char> appContainerName = MemoryMarshal.CreateReadOnlySpanFromNullTerminated(pContainer->appContainerName);
|
||||
if (appContainerName.Equals(runtimeOptions.FamilyName, StringComparison.Ordinal))
|
||||
{
|
||||
ConvertSidToStringSidW(pContainer->appContainerSid, out PWSTR stringSid);
|
||||
hutaoContainerStringSID = MemoryMarshal.CreateReadOnlySpanFromNullTerminated(stringSid).ToString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
// This function returns 1 rather than 0 specfied in the document.
|
||||
_ = NetworkIsolationFreeAppContainers(pContainers);
|
||||
}
|
||||
|
||||
{
|
||||
WIN32_ERROR error = NetworkIsolationGetAppContainerConfig(out uint accCount, out SID_AND_ATTRIBUTES* pSids);
|
||||
Marshal.ThrowExceptionForHR(HRESULT_FROM_WIN32(error));
|
||||
for (uint i = 0; i < accCount; i++)
|
||||
{
|
||||
ConvertSidToStringSidW((pSids + i)->Sid, out PWSTR stringSid);
|
||||
ReadOnlySpan<char> stringSidSpan = MemoryMarshal.CreateReadOnlySpanFromNullTerminated(stringSid);
|
||||
if (stringSidSpan.Equals(hutaoContainerStringSID, StringComparison.Ordinal))
|
||||
{
|
||||
IsLoopbackEnabled = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Initialize(out hutaoContainerStringSID);
|
||||
}
|
||||
|
||||
public bool IsLoopbackEnabled { get => isLoopbackEnabled; private set => SetProperty(ref isLoopbackEnabled, value); }
|
||||
@@ -84,4 +47,60 @@ internal sealed unsafe class LoopbackManager : ObservableObject
|
||||
sids.Add(sidAndAttributes);
|
||||
IsLoopbackEnabled = NetworkIsolationSetAppContainerConfig(CollectionsMarshal.AsSpan(sids)) is WIN32_ERROR.ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
private void Initialize(out string hutaoContainerStringSID)
|
||||
{
|
||||
hutaoContainerStringSID = string.Empty;
|
||||
|
||||
INET_FIREWALL_APP_CONTAINER* pContainers = default;
|
||||
try
|
||||
{
|
||||
WIN32_ERROR error = NetworkIsolationEnumAppContainers(NETISO_FLAG.NETISO_FLAG_MAX, out uint acCount, out pContainers);
|
||||
Marshal.ThrowExceptionForHR(HRESULT_FROM_WIN32(error));
|
||||
for (uint i = 0; i < acCount; i++)
|
||||
{
|
||||
INET_FIREWALL_APP_CONTAINER* pContainer = pContainers + i;
|
||||
ReadOnlySpan<char> appContainerName = MemoryMarshal.CreateReadOnlySpanFromNullTerminated(pContainer->appContainerName);
|
||||
if (appContainerName.Equals(runtimeOptions.FamilyName, StringComparison.Ordinal))
|
||||
{
|
||||
ConvertSidToStringSidW(pContainer->appContainerSid, out PWSTR stringSid);
|
||||
hutaoContainerStringSID = MemoryMarshal.CreateReadOnlySpanFromNullTerminated(stringSid).ToString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
// This function returns 1 rather than 0 specfied in the document.
|
||||
_ = NetworkIsolationFreeAppContainers(pContainers);
|
||||
}
|
||||
|
||||
SID_AND_ATTRIBUTES* pSids = default;
|
||||
uint count = default;
|
||||
try
|
||||
{
|
||||
WIN32_ERROR error = NetworkIsolationGetAppContainerConfig(out count, out pSids);
|
||||
Marshal.ThrowExceptionForHR(HRESULT_FROM_WIN32(error));
|
||||
|
||||
for (uint i = 0; i < count; i++)
|
||||
{
|
||||
ConvertSidToStringSidW((pSids + i)->Sid, out PWSTR stringSid);
|
||||
ReadOnlySpan<char> stringSidSpan = MemoryMarshal.CreateReadOnlySpanFromNullTerminated(stringSid);
|
||||
if (stringSidSpan.Equals(hutaoContainerStringSID, StringComparison.Ordinal))
|
||||
{
|
||||
IsLoopbackEnabled = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
for (uint index = 0; index < count; index++)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, pSids[index].Sid);
|
||||
}
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, pSids);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -75,8 +75,8 @@ internal sealed partial class HttpProxyUsingSystemProxy : ObservableObject, IWeb
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
(innerProxy as IDisposable)?.Dispose();
|
||||
watcher.Dispose();
|
||||
(innerProxy as IDisposable)?.Dispose();
|
||||
}
|
||||
|
||||
public void OnSystemProxySettingsChanged()
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
namespace Snap.Hutao.Core.Threading;
|
||||
|
||||
[Obsolete]
|
||||
internal readonly struct Delay
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using Snap.Hutao.Core.Database;
|
||||
using Snap.Hutao.Core.Database.Abstraction;
|
||||
using Snap.Hutao.Model;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
@@ -9,6 +9,7 @@ namespace Snap.Hutao.Message;
|
||||
/// 成就存档切换消息
|
||||
/// </summary>
|
||||
[HighQuality]
|
||||
[Obsolete]
|
||||
internal sealed class AchievementArchiveChangedMessage : ValueChangedMessage<AchievementArchive>
|
||||
{
|
||||
}
|
||||
@@ -3,4 +3,5 @@
|
||||
|
||||
namespace Snap.Hutao.Message;
|
||||
|
||||
[Obsolete]
|
||||
internal sealed class BackgroundImageTypeChangedMessage;
|
||||
@@ -9,6 +9,7 @@ namespace Snap.Hutao.Message;
|
||||
/// 养成计划切换消息
|
||||
/// </summary>
|
||||
[HighQuality]
|
||||
[Obsolete]
|
||||
internal sealed class CultivateProjectChangedMessage : ValueChangedMessage<CultivateProject>
|
||||
{
|
||||
}
|
||||
@@ -9,6 +9,7 @@ namespace Snap.Hutao.Message;
|
||||
/// 祈愿记录存档切换消息
|
||||
/// </summary>
|
||||
[HighQuality]
|
||||
[Obsolete]
|
||||
internal sealed class GachaArchiveChangedMessage : ValueChangedMessage<GachaArchive>
|
||||
{
|
||||
}
|
||||
@@ -12,6 +12,7 @@ namespace Snap.Hutao.Message;
|
||||
/// </summary>
|
||||
[HighQuality]
|
||||
[DebuggerDisplay("{DebuggerDisplay(),nq}")]
|
||||
[Obsolete]
|
||||
internal sealed class UserChangedMessage : ValueChangedMessage<User>
|
||||
{
|
||||
// defaults to the UserAndRoleChanged when we raise this message in ScopedDbCurrent
|
||||
|
||||
@@ -9,6 +9,7 @@ namespace Snap.Hutao.Message;
|
||||
/// 用户删除消息
|
||||
/// </summary>
|
||||
[HighQuality]
|
||||
[Obsolete]
|
||||
internal sealed class UserRemovedMessage
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -8,6 +8,7 @@ namespace Snap.Hutao.Message;
|
||||
/// </summary>
|
||||
/// <typeparam name="TValue">值的类型</typeparam>
|
||||
[HighQuality]
|
||||
[Obsolete]
|
||||
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)]
|
||||
internal abstract class ValueChangedMessage<TValue>
|
||||
where TValue : class
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using Snap.Hutao.Core.Abstraction;
|
||||
using Snap.Hutao.Core.Database;
|
||||
using Snap.Hutao.Core.Database.Abstraction;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using Snap.Hutao.Core.Abstraction;
|
||||
using Snap.Hutao.Core.Database;
|
||||
using Snap.Hutao.Core.Database.Abstraction;
|
||||
using Snap.Hutao.Model.Entity.Abstraction;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using Snap.Hutao.Core.Abstraction;
|
||||
using Snap.Hutao.Core.Database;
|
||||
using Snap.Hutao.Core.Database.Abstraction;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using Snap.Hutao.Core.Abstraction;
|
||||
using Snap.Hutao.Core.Database;
|
||||
using Snap.Hutao.Core.Database.Abstraction;
|
||||
using Snap.Hutao.Model.Entity.Primitive;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using Snap.Hutao.Core.Abstraction;
|
||||
using Snap.Hutao.Core.Database;
|
||||
using Snap.Hutao.Core.Database.Abstraction;
|
||||
using Snap.Hutao.Web.Hoyolab;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Snap.Hutao.Core.Database;
|
||||
using Snap.Hutao.Model.Entity.Database;
|
||||
using System.Globalization;
|
||||
@@ -115,7 +116,7 @@ internal abstract partial class DbStoreOptions : ObservableObject
|
||||
using (IServiceScope scope = serviceProvider.CreateScope())
|
||||
{
|
||||
AppDbContext appDbContext = scope.ServiceProvider.GetRequiredService<AppDbContext>();
|
||||
appDbContext.Settings.ExecuteDeleteWhere(e => e.Key == key);
|
||||
appDbContext.Settings.Where(e => e.Key == key).ExecuteDelete();
|
||||
appDbContext.Settings.AddAndSave(new(key, value));
|
||||
}
|
||||
}
|
||||
@@ -131,7 +132,7 @@ internal abstract partial class DbStoreOptions : ObservableObject
|
||||
using (IServiceScope scope = serviceProvider.CreateScope())
|
||||
{
|
||||
AppDbContext appDbContext = scope.ServiceProvider.GetRequiredService<AppDbContext>();
|
||||
appDbContext.Settings.ExecuteDeleteWhere(e => e.Key == key);
|
||||
appDbContext.Settings.Where(e => e.Key == key).ExecuteDelete();
|
||||
appDbContext.Settings.AddAndSave(new(key, value.ToString()));
|
||||
}
|
||||
|
||||
@@ -148,7 +149,7 @@ internal abstract partial class DbStoreOptions : ObservableObject
|
||||
using (IServiceScope scope = serviceProvider.CreateScope())
|
||||
{
|
||||
AppDbContext appDbContext = scope.ServiceProvider.GetRequiredService<AppDbContext>();
|
||||
appDbContext.Settings.ExecuteDeleteWhere(e => e.Key == key);
|
||||
appDbContext.Settings.Where(e => e.Key == key).ExecuteDelete();
|
||||
appDbContext.Settings.AddAndSave(new(key, $"{value}"));
|
||||
}
|
||||
}
|
||||
@@ -163,7 +164,7 @@ internal abstract partial class DbStoreOptions : ObservableObject
|
||||
using (IServiceScope scope = serviceProvider.CreateScope())
|
||||
{
|
||||
AppDbContext appDbContext = scope.ServiceProvider.GetRequiredService<AppDbContext>();
|
||||
appDbContext.Settings.ExecuteDeleteWhere(e => e.Key == key);
|
||||
appDbContext.Settings.Where(e => e.Key == key).ExecuteDelete();
|
||||
appDbContext.Settings.AddAndSave(new(key, serializer(value)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using Snap.Hutao.Core.Abstraction.Extension;
|
||||
using Snap.Hutao.Core.Abstraction;
|
||||
using Snap.Hutao.Model.Intrinsic;
|
||||
using Snap.Hutao.Model.Metadata.Avatar;
|
||||
using Snap.Hutao.Model.Metadata.Converter;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using Snap.Hutao.Core.Abstraction.Extension;
|
||||
using Snap.Hutao.Core.Abstraction;
|
||||
using Snap.Hutao.Model;
|
||||
using Snap.Hutao.Model.Intrinsic;
|
||||
using Snap.Hutao.ViewModel.AvatarProperty;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using Snap.Hutao.Core.Abstraction.Extension;
|
||||
using Snap.Hutao.Core.Abstraction;
|
||||
using Snap.Hutao.ViewModel.AvatarProperty;
|
||||
|
||||
namespace Snap.Hutao.Service.AvatarInfo.Factory.Builder;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using Snap.Hutao.Core.Abstraction.Extension;
|
||||
using Snap.Hutao.Core.Abstraction;
|
||||
using Snap.Hutao.Model;
|
||||
using Snap.Hutao.Model.Intrinsic;
|
||||
using Snap.Hutao.ViewModel.AvatarProperty;
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using Snap.Hutao.Core.Abstraction;
|
||||
using Snap.Hutao.Core.Abstraction.Extension;
|
||||
|
||||
namespace Snap.Hutao.Service.AvatarInfo.Factory.Builder;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using Snap.Hutao.Core.Abstraction.Extension;
|
||||
using Snap.Hutao.Core.Abstraction;
|
||||
using Snap.Hutao.Model;
|
||||
using Snap.Hutao.Model.Intrinsic;
|
||||
using Snap.Hutao.Model.Metadata.Converter;
|
||||
|
||||
@@ -68,7 +68,8 @@ internal sealed partial class GachaLogDbService : IGachaLogDbService
|
||||
{
|
||||
AppDbContext appDbContext = scope.ServiceProvider.GetRequiredService<AppDbContext>();
|
||||
await appDbContext.GachaArchives
|
||||
.ExecuteDeleteWhereAsync(a => a.InnerId == archiveId)
|
||||
.Where(a => a.InnerId == archiveId)
|
||||
.ExecuteDeleteAsync()
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ internal sealed partial class GameDbService : IGameDbService
|
||||
using (IServiceScope scope = serviceProvider.CreateScope())
|
||||
{
|
||||
AppDbContext appDbContext = scope.ServiceProvider.GetRequiredService<AppDbContext>();
|
||||
await appDbContext.GameAccounts.ExecuteDeleteWhereAsync(a => a.InnerId == id).ConfigureAwait(false);
|
||||
await appDbContext.GameAccounts.Where(a => a.InnerId == id).ExecuteDeleteAsync().ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Snap.Hutao.Core.Abstraction.Extension;
|
||||
using Snap.Hutao.Core.Abstraction;
|
||||
|
||||
namespace Snap.Hutao.Service.Notification;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using Snap.Hutao.Core.Abstraction.Extension;
|
||||
using Snap.Hutao.Core.Abstraction;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace Snap.Hutao.Service.Notification;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Snap.Hutao.Core.Abstraction.Extension;
|
||||
using Snap.Hutao.Core.Abstraction;
|
||||
|
||||
namespace Snap.Hutao.Service.Notification;
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ internal sealed partial class UserDbService : IUserDbService
|
||||
using (IServiceScope scope = serviceProvider.CreateScope())
|
||||
{
|
||||
AppDbContext appDbContext = scope.ServiceProvider.GetRequiredService<AppDbContext>();
|
||||
await appDbContext.Users.ExecuteDeleteWhereAsync(u => u.InnerId == id).ConfigureAwait(false);
|
||||
await appDbContext.Users.Where(u => u.InnerId == id).ExecuteDeleteAsync().ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@ using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Media;
|
||||
using Microsoft.UI.Xaml.Media.Imaging;
|
||||
using Snap.Hutao.Core.Caching;
|
||||
using Snap.Hutao.Core.DataTransfer;
|
||||
using Snap.Hutao.Core.ExceptionService;
|
||||
using Snap.Hutao.Core.IO.DataTransfer;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using Windows.Graphics.Imaging;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using Snap.Hutao.Core.IO.DataTransfer;
|
||||
using Snap.Hutao.Core.DataTransfer;
|
||||
using Snap.Hutao.Factory.ContentDialog;
|
||||
using Snap.Hutao.Factory.Picker;
|
||||
using Snap.Hutao.Service.Achievement;
|
||||
|
||||
@@ -5,9 +5,9 @@ using CommunityToolkit.Mvvm.Messaging;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Microsoft.UI.Xaml.Media.Imaging;
|
||||
using Snap.Hutao.Core.DataTransfer;
|
||||
using Snap.Hutao.Core.ExceptionService;
|
||||
using Snap.Hutao.Core.Graphics.Imaging;
|
||||
using Snap.Hutao.Core.IO.DataTransfer;
|
||||
using Snap.Hutao.Factory.ContentDialog;
|
||||
using Snap.Hutao.Message;
|
||||
using Snap.Hutao.Model.Calculable;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Snap.Hutao.Core;
|
||||
using Snap.Hutao.Core.IO.DataTransfer;
|
||||
using Snap.Hutao.Core.DataTransfer;
|
||||
using Snap.Hutao.Core.IO.Http.Loopback;
|
||||
using Snap.Hutao.Core.IO.Http.Proxy;
|
||||
using Snap.Hutao.Factory.ContentDialog;
|
||||
|
||||
@@ -5,6 +5,7 @@ using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
using Snap.Hutao.Core.Abstraction;
|
||||
using Snap.Hutao.Core.Database;
|
||||
using Snap.Hutao.Core.Database.Abstraction;
|
||||
using Snap.Hutao.Model;
|
||||
using Snap.Hutao.Model.Entity.Database;
|
||||
using Snap.Hutao.Web.Hoyolab;
|
||||
|
||||
@@ -6,8 +6,8 @@ using Microsoft.UI.Xaml.Controls;
|
||||
using Microsoft.UI.Xaml.Controls.Primitives;
|
||||
using Snap.Hutao.Core;
|
||||
using Snap.Hutao.Core.Database;
|
||||
using Snap.Hutao.Core.DataTransfer;
|
||||
using Snap.Hutao.Core.ExceptionService;
|
||||
using Snap.Hutao.Core.IO.DataTransfer;
|
||||
using Snap.Hutao.Factory.ContentDialog;
|
||||
using Snap.Hutao.Service.Navigation;
|
||||
using Snap.Hutao.Service.Notification;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using Microsoft.Web.WebView2.Core;
|
||||
using Snap.Hutao.Core.IO.DataTransfer;
|
||||
using Snap.Hutao.Core.DataTransfer;
|
||||
using Snap.Hutao.Service.Notification;
|
||||
using System.Net.Http;
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using Microsoft.Web.WebView2.Core;
|
||||
using Snap.Hutao.Core.DataTransfer;
|
||||
using Snap.Hutao.Core.DependencyInjection.Abstraction;
|
||||
using Snap.Hutao.Core.IO.DataTransfer;
|
||||
using Snap.Hutao.Service;
|
||||
using Snap.Hutao.Service.Notification;
|
||||
using Snap.Hutao.Service.User;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using Snap.Hutao.Core.IO.DataTransfer;
|
||||
using Snap.Hutao.Core.DataTransfer;
|
||||
using Snap.Hutao.Service.Notification;
|
||||
|
||||
namespace Snap.Hutao.Web.Hoyolab.HoyoPlay.Connect;
|
||||
|
||||
@@ -28,7 +28,7 @@ internal sealed partial class HutaoLogUploadClient
|
||||
/// </summary>
|
||||
/// <param name="exception">异常</param>
|
||||
/// <returns>任务</returns>
|
||||
public async ValueTask<string?> UploadLogAsync(Exception exception)
|
||||
public async Task<string?> UploadLogAsync(Exception exception)
|
||||
{
|
||||
HttpRequestMessageBuilder builder = httpRequestMessageBuilderFactory.Create()
|
||||
.SetRequestUri(HutaoEndpoints.HutaoLogUpload)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using Snap.Hutao.Core.Abstraction.Extension;
|
||||
using Snap.Hutao.Core.Abstraction;
|
||||
using Snap.Hutao.Web.Request.Builder.Abstraction;
|
||||
using System.Diagnostics;
|
||||
using System.Net.Http;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using Snap.Hutao.Core.Abstraction.Extension;
|
||||
using Snap.Hutao.Core.Abstraction;
|
||||
using Snap.Hutao.Web.Request.Builder.Abstraction;
|
||||
using System.Diagnostics;
|
||||
using System.Net.Http.Headers;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using Snap.Hutao.Core.Abstraction.Extension;
|
||||
using Snap.Hutao.Core.Abstraction;
|
||||
using Snap.Hutao.Web.Request.Builder.Abstraction;
|
||||
using System.Diagnostics;
|
||||
using System.Net.Http;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using Snap.Hutao.Core.Abstraction.Extension;
|
||||
using Snap.Hutao.Core.Abstraction;
|
||||
using Snap.Hutao.Web.Request.Builder.Abstraction;
|
||||
using System.Diagnostics;
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ internal static class AdvApi32
|
||||
|
||||
[DllImport("ADVAPI32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)]
|
||||
[SupportedOSPlatform("windows5.0")]
|
||||
public static extern WIN32_ERROR RegNotifyChangeKeyValue(HKEY hKey, BOOL bWatchSubtree, REG_NOTIFY_FILTER dwNotifyFilter, [AllowNull] Foundation.HANDLE hEvent, BOOL fAsynchronous);
|
||||
public static extern WIN32_ERROR RegNotifyChangeKeyValue(HKEY hKey, BOOL bWatchSubtree, REG_NOTIFY_FILTER dwNotifyFilter, [AllowNull] HANDLE hEvent, BOOL fAsynchronous);
|
||||
|
||||
[DllImport("ADVAPI32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)]
|
||||
[SupportedOSPlatform("windows5.0")]
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using Google.OrTools.ConstraintSolver;
|
||||
using Snap.Hutao.Win32.Security;
|
||||
using Windows.ApplicationModel.VoiceCommands;
|
||||
|
||||
namespace Snap.Hutao.Win32.Foundation;
|
||||
|
||||
@@ -10,4 +12,6 @@ internal struct PSID
|
||||
public unsafe void* Value;
|
||||
|
||||
public static unsafe implicit operator PSID(SID* value) => *(PSID*)&value;
|
||||
|
||||
public static unsafe implicit operator void*(PSID value) => *(void**)&value;
|
||||
}
|
||||
@@ -5,6 +5,7 @@ using Snap.Hutao.Win32.Foundation;
|
||||
using Snap.Hutao.Win32.Security;
|
||||
using Snap.Hutao.Win32.System.Console;
|
||||
using Snap.Hutao.Win32.System.LibraryLoader;
|
||||
using Snap.Hutao.Win32.System.Memory;
|
||||
using Snap.Hutao.Win32.System.ProcessStatus;
|
||||
using Snap.Hutao.Win32.System.Threading;
|
||||
using System.Diagnostics;
|
||||
@@ -22,14 +23,14 @@ internal static class Kernel32
|
||||
|
||||
[DllImport("KERNEL32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)]
|
||||
[SupportedOSPlatform("windows5.0")]
|
||||
public static extern BOOL CloseHandle(Foundation.HANDLE hObject);
|
||||
public static extern BOOL CloseHandle(HANDLE hObject);
|
||||
|
||||
[DllImport("KERNEL32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)]
|
||||
[SupportedOSPlatform("windows5.1.2600")]
|
||||
public static unsafe extern Foundation.HANDLE CreateEventW([AllowNull] SECURITY_ATTRIBUTES* lpEventAttributes, BOOL bManualReset, BOOL bInitialState, [AllowNull] PCWSTR lpName);
|
||||
public static unsafe extern HANDLE CreateEventW([AllowNull] SECURITY_ATTRIBUTES* lpEventAttributes, BOOL bManualReset, BOOL bInitialState, [AllowNull] PCWSTR lpName);
|
||||
|
||||
[DebuggerStepThrough]
|
||||
public static unsafe Foundation.HANDLE CreateEventW(ref readonly SECURITY_ATTRIBUTES eventAttributes, BOOL bManualReset, BOOL bInitialState, [AllowNull] ReadOnlySpan<char> name)
|
||||
public static unsafe HANDLE CreateEventW(ref readonly SECURITY_ATTRIBUTES eventAttributes, BOOL bManualReset, BOOL bInitialState, [AllowNull] ReadOnlySpan<char> name)
|
||||
{
|
||||
fixed (SECURITY_ATTRIBUTES* lpEventAttributes = &eventAttributes)
|
||||
{
|
||||
@@ -48,11 +49,11 @@ internal static class Kernel32
|
||||
public static extern BOOL FreeLibrary(HMODULE hLibModule);
|
||||
|
||||
[DllImport("KERNEL32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)]
|
||||
public static unsafe extern BOOL GetConsoleMode(Foundation.HANDLE hConsoleHandle, CONSOLE_MODE* lpMode);
|
||||
public static unsafe extern BOOL GetConsoleMode(HANDLE hConsoleHandle, CONSOLE_MODE* lpMode);
|
||||
|
||||
[SuppressMessage("", "SH002")]
|
||||
[DebuggerStepThrough]
|
||||
public static unsafe BOOL GetConsoleMode(Foundation.HANDLE hConsoleHandle, out CONSOLE_MODE mode)
|
||||
public static unsafe BOOL GetConsoleMode(HANDLE hConsoleHandle, out CONSOLE_MODE mode)
|
||||
{
|
||||
fixed (CONSOLE_MODE* lpMode = &mode)
|
||||
{
|
||||
@@ -65,13 +66,21 @@ internal static class Kernel32
|
||||
public static extern WIN32_ERROR GetLastError();
|
||||
|
||||
[DllImport("KERNEL32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)]
|
||||
public static extern Foundation.HANDLE GetStdHandle(STD_HANDLE nStdHandle);
|
||||
[SupportedOSPlatform("windows5.1.2600")]
|
||||
public static extern HANDLE GetProcessHeap();
|
||||
|
||||
[DllImport("KERNEL32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)]
|
||||
public static unsafe extern BOOL K32EnumProcessModules(Foundation.HANDLE hProcess, HMODULE* lphModule, uint cb, uint* lpcbNeeded);
|
||||
public static extern HANDLE GetStdHandle(STD_HANDLE nStdHandle);
|
||||
|
||||
[DllImport("KERNEL32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)]
|
||||
[SupportedOSPlatform("windows5.1.2600")]
|
||||
public static unsafe extern BOOL HeapFree(HANDLE hHeap, HEAP_FLAGS dwFlags, [AllowNull] void* lpMem);
|
||||
|
||||
[DllImport("KERNEL32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)]
|
||||
public static unsafe extern BOOL K32EnumProcessModules(HANDLE hProcess, HMODULE* lphModule, uint cb, uint* lpcbNeeded);
|
||||
|
||||
[DebuggerStepThrough]
|
||||
public static unsafe BOOL K32EnumProcessModules(Foundation.HANDLE hProcess, Span<HMODULE> hModules, out uint cbNeeded)
|
||||
public static unsafe BOOL K32EnumProcessModules(HANDLE hProcess, Span<HMODULE> hModules, out uint cbNeeded)
|
||||
{
|
||||
fixed (HMODULE* lphModule = hModules)
|
||||
{
|
||||
@@ -83,10 +92,10 @@ internal static class Kernel32
|
||||
}
|
||||
|
||||
[DllImport("KERNEL32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)]
|
||||
public static extern uint K32GetModuleBaseNameW(Foundation.HANDLE hProcess, [AllowNull] HMODULE hModule, PWSTR lpBaseName, uint nSize);
|
||||
public static extern uint K32GetModuleBaseNameW(HANDLE hProcess, [AllowNull] HMODULE hModule, PWSTR lpBaseName, uint nSize);
|
||||
|
||||
[DebuggerStepThrough]
|
||||
public static unsafe uint K32GetModuleBaseNameW(Foundation.HANDLE hProcess, [AllowNull] HMODULE hModule, Span<char> baseName)
|
||||
public static unsafe uint K32GetModuleBaseNameW(HANDLE hProcess, [AllowNull] HMODULE hModule, Span<char> baseName)
|
||||
{
|
||||
fixed (char* lpBaseName = baseName)
|
||||
{
|
||||
@@ -95,10 +104,10 @@ internal static class Kernel32
|
||||
}
|
||||
|
||||
[DllImport("KERNEL32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)]
|
||||
public static unsafe extern BOOL K32GetModuleInformation(Foundation.HANDLE hProcess, HMODULE hModule, MODULEINFO* lpmodinfo, uint cb);
|
||||
public static unsafe extern BOOL K32GetModuleInformation(HANDLE hProcess, HMODULE hModule, MODULEINFO* lpmodinfo, uint cb);
|
||||
|
||||
[DebuggerStepThrough]
|
||||
public static unsafe BOOL K32GetModuleInformation(Foundation.HANDLE hProcess, HMODULE hModule, out MODULEINFO modinfo)
|
||||
public static unsafe BOOL K32GetModuleInformation(HANDLE hProcess, HMODULE hModule, out MODULEINFO modinfo)
|
||||
{
|
||||
fixed (MODULEINFO* lpmodinfo = &modinfo)
|
||||
{
|
||||
@@ -108,10 +117,10 @@ internal static class Kernel32
|
||||
|
||||
[DllImport("KERNEL32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)]
|
||||
[SupportedOSPlatform("windows5.1.2600")]
|
||||
public static extern HMODULE LoadLibraryExW(PCWSTR lpLibFileName, [AllowNull] Foundation.HANDLE hFile, LOAD_LIBRARY_FLAGS dwFlags);
|
||||
public static extern HMODULE LoadLibraryExW(PCWSTR lpLibFileName, [AllowNull] HANDLE hFile, LOAD_LIBRARY_FLAGS dwFlags);
|
||||
|
||||
[DebuggerStepThrough]
|
||||
public static unsafe HMODULE LoadLibraryExW(ReadOnlySpan<char> libFileName, [AllowNull] Foundation.HANDLE hFile, LOAD_LIBRARY_FLAGS dwFlags)
|
||||
public static unsafe HMODULE LoadLibraryExW(ReadOnlySpan<char> libFileName, [AllowNull] HANDLE hFile, LOAD_LIBRARY_FLAGS dwFlags)
|
||||
{
|
||||
fixed (char* lpLibFileName = libFileName)
|
||||
{
|
||||
@@ -121,14 +130,14 @@ internal static class Kernel32
|
||||
|
||||
[DllImport("KERNEL32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)]
|
||||
[SupportedOSPlatform("windows5.1.2600")]
|
||||
public static extern Foundation.HANDLE OpenProcess(PROCESS_ACCESS_RIGHTS dwDesiredAccess, BOOL bInheritHandle, uint dwProcessId);
|
||||
public static extern HANDLE OpenProcess(PROCESS_ACCESS_RIGHTS dwDesiredAccess, BOOL bInheritHandle, uint dwProcessId);
|
||||
|
||||
[DllImport("KERNEL32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)]
|
||||
[SupportedOSPlatform("windows5.1.2600")]
|
||||
public static unsafe extern BOOL ReadProcessMemory(Foundation.HANDLE hProcess, void* lpBaseAddress, void* lpBuffer, nuint nSize, [MaybeNull] nuint* lpNumberOfBytesRead);
|
||||
public static unsafe extern BOOL ReadProcessMemory(HANDLE hProcess, void* lpBaseAddress, void* lpBuffer, nuint nSize, [MaybeNull] nuint* lpNumberOfBytesRead);
|
||||
|
||||
[DebuggerStepThrough]
|
||||
public static unsafe BOOL ReadProcessMemory(Foundation.HANDLE hProcess, void* lpBaseAddress, Span<byte> buffer, [MaybeNull] out nuint numberOfBytesRead)
|
||||
public static unsafe BOOL ReadProcessMemory(HANDLE hProcess, void* lpBaseAddress, Span<byte> buffer, [MaybeNull] out nuint numberOfBytesRead)
|
||||
{
|
||||
fixed (byte* lpBuffer = buffer)
|
||||
{
|
||||
@@ -140,7 +149,7 @@ internal static class Kernel32
|
||||
}
|
||||
|
||||
[DebuggerStepThrough]
|
||||
public static unsafe BOOL ReadProcessMemory<T>(Foundation.HANDLE hProcess, void* lpBaseAddress, ref T buffer, [MaybeNull] out nuint numberOfBytesRead)
|
||||
public static unsafe BOOL ReadProcessMemory<T>(HANDLE hProcess, void* lpBaseAddress, ref T buffer, [MaybeNull] out nuint numberOfBytesRead)
|
||||
where T : unmanaged
|
||||
{
|
||||
fixed (T* lpBuffer = &buffer)
|
||||
@@ -153,7 +162,7 @@ internal static class Kernel32
|
||||
}
|
||||
|
||||
[DllImport("KERNEL32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)]
|
||||
public static extern BOOL SetConsoleMode(Foundation.HANDLE hConsoleHandle, CONSOLE_MODE dwMode);
|
||||
public static extern BOOL SetConsoleMode(HANDLE hConsoleHandle, CONSOLE_MODE dwMode);
|
||||
|
||||
[DllImport("KERNEL32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)]
|
||||
public static extern BOOL SetConsoleTitleW(PCWSTR lpConsoleTitle);
|
||||
@@ -169,14 +178,14 @@ internal static class Kernel32
|
||||
|
||||
[DllImport("KERNEL32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)]
|
||||
[SupportedOSPlatform("windows5.1.2600")]
|
||||
public static extern BOOL SetEvent(Foundation.HANDLE hEvent);
|
||||
public static extern BOOL SetEvent(HANDLE hEvent);
|
||||
|
||||
[DllImport("KERNEL32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)]
|
||||
[SupportedOSPlatform("windows5.1.2600")]
|
||||
public static unsafe extern BOOL WriteProcessMemory(Foundation.HANDLE hProcess, void* lpBaseAddress, void* lpBuffer, nuint nSize, nuint* lpNumberOfBytesWritten);
|
||||
public static unsafe extern BOOL WriteProcessMemory(HANDLE hProcess, void* lpBaseAddress, void* lpBuffer, nuint nSize, nuint* lpNumberOfBytesWritten);
|
||||
|
||||
[DebuggerStepThrough]
|
||||
public static unsafe BOOL WriteProcessMemory(Foundation.HANDLE hProcess, void* lpBaseAddress, ReadOnlySpan<byte> buffer, out nuint numberOfBytesWritten)
|
||||
public static unsafe BOOL WriteProcessMemory(HANDLE hProcess, void* lpBaseAddress, ReadOnlySpan<byte> buffer, out nuint numberOfBytesWritten)
|
||||
{
|
||||
fixed (byte* lpBuffer = buffer)
|
||||
{
|
||||
@@ -188,7 +197,7 @@ internal static class Kernel32
|
||||
}
|
||||
|
||||
[DebuggerStepThrough]
|
||||
public static unsafe BOOL WriteProcessMemory<T>(Foundation.HANDLE hProcess, void* lpBaseAddress, ref readonly T buffer, out nuint numberOfBytesWritten)
|
||||
public static unsafe BOOL WriteProcessMemory<T>(HANDLE hProcess, void* lpBaseAddress, ref readonly T buffer, out nuint numberOfBytesWritten)
|
||||
where T : unmanaged
|
||||
{
|
||||
fixed (T* lpBuffer = &buffer)
|
||||
|
||||
@@ -39,13 +39,13 @@ internal static class Ole32
|
||||
public static unsafe extern void CoTaskMemFree([AllowNull] void* pv);
|
||||
|
||||
[DllImport("OLE32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)]
|
||||
public static unsafe extern HRESULT CoWaitForMultipleObjects(uint dwFlags, uint dwTimeout, uint cHandles, Foundation.HANDLE* pHandles, uint* lpdwindex);
|
||||
public static unsafe extern HRESULT CoWaitForMultipleObjects(uint dwFlags, uint dwTimeout, uint cHandles, HANDLE* pHandles, uint* lpdwindex);
|
||||
|
||||
[SuppressMessage("", "SH002")]
|
||||
[DebuggerStepThrough]
|
||||
public static unsafe HRESULT CoWaitForMultipleObjects(CWMO_FLAGS dwFlags, uint dwTimeout, ReadOnlySpan<Foundation.HANDLE> handles, out uint dwindex)
|
||||
public static unsafe HRESULT CoWaitForMultipleObjects(CWMO_FLAGS dwFlags, uint dwTimeout, ReadOnlySpan<HANDLE> handles, out uint dwindex)
|
||||
{
|
||||
fixed (Foundation.HANDLE* pHandles = handles)
|
||||
fixed (HANDLE* pHandles = handles)
|
||||
{
|
||||
fixed (uint* lpdwindex = &dwindex)
|
||||
{
|
||||
|
||||
26
src/Snap.Hutao/Snap.Hutao/Win32/System/Memory/HEAP_FLAGS.cs
Normal file
26
src/Snap.Hutao/Snap.Hutao/Win32/System/Memory/HEAP_FLAGS.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
namespace Snap.Hutao.Win32.System.Memory;
|
||||
|
||||
[Flags]
|
||||
internal enum HEAP_FLAGS : uint
|
||||
{
|
||||
HEAP_NONE = 0U,
|
||||
HEAP_NO_SERIALIZE = 1U,
|
||||
HEAP_GROWABLE = 2U,
|
||||
HEAP_GENERATE_EXCEPTIONS = 4U,
|
||||
HEAP_ZERO_MEMORY = 8U,
|
||||
HEAP_REALLOC_IN_PLACE_ONLY = 0x10U,
|
||||
HEAP_TAIL_CHECKING_ENABLED = 0x20U,
|
||||
HEAP_FREE_CHECKING_ENABLED = 0x40U,
|
||||
HEAP_DISABLE_COALESCE_ON_FREE = 0x80U,
|
||||
HEAP_CREATE_ALIGN_16 = 0x10000U,
|
||||
HEAP_CREATE_ENABLE_TRACING = 0x20000U,
|
||||
HEAP_CREATE_ENABLE_EXECUTE = 0x40000U,
|
||||
HEAP_MAXIMUM_TAG = 0xFFFU,
|
||||
HEAP_PSEUDO_TAG_FLAG = 0x8000U,
|
||||
HEAP_TAG_SHIFT = 0x12U,
|
||||
HEAP_CREATE_SEGMENT_HEAP = 0x100U,
|
||||
HEAP_CREATE_HARDENED = 0x200U,
|
||||
}
|
||||
@@ -214,10 +214,10 @@ internal static class User32
|
||||
|
||||
[DllImport("USER32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)]
|
||||
[SupportedOSPlatform("windows5.0")]
|
||||
public static extern Foundation.HANDLE RemovePropW(HWND hWnd, PCWSTR lpString);
|
||||
public static extern HANDLE RemovePropW(HWND hWnd, PCWSTR lpString);
|
||||
|
||||
[DebuggerStepThrough]
|
||||
public static unsafe Foundation.HANDLE RemovePropW(HWND hWnd, string @string)
|
||||
public static unsafe HANDLE RemovePropW(HWND hWnd, string @string)
|
||||
{
|
||||
fixed (char* lpString = @string)
|
||||
{
|
||||
@@ -248,10 +248,10 @@ internal static class User32
|
||||
|
||||
[DllImport("USER32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)]
|
||||
[SupportedOSPlatform("windows5.0")]
|
||||
public static extern BOOL SetPropW(HWND hWnd, PCWSTR lpString, [AllowNull] Foundation.HANDLE hData);
|
||||
public static extern BOOL SetPropW(HWND hWnd, PCWSTR lpString, [AllowNull] HANDLE hData);
|
||||
|
||||
[DebuggerStepThrough]
|
||||
public static unsafe BOOL SetPropW(HWND hWnd, string @string, [AllowNull] Foundation.HANDLE hData)
|
||||
public static unsafe BOOL SetPropW(HWND hWnd, string @string, [AllowNull] HANDLE hData)
|
||||
{
|
||||
fixed (char* lpString = @string)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user