remove redundant attribute

This commit is contained in:
DismissedLight
2023-08-26 17:08:18 +08:00
parent d872639c19
commit 1d8ee4cee5
11 changed files with 5 additions and 46 deletions

View File

@@ -25,7 +25,6 @@ internal static class AppInstanceExtension
/// </summary>
/// <param name="appInstance">app实例</param>
/// <param name="args">参数</param>
[SuppressMessage("", "VSTHRD002")]
public static unsafe void RedirectActivationTo(this AppInstance appInstance, AppActivationArguments args)
{
redirectEventHandle = CreateEvent(default(SECURITY_ATTRIBUTES*), true, false, null);

View File

@@ -11,19 +11,16 @@ internal readonly struct Delay
/// <param name="minMilliSeconds">最小,闭</param>
/// <param name="maxMilliSeconds">最小,开</param>
/// <returns>任务</returns>
[SuppressMessage("", "VSTHRD200")]
public static ValueTask Random(int minMilliSeconds, int maxMilliSeconds)
{
return Task.Delay((int)(System.Random.Shared.NextDouble() * (maxMilliSeconds - minMilliSeconds)) + minMilliSeconds).AsValueTask();
}
[SuppressMessage("", "VSTHRD200")]
public static ValueTask FromSeconds(int seconds)
{
return Task.Delay(TimeSpan.FromSeconds(seconds)).AsValueTask();
}
[SuppressMessage("", "VSTHRD200")]
public static ValueTask FromMilliSeconds(int seconds)
{
return Task.Delay(TimeSpan.FromMilliseconds(seconds)).AsValueTask();

View File

@@ -21,7 +21,6 @@ internal class DispatcherQueueProgress<T> : IProgress<T>
public event EventHandler<T>? ProgressChanged;
[SuppressMessage("", "VSTHRD001")]
public void Report(T value)
{
Action<T>? handler = this.handler;

View File

@@ -225,14 +225,8 @@ internal sealed partial class GameService : IGameService
return false;
}
if (launchOptions.MultipleInstances)
{
// If multiple instances is enabled, always treat as not running.
return false;
}
return Process.GetProcessesByName(YuanShenProcessName).Any()
|| Process.GetProcessesByName(GenshinImpactProcessName).Any();
return Process.GetProcessesByName(YuanShenProcessName) is [_, ..]
|| Process.GetProcessesByName(GenshinImpactProcessName) is [_, ..];
}
/// <inheritdoc/>
@@ -254,13 +248,7 @@ internal sealed partial class GameService : IGameService
game.Start();
bool isAdvancedOptionsAllowed = runtimeOptions.IsElevated && appOptions.IsAdvancedLaunchOptionsEnabled;
if (isAdvancedOptionsAllowed && launchOptions.MultipleInstances && !isFirstInstance)
{
ProcessInterop.DisableProtection(game, gamePath);
}
if (isAdvancedOptionsAllowed && launchOptions.UnlockFps)
if (runtimeOptions.IsElevated && appOptions.IsAdvancedLaunchOptionsEnabled && launchOptions.UnlockFps)
{
await ProcessInterop.UnlockFpsAsync(serviceProvider, game, default).ConfigureAwait(false);
}

View File

@@ -31,7 +31,6 @@ internal sealed class LaunchOptions : DbStoreOptions
private bool? unlockFps;
private int? targetFps;
private NameValue<int>? monitor;
private bool? multipleInstances;
/// <summary>
/// 构造一个新的启动游戏选项
@@ -151,15 +150,6 @@ internal sealed class LaunchOptions : DbStoreOptions
}
}
/// <summary>
/// 多开启动原神
/// </summary>
public bool MultipleInstances
{
get => GetOption(ref multipleInstances, SettingEntry.MultipleInstances);
set => SetOption(ref multipleInstances, SettingEntry.MultipleInstances, value);
}
private static void InitializeMonitors(List<NameValue<int>> monitors)
{
// This list can't use foreach

View File

@@ -214,17 +214,6 @@
<StackPanel Spacing="{StaticResource SettingsCardSpacing}" Visibility="{Binding AppOptions.IsAdvancedLaunchOptionsEnabled, Converter={StaticResource BoolToVisibilityConverter}}">
<TextBlock Style="{StaticResource SettingsSectionHeaderTextBlockStyle}" Text="{shcm:ResourceString Name=ViewPageLaunchGameAdvanceHeader}"/>
<cwc:SettingsCard
Description="{shcm:ResourceString Name=ViewPageLaunchGameMultipleInstancesDescription}"
Header="{shcm:ResourceString Name=ViewPageLaunchGameMultipleInstancesHeader}"
HeaderIcon="{shcm:FontIcon Glyph=&#xE7C4;}"
IsEnabled="{Binding HutaoOptions.IsElevated}">
<StackPanel Orientation="Horizontal">
<shvc:Elevation Visibility="{Binding HutaoOptions.IsElevated, Converter={StaticResource BoolToVisibilityRevertConverter}}"/>
<ToggleSwitch Width="120" IsOn="{Binding Options.MultipleInstances, Mode=TwoWay}"/>
</StackPanel>
</cwc:SettingsCard>
<cwc:SettingsCard
Description="{shcm:ResourceString Name=ViewPageLaunchGameUnlockFpsDescription}"
Header="{shcm:ResourceString Name=ViewPageLaunchGameUnlockFpsHeader}"

View File

@@ -48,7 +48,6 @@ internal sealed partial class LoginHoyoverseUserPage : Microsoft.UI.Xaml.Control
return string.Empty;
}
[SuppressMessage("", "VSTHRD100")]
private async void OnRootLoaded(object sender, RoutedEventArgs e)
{
try

View File

@@ -27,7 +27,6 @@ internal sealed partial class LoginMihoyoUserPage : Microsoft.UI.Xaml.Controls.P
InitializeComponent();
}
[SuppressMessage("", "VSTHRD100")]
private async void OnRootLoaded(object sender, RoutedEventArgs e)
{
try

View File

@@ -375,7 +375,6 @@ internal class MiHoYoJSInterface
}
}
[SuppressMessage("", "VSTHRD100")]
private async void OnWebMessageReceived(CoreWebView2 webView2, CoreWebView2WebMessageReceivedEventArgs args)
{
string message = args.TryGetWebMessageAsString();

View File

@@ -30,7 +30,7 @@ internal readonly struct PlayerUid
{
Must.Argument(value.Length == 9, "uid 应为9位数字");
Value = value;
Region = region ?? EvaluateRegion(value[0]);
Region = region ?? EvaluateRegion(value.AsSpan()[0]);
}
public static implicit operator PlayerUid(string source)

View File

@@ -6,7 +6,7 @@ namespace Snap.Hutao.Web.Hoyolab.Takumi.Event.BbsSignReward;
/// <summary>
/// 补签说明
/// </summary>
public class SignInRewardReSignInfo
internal sealed class SignInRewardReSignInfo
{
/// <summary>
/// 当日补签次数