diff --git a/src/MaaWpfGui/Configuration/Global/GUI.cs b/src/MaaWpfGui/Configuration/Global/GUI.cs index dbebcfa2a2..969a32044e 100644 --- a/src/MaaWpfGui/Configuration/Global/GUI.cs +++ b/src/MaaWpfGui/Configuration/Global/GUI.cs @@ -12,6 +12,7 @@ // using System.ComponentModel; +using JetBrains.Annotations; using MaaWpfGui.Configuration.Factory; using MaaWpfGui.Helper; using MaaWpfGui.Models; @@ -56,7 +57,7 @@ public class GUI : INotifyPropertyChanged public string SuppressedBadModules { get; set; } = string.Empty; - // ReSharper disable once UnusedMember.Global + [UsedImplicitly] public void OnPropertyChanged(string propertyName, object before, object after) { PropertyChanged?.Invoke(this, new PropertyChangedEventDetailArgs(propertyName, before, after)); diff --git a/src/MaaWpfGui/Configuration/Root.cs b/src/MaaWpfGui/Configuration/Root.cs index d65d850161..29ab0eade1 100644 --- a/src/MaaWpfGui/Configuration/Root.cs +++ b/src/MaaWpfGui/Configuration/Root.cs @@ -14,6 +14,7 @@ #nullable enable using System.ComponentModel; using System.Text.Json.Serialization; +using JetBrains.Annotations; using MaaWpfGui.Configuration.Factory; using MaaWpfGui.Configuration.Global; using MaaWpfGui.Configuration.Single; @@ -54,7 +55,7 @@ public class Root : INotifyPropertyChanged set => Configurations[Current] = value; } - // ReSharper disable once UnusedMember.Global + [UsedImplicitly] public void OnPropertyChanged(string propertyName, object before, object after) { PropertyChanged?.Invoke(this, new PropertyChangedEventDetailArgs(propertyName, before, after)); diff --git a/src/MaaWpfGui/Configuration/Single/MaaTask/BaseTask.cs b/src/MaaWpfGui/Configuration/Single/MaaTask/BaseTask.cs index 96527b5692..b433f8009d 100644 --- a/src/MaaWpfGui/Configuration/Single/MaaTask/BaseTask.cs +++ b/src/MaaWpfGui/Configuration/Single/MaaTask/BaseTask.cs @@ -13,6 +13,7 @@ #nullable enable using System.ComponentModel; using System.Text.Json.Serialization; +using JetBrains.Annotations; using MaaWpfGui.Configuration.Factory; using static MaaWpfGui.Main.AsstProxy; @@ -53,7 +54,7 @@ public class BaseTask : INotifyPropertyChanged /// public TaskType TaskType { get; init; } - // ReSharper disable once UnusedMember.Global + [UsedImplicitly] public void OnPropertyChanged(string propertyName, object before, object after) { PropertyChanged?.Invoke(this, new PropertyChangedEventDetailArgs(propertyName, before, after)); diff --git a/src/MaaWpfGui/Configuration/Single/MaaTask/RoguelikeTask.cs b/src/MaaWpfGui/Configuration/Single/MaaTask/RoguelikeTask.cs index 9b5234660e..ad63d0e4cf 100644 --- a/src/MaaWpfGui/Configuration/Single/MaaTask/RoguelikeTask.cs +++ b/src/MaaWpfGui/Configuration/Single/MaaTask/RoguelikeTask.cs @@ -76,7 +76,7 @@ public class RoguelikeTask : BaseTask public RoguelikeCollectibleAward CollectibleStartAwards { get; set; } = RoguelikeCollectibleAward.HotWater | RoguelikeCollectibleAward.Hope | RoguelikeCollectibleAward.Idea; /// - /// Gets or sets a value indicating whether gets or sets 烧水购物 + /// Gets or sets a value indicating whether 烧水购物 /// public bool CollectibleShopping { get; set; } diff --git a/src/MaaWpfGui/Constants/ConfigurationKeys.cs b/src/MaaWpfGui/Constants/ConfigurationKeys.cs index 84c88fca80..f71a433a66 100644 --- a/src/MaaWpfGui/Constants/ConfigurationKeys.cs +++ b/src/MaaWpfGui/Constants/ConfigurationKeys.cs @@ -11,6 +11,8 @@ // but WITHOUT ANY WARRANTY // +using JetBrains.Annotations; + namespace MaaWpfGui.Constants { /// @@ -23,10 +25,10 @@ namespace MaaWpfGui.Constants public const string GlobalConfiguration = "Global"; public const string ConfigurationMap = "Configurations"; - // ReSharper disable once UnusedMember.Global + [UsedImplicitly] public const string ConfigurationData = "Data"; - // ReSharper disable once UnusedMember.Global + [UsedImplicitly] public const string ConfigurationCron = "Cron"; public const string Localization = "GUI.Localization"; @@ -219,7 +221,7 @@ namespace MaaWpfGui.Constants public const string HasAcknowledgedNightlyWarning = "VersionUpdate.HasAcknowledgedNightlyWarning"; // 这个已经废弃了,还要留着吗? - // ReSharper disable once UnusedMember.Global + [UsedImplicitly] public const string UseAria2 = "VersionUpdate.UseAria2"; public const string AutoDownloadUpdatePackage = "VersionUpdate.AutoDownloadUpdatePackage"; diff --git a/src/MaaWpfGui/Constants/UILogColor.cs b/src/MaaWpfGui/Constants/UILogColor.cs index fa28b27999..3dd6424ebc 100644 --- a/src/MaaWpfGui/Constants/UILogColor.cs +++ b/src/MaaWpfGui/Constants/UILogColor.cs @@ -11,6 +11,8 @@ // but WITHOUT ANY WARRANTY // +using JetBrains.Annotations; + namespace MaaWpfGui.Constants { /// @@ -51,7 +53,7 @@ namespace MaaWpfGui.Constants /// /// The recommended color for robot operator logs. /// - // ReSharper disable once UnusedMember.Global + [UsedImplicitly] public const string RobotOperator = "RobotOperatorLogBrush"; /// diff --git a/src/MaaWpfGui/Helper/ConfigurationHelper.cs b/src/MaaWpfGui/Helper/ConfigurationHelper.cs index b30a9e814c..e58f1a6088 100644 --- a/src/MaaWpfGui/Helper/ConfigurationHelper.cs +++ b/src/MaaWpfGui/Helper/ConfigurationHelper.cs @@ -175,7 +175,6 @@ namespace MaaWpfGui.Helper /// /// The configuration key. /// The return value of . - // ReSharper disable once UnusedMember.Global public static bool DeleteValue(string key) => DeleteValue(key, out _); /// @@ -184,7 +183,6 @@ namespace MaaWpfGui.Helper /// The configuration key. /// The old value. /// The return value of . - // ReSharper disable once UnusedMember.Global public static bool DeleteValue(string key, out string value) { value = string.Empty; diff --git a/src/MaaWpfGui/Helper/ThemeHelper.cs b/src/MaaWpfGui/Helper/ThemeHelper.cs index f21b7e899f..ec7cddf36e 100644 --- a/src/MaaWpfGui/Helper/ThemeHelper.cs +++ b/src/MaaWpfGui/Helper/ThemeHelper.cs @@ -15,6 +15,7 @@ using System.Windows; using System.Windows.Media; using HandyControl.Themes; using HandyControl.Tools; +using JetBrains.Annotations; using MaaWpfGui.Constants; using MaaWpfGui.WineCompat; using Microsoft.Win32; @@ -117,7 +118,7 @@ namespace MaaWpfGui.Helper : $"#FF{color.R:X2}{color.G:X2}{color.B:X2}"; } - // ReSharper disable once UnusedMember.Global + [UsedImplicitly] public static string Brush2HexString(SolidColorBrush brush, bool keepAlpha = false) { return brush != null diff --git a/src/MaaWpfGui/MaaWpfGui.csproj b/src/MaaWpfGui/MaaWpfGui.csproj index 5b8f5d90b0..5c8f12f6c5 100644 --- a/src/MaaWpfGui/MaaWpfGui.csproj +++ b/src/MaaWpfGui/MaaWpfGui.csproj @@ -110,6 +110,7 @@ + diff --git a/src/MaaWpfGui/Models/AsstTasks/AsstFightTask.cs b/src/MaaWpfGui/Models/AsstTasks/AsstFightTask.cs index 1d97efd095..517f3eafe9 100644 --- a/src/MaaWpfGui/Models/AsstTasks/AsstFightTask.cs +++ b/src/MaaWpfGui/Models/AsstTasks/AsstFightTask.cs @@ -60,7 +60,7 @@ public class AsstFightTask : AsstBaseTask public int Series { get; set; } = 1; /// - /// Gets or sets a value indicating whether gets or sets 葛朗台 + /// Gets or sets a value indicating whether 葛朗台 /// [JsonProperty("DrGrandet")] public bool IsDrGrandet { get; set; } diff --git a/src/MaaWpfGui/Models/AsstTasks/AsstRecruitTask.cs b/src/MaaWpfGui/Models/AsstTasks/AsstRecruitTask.cs index c1cc4c6597..9d6d1bba6c 100644 --- a/src/MaaWpfGui/Models/AsstTasks/AsstRecruitTask.cs +++ b/src/MaaWpfGui/Models/AsstTasks/AsstRecruitTask.cs @@ -31,7 +31,7 @@ public class AsstRecruitTask : AsstBaseTask public int RecruitTimes { get; set; } /// - /// Gets or sets a value indicating whether gets or sets 是否刷新三星 Tags, 可选,默认false + /// Gets or sets a value indicating whether 是否刷新三星 Tags, 可选,默认false /// public bool Refresh { get; set; } diff --git a/src/MaaWpfGui/Models/AsstTasks/AsstStartUpTask.cs b/src/MaaWpfGui/Models/AsstTasks/AsstStartUpTask.cs index 2e098291fa..8689157ae2 100644 --- a/src/MaaWpfGui/Models/AsstTasks/AsstStartUpTask.cs +++ b/src/MaaWpfGui/Models/AsstTasks/AsstStartUpTask.cs @@ -30,7 +30,7 @@ public class AsstStartUpTask : AsstBaseTask public string ClientType { get; set; } = string.Empty; /// - /// Gets or sets a value indicating whether gets or sets 是否自动启动客户端 + /// Gets or sets a value indicating whether 是否自动启动客户端 /// [JsonProperty("start_game_enabled")] public bool StartGame { get; set; } diff --git a/src/MaaWpfGui/Models/PostActionSetting.cs b/src/MaaWpfGui/Models/PostActionSetting.cs index e85b17ae7f..0e5024ee51 100644 --- a/src/MaaWpfGui/Models/PostActionSetting.cs +++ b/src/MaaWpfGui/Models/PostActionSetting.cs @@ -16,6 +16,7 @@ using System; using System.Collections.Generic; using System.Windows.Controls; using System.Windows.Input; +using JetBrains.Annotations; using MaaWpfGui.Constants; using MaaWpfGui.Helper; using Newtonsoft.Json; @@ -307,7 +308,7 @@ public class PostActionSetting : PropertyChangedBase } // UI 绑定的方法 - // ReSharper disable once UnusedMember.Global + [UsedImplicitly] public void PostActionsAndOnce(object sender, MouseButtonEventArgs e) { if (e.ChangedButton != MouseButton.Right) @@ -321,7 +322,7 @@ public class PostActionSetting : PropertyChangedBase } // UI 绑定的方法 - // ReSharper disable once UnusedMember.Global + [UsedImplicitly] public void PostActionsClear() { Once = false; diff --git a/src/MaaWpfGui/Services/Web/IHttpService.cs b/src/MaaWpfGui/Services/Web/IHttpService.cs index 47a4076945..cc4e8453ba 100644 --- a/src/MaaWpfGui/Services/Web/IHttpService.cs +++ b/src/MaaWpfGui/Services/Web/IHttpService.cs @@ -18,6 +18,7 @@ using System.Collections.Generic; using System.IO; using System.Net.Http; using System.Threading.Tasks; +using JetBrains.Annotations; namespace MaaWpfGui.Services.Web { @@ -47,7 +48,7 @@ namespace MaaWpfGui.Services.Web /// Extra HTTP Request Headers /// The HTTP completion option /// Response stream, null when failed - // ReSharper disable once UnusedMember.Global + [UsedImplicitly] Task GetStreamAsync(Uri uri, Dictionary? extraHeader = null, HttpCompletionOption httpCompletionOption = HttpCompletionOption.ResponseContentRead); /// diff --git a/src/MaaWpfGui/Styles/Properties/AutoScroll.cs b/src/MaaWpfGui/Styles/Properties/AutoScroll.cs index e6de2b6e10..50992f3c83 100644 --- a/src/MaaWpfGui/Styles/Properties/AutoScroll.cs +++ b/src/MaaWpfGui/Styles/Properties/AutoScroll.cs @@ -15,6 +15,7 @@ using System; using System.Collections.Specialized; using System.Windows; using System.Windows.Controls; +using JetBrains.Annotations; namespace MaaWpfGui.Styles.Properties { @@ -30,7 +31,7 @@ namespace MaaWpfGui.Styles.Properties /// /// The instance. /// The property value. - // ReSharper disable once UnusedMember.Global + [UsedImplicitly] public static bool GetAutoScroll(DependencyObject obj) { return (bool)obj.GetValue(AutoScrollProperty); diff --git a/src/MaaWpfGui/Styles/Properties/ScrollViewerBinding.cs b/src/MaaWpfGui/Styles/Properties/ScrollViewerBinding.cs index c482cac9b0..8cffff77e7 100644 --- a/src/MaaWpfGui/Styles/Properties/ScrollViewerBinding.cs +++ b/src/MaaWpfGui/Styles/Properties/ScrollViewerBinding.cs @@ -16,6 +16,7 @@ using System.Linq; using System.Windows; using System.Windows.Controls; using HandyControl.Controls; +using JetBrains.Annotations; using ScrollViewer = System.Windows.Controls.ScrollViewer; namespace MaaWpfGui.Styles.Properties @@ -47,7 +48,7 @@ namespace MaaWpfGui.Styles.Properties /// /// The instance. /// The property value. - // ReSharper disable once UnusedMember.Global + [UsedImplicitly] public static double GetVerticalOffset(DependencyObject depObj) { if (!(depObj is ScrollViewer)) @@ -124,7 +125,7 @@ namespace MaaWpfGui.Styles.Properties /// /// The instance. /// The property value. - // ReSharper disable once UnusedMember.Global + [UsedImplicitly] public static double GetViewportHeight(DependencyObject depObj) { if (!(depObj is ScrollViewer scrollViewer)) @@ -201,7 +202,7 @@ namespace MaaWpfGui.Styles.Properties /// /// The instance. /// The property value. - // ReSharper disable once UnusedMember.Global + [UsedImplicitly] public static double GetExtentHeight(DependencyObject depObj) { if (!(depObj is ScrollViewer scrollViewer)) @@ -279,7 +280,7 @@ namespace MaaWpfGui.Styles.Properties /// /// The instance. /// The property value. - // ReSharper disable once UnusedMember.Global + [UsedImplicitly] public static List GetDividerVerticalOffsetList(DependencyObject depObj) { return (List)depObj.GetValue(DividerVerticalOffsetListProperty); diff --git a/src/MaaWpfGui/ViewModels/CopilotItemViewModel.cs b/src/MaaWpfGui/ViewModels/CopilotItemViewModel.cs index f9a1bdc565..5de6936b80 100644 --- a/src/MaaWpfGui/ViewModels/CopilotItemViewModel.cs +++ b/src/MaaWpfGui/ViewModels/CopilotItemViewModel.cs @@ -75,7 +75,7 @@ namespace MaaWpfGui.ViewModels private bool _isChecked; /// - /// Gets or sets a value indicating whether gets or sets whether the key is checked. + /// Gets or sets a value indicating whether the key is checked. /// public bool IsChecked { diff --git a/src/MaaWpfGui/ViewModels/DragItemViewModel.cs b/src/MaaWpfGui/ViewModels/DragItemViewModel.cs index 6530486a70..fdaef527d8 100644 --- a/src/MaaWpfGui/ViewModels/DragItemViewModel.cs +++ b/src/MaaWpfGui/ViewModels/DragItemViewModel.cs @@ -12,6 +12,7 @@ // using System; +using JetBrains.Annotations; using MaaWpfGui.Helper; using MaaWpfGui.Models; using Stylet; @@ -79,7 +80,7 @@ namespace MaaWpfGui.ViewModels private bool? _isCheckedWithNull; /// - /// Gets or sets a value indicating whether gets or sets whether the key is checked with null. + /// Gets or sets a value indicating whether the key is checked with null. /// public bool? IsCheckedWithNull { @@ -93,7 +94,7 @@ namespace MaaWpfGui.ViewModels } /// - /// Gets or sets a value indicating whether gets or sets whether the key is checked. + /// Gets or sets a value indicating whether the key is checked. /// public bool IsChecked { @@ -107,7 +108,7 @@ namespace MaaWpfGui.ViewModels /// /// Gets or sets the icon path. /// - // ReSharper disable once UnusedMember.Global + [UsedImplicitly] public string IconPath { get => _iconPath; @@ -119,7 +120,7 @@ namespace MaaWpfGui.ViewModels /// /// Gets or sets the token. /// - // ReSharper disable once UnusedMember.Global + [UsedImplicitly] public string Token { get => _token; @@ -131,7 +132,7 @@ namespace MaaWpfGui.ViewModels /// /// Gets or sets the running status. /// - // ReSharper disable once UnusedMember.Global + [UsedImplicitly] public string RunStatus { get => _runStatus; @@ -141,7 +142,7 @@ namespace MaaWpfGui.ViewModels private bool _enableSetting; /// - /// Gets or sets a value indicating whether gets or sets whether the setting enabled. + /// Gets or sets a value indicating whether the setting enabled. /// public bool EnableSetting { diff --git a/src/MaaWpfGui/ViewModels/UI/CopilotViewModel.cs b/src/MaaWpfGui/ViewModels/UI/CopilotViewModel.cs index 9c25012987..cceaf54ef9 100644 --- a/src/MaaWpfGui/ViewModels/UI/CopilotViewModel.cs +++ b/src/MaaWpfGui/ViewModels/UI/CopilotViewModel.cs @@ -24,6 +24,7 @@ using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Input; +using JetBrains.Annotations; using MaaWpfGui.Constants; using MaaWpfGui.Helper; using MaaWpfGui.Main; @@ -358,7 +359,8 @@ namespace MaaWpfGui.ViewModels.UI /// /// Selects file. /// - // ReSharper disable once UnusedMember.Global + /// UI 绑定的方法 + [UsedImplicitly] public void SelectFile() { var dialog = new OpenFileDialog @@ -375,7 +377,8 @@ namespace MaaWpfGui.ViewModels.UI /// /// Paste clipboard contents. /// - // ReSharper disable once UnusedMember.Global + /// UI 绑定的方法 + [UsedImplicitly] public void PasteClipboard() { if (Clipboard.ContainsText()) @@ -392,7 +395,8 @@ namespace MaaWpfGui.ViewModels.UI /// Paste clipboard contents. /// /// Task - // ReSharper disable once UnusedMember.Global + /// UI 绑定的方法 + [UsedImplicitly] public async Task PasteClipboardCopilotSet() { StartEnabled = false; @@ -410,7 +414,8 @@ namespace MaaWpfGui.ViewModels.UI /// 批量导入作业 /// /// Task - // ReSharper disable once UnusedMember.Global + /// UI 绑定的方法 + [UsedImplicitly] public async Task ImportFiles() { var dialog = new OpenFileDialog @@ -464,28 +469,28 @@ namespace MaaWpfGui.ViewModels.UI } // UI 绑定的方法 - // ReSharper disable once UnusedMember.Global + [UsedImplicitly] public async Task AddCopilotTask() { await AddCopilotTaskToList(CopilotTaskName, false); } // UI 绑定的方法 - // ReSharper disable once UnusedMember.Global + [UsedImplicitly] public async Task AddCopilotTask_Adverse() { await AddCopilotTaskToList(CopilotTaskName, true); } // UI 绑定的方法 - // ReSharper disable once UnusedMember.Global + [UsedImplicitly] public void SelectCopilotTask(int index) { Filename = CopilotItemViewModels[index].FilePath; } // UI 绑定的方法 - // ReSharper disable once UnusedMember.Global + [UsedImplicitly] public void DeleteCopilotTask(int index) { CopilotItemViewModels.RemoveAt(index); @@ -493,7 +498,7 @@ namespace MaaWpfGui.ViewModels.UI } // UI 绑定的方法 - // ReSharper disable once UnusedMember.Global + [UsedImplicitly] public void CleanUnableCopilotTask() { foreach (var item in CopilotItemViewModels.Where(model => !model.IsChecked).ToList()) @@ -505,7 +510,7 @@ namespace MaaWpfGui.ViewModels.UI } // UI 绑定的方法 - // ReSharper disable once UnusedMember.Global + [UsedImplicitly] public void ClearCopilotTask() { CopilotItemViewModels.Clear(); @@ -521,7 +526,8 @@ namespace MaaWpfGui.ViewModels.UI } } - // ReSharper disable once UnusedMember.Global + // UI 绑定的方法 + [UsedImplicitly] public async Task LikeWebJson() { CouldLikeWebJson = false; @@ -531,7 +537,8 @@ namespace MaaWpfGui.ViewModels.UI } } - // ReSharper disable once UnusedMember.Global + // UI 绑定的方法 + [UsedImplicitly] public void DislikeWebJson() { CouldLikeWebJson = false; @@ -891,9 +898,8 @@ namespace MaaWpfGui.ViewModels.UI /// /// The sender. /// The event arguments. - // ReSharper disable once UnusedMember.Global - // ReSharper disable once UnusedParameter.Global - // TODO: 不知道为啥现在拖放不用了,之后瞅瞅 + /// TODO: 不知道为啥现在拖放不用了,之后瞅瞅 + [UsedImplicitly] public void DropFile(object sender, DragEventArgs e) { if (!e.Data.GetDataPresent(DataFormats.FileDrop)) @@ -901,7 +907,7 @@ namespace MaaWpfGui.ViewModels.UI return; } - var filename = ((Array)e.Data.GetData(DataFormats.FileDrop))?.GetValue(0)?.ToString(); + var filename = ((Array?)e.Data.GetData(DataFormats.FileDrop))?.GetValue(0)?.ToString(); DropFile(filename); } @@ -932,8 +938,7 @@ namespace MaaWpfGui.ViewModels.UI /// /// The sender. /// The event arguments. - // ReSharper disable once UnusedMember.Global - // ReSharper disable once UnusedParameter.Global + [UsedImplicitly] public void OnDropDownOpened(object sender, EventArgs e) { if (sender is not ComboBox comboBox) @@ -1119,8 +1124,8 @@ namespace MaaWpfGui.ViewModels.UI /// Starts copilot. /// /// Task - // UI 绑定的方法 - // ReSharper disable once UnusedMember.Global + /// UI 绑定的方法 + [UsedImplicitly] public async Task Start() { /* @@ -1264,8 +1269,7 @@ namespace MaaWpfGui.ViewModels.UI /// /// Stops copilot. /// - // UI 绑定的方法 - // ReSharper disable once UnusedMember.Global + /// UI 绑定的方法 public void Stop() { if (SettingsViewModel.GameSettings.CopilotWithScript && SettingsViewModel.GameSettings.ManualStopWithScript) @@ -1380,8 +1384,7 @@ namespace MaaWpfGui.ViewModels.UI /// /// 点击事件发送者 /// 点击事件 - // ReSharper disable once UnusedMember.Global - // ReSharper disable once UnusedParameter.Global + [UsedImplicitly] public void MouseDown(object sender, MouseButtonEventArgs e) { if (sender is not UIElement element) @@ -1399,7 +1402,7 @@ namespace MaaWpfGui.ViewModels.UI /// /// 点击事件发送者 /// 点击事件 - // ReSharper disable once UnusedMember.Global + [UsedImplicitly] public void KeyDown(object sender, KeyEventArgs e) { if (e.Key != Key.Enter) diff --git a/src/MaaWpfGui/ViewModels/UI/RecognizerViewModel.cs b/src/MaaWpfGui/ViewModels/UI/RecognizerViewModel.cs index 6d6f2eee4c..d794ee6ee3 100644 --- a/src/MaaWpfGui/ViewModels/UI/RecognizerViewModel.cs +++ b/src/MaaWpfGui/ViewModels/UI/RecognizerViewModel.cs @@ -20,10 +20,10 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; using System.Windows; -using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Threading; using HandyControl.Controls; +using JetBrains.Annotations; using MaaWpfGui.Constants; using MaaWpfGui.Helper; using MaaWpfGui.Main; @@ -35,7 +35,6 @@ using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Serilog; using Stylet; -using Windows.Storage.Streams; using Timer = System.Timers.Timer; namespace MaaWpfGui.ViewModels.UI @@ -192,8 +191,8 @@ namespace MaaWpfGui.ViewModels.UI /// Starts calculation. /// /// Task - // UI 绑定的方法 - // ReSharper disable once UnusedMember.Global + /// UI 绑定的方法 + [UsedImplicitly] public async Task RecruitStartCalc() { string errMsg = string.Empty; @@ -458,8 +457,8 @@ namespace MaaWpfGui.ViewModels.UI /// /// Export depot info to ArkPlanner. /// - // xaml 中用到了 - // ReSharper disable once UnusedMember.Global + /// UI 绑定的方法 + [UsedImplicitly] public void ExportToArkplanner() { System.Windows.Forms.Clipboard.Clear(); @@ -470,8 +469,8 @@ namespace MaaWpfGui.ViewModels.UI /// /// Export depot info to Lolicon. /// - // xaml 中用到了 - // ReSharper disable once UnusedMember.Global + /// UI 绑定的方法 + [UsedImplicitly] public void ExportToLolicon() { System.Windows.Forms.Clipboard.Clear(); @@ -490,8 +489,8 @@ namespace MaaWpfGui.ViewModels.UI /// Starts depot recognition. /// /// Task - // xaml 中用到了 - // ReSharper disable once UnusedMember.Global + /// UI 绑定的方法 + [UsedImplicitly] public async Task StartDepot() { _runningState.SetIdle(false); @@ -688,7 +687,8 @@ namespace MaaWpfGui.ViewModels.UI /// /// Task /// xaml 中用到了 - /// ReSharper disable once UnusedMember.Global + /// UI 绑定的方法 + [UsedImplicitly] public async Task StartOperBox() { _tempOperHaveSet = []; @@ -712,8 +712,8 @@ namespace MaaWpfGui.ViewModels.UI } } - // xaml 中用到了 - // ReSharper disable once UnusedMember.Global + // UI 绑定的方法 + [UsedImplicitly] public void ExportOperBox() { if (OperBoxDataArray.Count == 0) @@ -738,15 +738,13 @@ namespace MaaWpfGui.ViewModels.UI set => SetAndNotify(ref _gachaInfo, value); } - // xaml 中用到了 - // ReSharper disable once UnusedMember.Global + // UI 绑定的方法 public async Task GachaOnce() { await StartGacha(); } - // xaml 中用到了 - // ReSharper disable once UnusedMember.Global + // UI 绑定的方法 public async Task GachaTenTimes() { await StartGacha(false); @@ -827,8 +825,8 @@ namespace MaaWpfGui.ViewModels.UI } } - // xaml 中用到了 - // ReSharper disable once UnusedMember.Global + // UI 绑定的方法 + [UsedImplicitly] public void GachaAgreeDisclaimer() { var result = MessageBoxHelper.Show( diff --git a/src/MaaWpfGui/ViewModels/UI/RootViewModel.cs b/src/MaaWpfGui/ViewModels/UI/RootViewModel.cs index 396ce97632..b86dc51bd8 100644 --- a/src/MaaWpfGui/ViewModels/UI/RootViewModel.cs +++ b/src/MaaWpfGui/ViewModels/UI/RootViewModel.cs @@ -23,6 +23,7 @@ using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using HandyControl.Tools; +using JetBrains.Annotations; using MaaWpfGui.Constants; using MaaWpfGui.Helper; using MaaWpfGui.Main; @@ -201,7 +202,7 @@ namespace MaaWpfGui.ViewModels.UI } // UI 绑定的方法 - // ReSharper disable once UnusedMember.Global + [UsedImplicitly] public void ToggleTopMostCommand() { IsWindowTopMost = !IsWindowTopMost; @@ -237,7 +238,6 @@ namespace MaaWpfGui.ViewModels.UI set => SetAndNotify(ref _gifVisibility, value); } - // ReSharper disable once UnusedMember.Global public void ChangeGif() { if (++_gifIndex >= _gitList.Length) @@ -251,7 +251,8 @@ namespace MaaWpfGui.ViewModels.UI private static bool _isDragging = false; private static Point _offset; - // ReSharper disable once UnusedMember.Global + // UI 绑定的方法 + [UsedImplicitly] public void DraggableElementMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { if (sender is not HandyControl.Controls.GifImage childElement) @@ -264,7 +265,8 @@ namespace MaaWpfGui.ViewModels.UI childElement.CaptureMouse(); } - // ReSharper disable once UnusedMember.Global + // UI 绑定的方法 + [UsedImplicitly] public void DraggableElementMouseLeftButtonUp(object sender, MouseButtonEventArgs e) { if (sender is not HandyControl.Controls.GifImage childElement) @@ -276,7 +278,8 @@ namespace MaaWpfGui.ViewModels.UI childElement.ReleaseMouseCapture(); } - // ReSharper disable once UnusedMember.Global + // UI 绑定的方法 + [UsedImplicitly] public void DraggableElementMouseMove(object sender, MouseEventArgs e) { if (!_isDragging || sender is not HandyControl.Controls.GifImage { Parent: Grid parentElement } childElement) diff --git a/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs b/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs index 94170f3e6b..c945030780 100644 --- a/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs +++ b/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs @@ -22,6 +22,7 @@ using System.Threading.Tasks; using System.Windows; using HandyControl.Controls; using HandyControl.Data; +using JetBrains.Annotations; using MaaWpfGui.Constants; using MaaWpfGui.Extensions; using MaaWpfGui.Helper; @@ -404,7 +405,7 @@ namespace MaaWpfGui.ViewModels.UI } // UI 绑定的方法 - // ReSharper disable once UnusedMember.Global + [UsedImplicitly] public void AddConfiguration() { if (string.IsNullOrEmpty(NewConfigurationName)) @@ -439,7 +440,7 @@ namespace MaaWpfGui.ViewModels.UI } // UI 绑定的方法 - // ReSharper disable once UnusedMember.Global + [UsedImplicitly] public void DeleteConfiguration(CombinedData delete) { if (ConfigurationHelper.DeleteConfiguration(delete.Display)) @@ -476,7 +477,7 @@ namespace MaaWpfGui.ViewModels.UI } // UI 绑定的方法 - // ReSharper disable once UnusedMember.Global + [UsedImplicitly] public void NextGuide(StepBar stepBar) { GuideTransitionMode = "Bottom2Top"; @@ -484,7 +485,7 @@ namespace MaaWpfGui.ViewModels.UI } // UI 绑定的方法 - // ReSharper disable once UnusedMember.Global + [UsedImplicitly] public void PrevGuide(StepBar stepBar) { GuideTransitionMode = "Top2Bottom"; @@ -492,7 +493,7 @@ namespace MaaWpfGui.ViewModels.UI } // UI 绑定的方法 - // ReSharper disable once UnusedMember.Global + [UsedImplicitly] public void DoneGuide() { TaskSettingVisibilities.Guide = false; @@ -672,7 +673,7 @@ namespace MaaWpfGui.ViewModels.UI /// Event args // UI 绑定的方法 // EventArgs 不能省略,否则会报错 - // ReSharper disable once UnusedMember.Global + [UsedImplicitly] // ReSharper disable once UnusedParameter.Global public static void MakeComboBoxSearchable(object sender, EventArgs e) { @@ -680,7 +681,7 @@ namespace MaaWpfGui.ViewModels.UI } // UI 绑定的方法 - // ReSharper disable once UnusedMember.Global + [UsedImplicitly] public async Task CheckAndDownloadAnnouncement() { await Instances.AnnouncementViewModel.CheckAndDownloadAnnouncement(); diff --git a/src/MaaWpfGui/ViewModels/UI/TaskQueueViewModel.cs b/src/MaaWpfGui/ViewModels/UI/TaskQueueViewModel.cs index 0f9d7a8bbe..4aa854874f 100644 --- a/src/MaaWpfGui/ViewModels/UI/TaskQueueViewModel.cs +++ b/src/MaaWpfGui/ViewModels/UI/TaskQueueViewModel.cs @@ -24,6 +24,7 @@ using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; +using JetBrains.Annotations; using MaaWpfGui.Constants; using MaaWpfGui.Extensions; using MaaWpfGui.Helper; @@ -1010,8 +1011,8 @@ namespace MaaWpfGui.ViewModels.UI /// /// Selects all. /// - // UI 绑定的方法 - // ReSharper disable once UnusedMember.Global + /// UI 绑定的方法 + [UsedImplicitly] public void SelectedAll() { foreach (var item in TaskItemViewModels) @@ -1102,8 +1103,8 @@ namespace MaaWpfGui.ViewModels.UI /// /// Changes inversion mode. /// - // UI 绑定的方法 - // ReSharper disable once UnusedMember.Global + /// UI 绑定的方法 + [UsedImplicitly] public void ChangeInverseMode() { InverseMode = !InverseMode; @@ -1112,8 +1113,8 @@ namespace MaaWpfGui.ViewModels.UI /// /// Selects inversely. /// - // UI 绑定的方法 - // ReSharper disable once UnusedMember.Global + /// UI 绑定的方法 + [UsedImplicitly] public void InverseSelected() { if (InverseMode) @@ -1483,7 +1484,7 @@ namespace MaaWpfGui.ViewModels.UI } // UI 绑定的方法 - // ReSharper disable once UnusedMember.Global + [UsedImplicitly] public async Task WaitAndStop() { Waiting = true; @@ -1774,7 +1775,7 @@ namespace MaaWpfGui.ViewModels.UI public bool Waiting { // UI 会根据这个值来改变 Visibility - // ReSharper disable once UnusedMember.Global + [UsedImplicitly] get => _waiting; private set => SetAndNotify(ref _waiting, value); } diff --git a/src/MaaWpfGui/ViewModels/UI/VersionUpdateViewModel.cs b/src/MaaWpfGui/ViewModels/UI/VersionUpdateViewModel.cs index 96a42e5483..3bec8f9532 100644 --- a/src/MaaWpfGui/ViewModels/UI/VersionUpdateViewModel.cs +++ b/src/MaaWpfGui/ViewModels/UI/VersionUpdateViewModel.cs @@ -457,16 +457,6 @@ public class VersionUpdateViewModel : Screen MirrorChyan, } - // ReSharper disable once IdentifierTypo - // ReSharper disable once UnusedMember.Global - public enum Downloader - { - /// - /// 原生下载器 - /// - Native, - } - private bool _doNotShowUpdate = Convert.ToBoolean(ConfigurationHelper.GetGlobalValue(ConfigurationKeys.VersionUpdateDoNotShowUpdate, bool.FalseString)); /// diff --git a/src/MaaWpfGui/ViewModels/UserControl/Settings/ConnectSettingsUserControlModel.cs b/src/MaaWpfGui/ViewModels/UserControl/Settings/ConnectSettingsUserControlModel.cs index b292147587..4f141b457d 100644 --- a/src/MaaWpfGui/ViewModels/UserControl/Settings/ConnectSettingsUserControlModel.cs +++ b/src/MaaWpfGui/ViewModels/UserControl/Settings/ConnectSettingsUserControlModel.cs @@ -24,6 +24,7 @@ using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Media.Imaging; +using JetBrains.Annotations; using MaaWpfGui.Constants; using MaaWpfGui.Helper; using MaaWpfGui.Main; @@ -36,7 +37,6 @@ using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Serilog; using Stylet; -using WinRT; using Window = HandyControl.Controls.Window; using WindowManager = MaaWpfGui.Helper.WindowManager; @@ -180,7 +180,7 @@ public class ConnectSettingsUserControlModel : PropertyChangedBase } // UI 绑定的方法 - // ReSharper disable once UnusedMember.Global + [UsedImplicitly] public void RemoveAddressClick(string address) { ConnectAddressHistory.Remove(address); @@ -852,8 +852,8 @@ public class ConnectSettingsUserControlModel : PropertyChangedBase /// /// Selects ADB program file. /// - // UI 绑定的方法 - // ReSharper disable once UnusedMember.Global + /// UI 绑定的方法 + [UsedImplicitly] public void SelectFile() { var dialog = new OpenFileDialog(); @@ -874,8 +874,8 @@ public class ConnectSettingsUserControlModel : PropertyChangedBase /// Test Link And Get Image. /// /// Task - // UI 绑定的方法 - // ReSharper disable once UnusedMember.Global + /// UI 绑定的方法 + [UsedImplicitly] public async Task TestLinkAndGetImage() { _runningState.SetIdle(false); @@ -1047,7 +1047,7 @@ public class ConnectSettingsUserControlModel : PropertyChangedBase } // UI 绑定的方法 - // ReSharper disable once UnusedMember.Global + [UsedImplicitly] public async Task ReplaceAdb() { if (string.IsNullOrEmpty(AdbPath)) diff --git a/src/MaaWpfGui/ViewModels/UserControl/Settings/ExternalNotificationSettingsUserControlModel.cs b/src/MaaWpfGui/ViewModels/UserControl/Settings/ExternalNotificationSettingsUserControlModel.cs index 2cbe0797de..5098d948a0 100644 --- a/src/MaaWpfGui/ViewModels/UserControl/Settings/ExternalNotificationSettingsUserControlModel.cs +++ b/src/MaaWpfGui/ViewModels/UserControl/Settings/ExternalNotificationSettingsUserControlModel.cs @@ -15,10 +15,10 @@ using System; using System.Collections.Generic; using System.Linq; +using JetBrains.Annotations; using MaaWpfGui.Constants; using MaaWpfGui.Helper; using MaaWpfGui.Services.Notification; -using MaaWpfGui.ViewModels.UI; using Stylet; namespace MaaWpfGui.ViewModels.UserControl.Settings; @@ -36,7 +36,7 @@ public class ExternalNotificationSettingsUserControlModel : PropertyChangedBase public static ExternalNotificationSettingsUserControlModel Instance { get; } // UI 绑定的方法 - // ReSharper disable once UnusedMember.Global + [UsedImplicitly] public static void ExternalNotificationSendTest() { ExternalNotificationService.Send( diff --git a/src/MaaWpfGui/ViewModels/UserControl/Settings/IssueReportUserControlModel.cs b/src/MaaWpfGui/ViewModels/UserControl/Settings/IssueReportUserControlModel.cs index c9c786b2ed..4b45d4c506 100644 --- a/src/MaaWpfGui/ViewModels/UserControl/Settings/IssueReportUserControlModel.cs +++ b/src/MaaWpfGui/ViewModels/UserControl/Settings/IssueReportUserControlModel.cs @@ -16,10 +16,9 @@ using System; using System.Diagnostics; using System.IO; using System.IO.Compression; -using System.Linq; -using System.Windows; using HandyControl.Controls; using HandyControl.Data; +using JetBrains.Annotations; using MaaWpfGui.Configuration.Factory; using MaaWpfGui.Constants; using MaaWpfGui.Helper; @@ -149,7 +148,7 @@ public class IssueReportUserControlModel : PropertyChangedBase } // UI 绑定的方法 - // ReSharper disable once UnusedMember.Global + [UsedImplicitly] public void SetAcknowledgedNightlyWarning() { // 其实不应该放这里,但懒得写一个新的方法,就塞到这里了 diff --git a/src/MaaWpfGui/ViewModels/UserControl/Settings/StartSettingsUserControlModel.cs b/src/MaaWpfGui/ViewModels/UserControl/Settings/StartSettingsUserControlModel.cs index d45f3958d4..f635e8e8d1 100644 --- a/src/MaaWpfGui/ViewModels/UserControl/Settings/StartSettingsUserControlModel.cs +++ b/src/MaaWpfGui/ViewModels/UserControl/Settings/StartSettingsUserControlModel.cs @@ -13,7 +13,6 @@ #nullable enable using System; -using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.IO; @@ -23,14 +22,13 @@ using System.Runtime.InteropServices.ComTypes; using System.Threading; using System.Windows; using HandyControl.Controls; +using JetBrains.Annotations; using MaaWpfGui.Constants; using MaaWpfGui.Helper; -using MaaWpfGui.Main; using MaaWpfGui.States; using MaaWpfGui.Utilities; using MaaWpfGui.ViewModels.UI; using Microsoft.Win32; -using Newtonsoft.Json.Linq; using Serilog; using Stylet; @@ -511,8 +509,8 @@ public class StartSettingsUserControlModel : PropertyChangedBase /// /// Selects the emulator to execute. /// - // UI 绑定的方法 - // ReSharper disable once UnusedMember.Global + /// UI 绑定的方法 + [UsedImplicitly] public void SelectEmulatorExec() { var dialog = new OpenFileDialog diff --git a/src/MaaWpfGui/ViewModels/UserControl/Settings/VersionUpdateSettingsUserControlModel.cs b/src/MaaWpfGui/ViewModels/UserControl/Settings/VersionUpdateSettingsUserControlModel.cs index 508d1b7591..1d22abf6a1 100644 --- a/src/MaaWpfGui/ViewModels/UserControl/Settings/VersionUpdateSettingsUserControlModel.cs +++ b/src/MaaWpfGui/ViewModels/UserControl/Settings/VersionUpdateSettingsUserControlModel.cs @@ -20,7 +20,7 @@ using System.Linq; using System.Reflection; using System.Runtime.InteropServices; using System.Threading.Tasks; -using System.Windows; +using JetBrains.Annotations; using MaaWpfGui.Constants; using MaaWpfGui.Extensions; using MaaWpfGui.Helper; @@ -321,6 +321,14 @@ public class VersionUpdateSettingsUserControlModel : PropertyChangedBase private bool _startupUpdateCheck = Convert.ToBoolean(ConfigurationHelper.GetGlobalValue(ConfigurationKeys.StartupUpdateCheck, bool.TrueString)); + // UI 绑定的方法 + [UsedImplicitly] + public void MirrorChyanCdkCopy() + { + System.Windows.Forms.Clipboard.Clear(); + System.Windows.Forms.Clipboard.SetDataObject(MirrorChyanCdk); + } + /// /// Gets or sets a value indicating whether to check update. /// @@ -430,7 +438,7 @@ public class VersionUpdateSettingsUserControlModel : PropertyChangedBase /// Updates manually. /// /// A representing the asynchronous operation. - /// ReSharper disable once UnusedMember.Global + [UsedImplicitly] public async Task ManualUpdate() { if (SettingsViewModel.VersionUpdateSettings.UpdateSource == "MirrorChyan" && string.IsNullOrEmpty(SettingsViewModel.VersionUpdateSettings.MirrorChyanCdk)) @@ -467,7 +475,7 @@ public class VersionUpdateSettingsUserControlModel : PropertyChangedBase } } - // ReSharper disable once UnusedMember.Global + [UsedImplicitly] public async Task ManualUpdateResource() { if (SettingsViewModel.VersionUpdateSettings.UpdateSource == "MirrorChyan" && string.IsNullOrEmpty(SettingsViewModel.VersionUpdateSettings.MirrorChyanCdk)) @@ -518,7 +526,7 @@ public class VersionUpdateSettingsUserControlModel : PropertyChangedBase } // UI 绑定的方法 - // ReSharper disable once UnusedMember.Global + [UsedImplicitly] public void ShowChangelog() { Instances.WindowManager.ShowWindow(Instances.VersionUpdateViewModel); diff --git a/src/MaaWpfGui/ViewModels/UserControl/TaskQueue/FightSettingsUserControlModel.cs b/src/MaaWpfGui/ViewModels/UserControl/TaskQueue/FightSettingsUserControlModel.cs index f1d4e7fed1..5aa78f1cc8 100644 --- a/src/MaaWpfGui/ViewModels/UserControl/TaskQueue/FightSettingsUserControlModel.cs +++ b/src/MaaWpfGui/ViewModels/UserControl/TaskQueue/FightSettingsUserControlModel.cs @@ -17,6 +17,7 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Windows; +using JetBrains.Annotations; using MaaWpfGui.Constants; using MaaWpfGui.Helper; using MaaWpfGui.Models.AsstTasks; @@ -665,7 +666,7 @@ public class FightSettingsUserControlModel : TaskViewModel } // UI 绑定的方法 - // ReSharper disable once UnusedMember.Global + [UsedImplicitly] public void DropsListDropDownClosed() { foreach (var item in DropsList) diff --git a/src/MaaWpfGui/ViewModels/UserControl/TaskQueue/InfrastSettingsUserControlModel.cs b/src/MaaWpfGui/ViewModels/UserControl/TaskQueue/InfrastSettingsUserControlModel.cs index 7c2611e026..269b86e73b 100644 --- a/src/MaaWpfGui/ViewModels/UserControl/TaskQueue/InfrastSettingsUserControlModel.cs +++ b/src/MaaWpfGui/ViewModels/UserControl/TaskQueue/InfrastSettingsUserControlModel.cs @@ -18,6 +18,7 @@ using System.Collections.ObjectModel; using System.Collections.Specialized; using System.IO; using System.Linq; +using JetBrains.Annotations; using MaaWpfGui.Constants; using MaaWpfGui.Helper; using MaaWpfGui.Models; @@ -165,7 +166,7 @@ public class InfrastSettingsUserControlModel : TaskViewModel } // UI 绑定的方法 - // ReSharper disable once UnusedMember.Global + [UsedImplicitly] public void InfrastItemSelectedAll() { foreach (var item in InfrastItemViewModels) @@ -175,7 +176,7 @@ public class InfrastSettingsUserControlModel : TaskViewModel } // UI 绑定的方法 - // ReSharper disable once UnusedMember.Global + [UsedImplicitly] public void InfrastItemUnselectedAll() { foreach (var item in InfrastItemViewModels) @@ -360,8 +361,8 @@ public class InfrastSettingsUserControlModel : TaskViewModel /// /// Selects infrast config file. /// - // UI 绑定的方法 - // ReSharper disable once UnusedMember.Global + /// UI 绑定的方法 + [UsedImplicitly] public void SelectCustomInfrastFile() { var dialog = new OpenFileDialog diff --git a/src/MaaWpfGui/ViewModels/UserControl/TaskQueue/StartUpSettingsUserControlModel.cs b/src/MaaWpfGui/ViewModels/UserControl/TaskQueue/StartUpSettingsUserControlModel.cs index efb32ca3d5..61468e8b7c 100644 --- a/src/MaaWpfGui/ViewModels/UserControl/TaskQueue/StartUpSettingsUserControlModel.cs +++ b/src/MaaWpfGui/ViewModels/UserControl/TaskQueue/StartUpSettingsUserControlModel.cs @@ -12,6 +12,7 @@ // #nullable enable +using JetBrains.Annotations; using MaaWpfGui.Constants; using MaaWpfGui.Helper; using MaaWpfGui.Main; @@ -45,7 +46,7 @@ public class StartUpSettingsUserControlModel : TaskViewModel } // UI 绑定的方法 - // ReSharper disable once UnusedMember.Global + [UsedImplicitly] public void AccountSwitchManualRun() { _ = Instances.TaskQueueViewModel.QuickSwitchAccount();