style: 优化代码

This commit is contained in:
uye
2024-06-19 18:08:20 +08:00
parent 2a4c2a97f8
commit 4b07b28fec
6 changed files with 674 additions and 635 deletions

View File

@@ -197,4 +197,13 @@ csharp_preserve_single_line_blocks = true
dotnet_diagnostic.SA1010.severity = silent
# Code inspection: Incorrect line breaks (around parenthesis)
resharper_bad_parens_line_breaks_highlighting = none
resharper_bad_braces_spaces_highlighting = none
# Code inspection: Incorrect spacing (around braces)
resharper_bad_braces_spaces_highlighting = none
# Code inspection: Incorrect line breaks (around expression braces)
resharper_bad_expression_braces_line_breaks_highlighting = none
# Code inspection: Incorrect line breaks (around comma in lists)
resharper_bad_list_line_breaks_highlighting = Hint
# Code inspection: Incorrect spacing (multiple spaces are prohibited)
resharper_multiple_spaces_highlighting = Hint
# Code inspection: Incorrect spacing (around attributes)
resharper_bad_attribute_brackets_spaces_highlighting = Hint

View File

@@ -51,6 +51,10 @@ namespace MaaWpfGui.Constants
public const string QqChannel = "https://pd.qq.com/s/4j1ju9z47";
public const string GoogleAdbDownloadUrl = "https://dl.google.com/android/repository/platform-tools-latest-windows.zip";
public const string AdbMaaMirrorDownloadUrl = "https://ota.maa.plus/MaaAssistantArknights/api/binaries/adb-windows.zip";
public const string GoogleAdbFilename = "adb-windows.zip";
private static string Language => ConfigurationHelper.GetValue(ConfigurationKeys.Localization, LocalizationHelper.DefaultLanguage);
public static string HelpUri => $"{MaaDocs}/{_helpUrl[Language]}";

View File

@@ -36,7 +36,6 @@ using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Serilog;
using Stylet;
using static System.Windows.Forms.AxHost;
using static MaaWpfGui.Helper.Instances.Data;
using AsstHandle = System.IntPtr;
using AsstInstanceOptionKey = System.Int32;
@@ -113,7 +112,7 @@ namespace MaaWpfGui.Main
}
}
private static void AsstSetConnectionExtrasMuMu12(string extras, ref string error)
private static void AsstSetConnectionExtrasMuMu12(string extras)
{
AsstSetConnectionExtras("MuMuEmulator12", extras);
}
@@ -1665,7 +1664,7 @@ namespace MaaWpfGui.Main
switch (Instances.SettingsViewModel.ConnectConfig)
{
case "MuMuEmulator12":
AsstSetConnectionExtrasMuMu12(Instances.SettingsViewModel.MuMuEmulator12Extras.Config, ref error);
AsstSetConnectionExtrasMuMu12(Instances.SettingsViewModel.MuMuEmulator12Extras.Config);
break;
}
@@ -1907,12 +1906,11 @@ namespace MaaWpfGui.Main
public bool AsstSetFightTaskParams(string stage, int maxMedicine, int maxStone, int maxTimes, int series, string dropsItemId, int dropsItemQuantity, bool isMainFight = true)
{
var type = isMainFight ? TaskType.Fight : TaskType.FightRemainingSanity;
if (!_latestTaskId.ContainsKey(type))
if (!_latestTaskId.TryGetValue(type, out var id))
{
return false;
}
var id = _latestTaskId[type];
if (id == 0)
{
return false;

View File

@@ -37,7 +37,7 @@ namespace MaaWpfGui.Services
public static extern unsafe bool AsstSetInstanceOption(AsstHandle handle, AsstInstanceOptionKey key, byte* value);
[DllImport("MaaCore.dll")]
public static extern unsafe bool AsstSetStaticOption(AsstStaticOptionKey key, [MarshalAs(UnmanagedType.LPUTF8Str)] string value);
public static extern bool AsstSetStaticOption(AsstStaticOptionKey key, [MarshalAs(UnmanagedType.LPUTF8Str)]string value);
[DllImport("MaaCore.dll")]
public static extern unsafe bool AsstLoadResource(byte* dirname);

File diff suppressed because it is too large Load Diff

View File

@@ -297,7 +297,9 @@ namespace MaaWpfGui.ViewModels.UI
continue;
}
DateTime startTime = new DateTime(currentTime.Year, currentTime.Month, currentTime.Day,
DateTime startTime = new DateTime(currentTime.Year,
currentTime.Month,
currentTime.Day,
Instances.SettingsViewModel.TimerModels.Timers[i].Hour,
Instances.SettingsViewModel.TimerModels.Timers[i].Min,
0);
@@ -2216,7 +2218,7 @@ namespace MaaWpfGui.ViewModels.UI
break;
default:
Execute.OnUIThread(() =>
_ = Execute.OnUIThreadAsync(() =>
{
using var toast = new ToastNotification(LocalizationHelper.GetString("UnknownActionAfterCompleted"));
toast.Show();
@@ -3115,17 +3117,15 @@ namespace MaaWpfGui.ViewModels.UI
private void InitDrops()
{
foreach (var item in ItemListHelper.ArkItems)
foreach (var (val, value) in ItemListHelper.ArkItems)
{
var val = item.Key;
// 不是数字的东西都是正常关卡不会掉的(大概吧)
if (!int.TryParse(val, out _))
{
continue;
}
var dis = item.Value.Name;
var dis = value.Name;
if (_excludedValues.Contains(val))
{