perf: fix some info from visual studio

This commit is contained in:
status102
2024-02-18 09:48:34 +08:00
parent da23acb6bf
commit 4a63d32682
2 changed files with 11 additions and 12 deletions

View File

@@ -1057,7 +1057,7 @@ namespace MaaWpfGui.Main
allDrops += "\n";
}
allDrops = allDrops.EndsWith("\n") ? allDrops.TrimEnd('\n') : LocalizationHelper.GetString("NoDrop");
allDrops = allDrops.EndsWith('\n') ? allDrops.TrimEnd('\n') : LocalizationHelper.GetString("NoDrop");
Instances.TaskQueueViewModel.AddLog(LocalizationHelper.GetString("TotalDrop") + "\n" + allDrops +
(curTimes >= 0 ? $"\n{LocalizationHelper.GetString("CurTimes")} : {curTimes}" : string.Empty));
break;
@@ -1085,7 +1085,7 @@ namespace MaaWpfGui.Main
string logContent = tags.Select(tagName => tagName.ToString())
.Aggregate(string.Empty, (current, tagStr) => current + (tagStr + "\n"));
logContent = logContent.EndsWith("\n") ? logContent.TrimEnd('\n') : LocalizationHelper.GetString("Error");
logContent = logContent.EndsWith('\n') ? logContent.TrimEnd('\n') : LocalizationHelper.GetString("Error");
Instances.TaskQueueViewModel.AddLog(LocalizationHelper.GetString("RecruitingResults") + "\n" + logContent);
break;
@@ -1152,7 +1152,7 @@ namespace MaaWpfGui.Main
var selected = (JArray)subTaskDetails["tags"] ?? new();
string selectedLog = selected.Aggregate(string.Empty, (current, tag) => current + (tag + "\n"));
selectedLog = selectedLog.EndsWith("\n") ? selectedLog.TrimEnd('\n') : LocalizationHelper.GetString("NoDrop");
selectedLog = selectedLog.EndsWith('\n') ? selectedLog.TrimEnd('\n') : LocalizationHelper.GetString("NoDrop");
Instances.TaskQueueViewModel.AddLog(LocalizationHelper.GetString("Choose") + " Tags\n" + selectedLog);
@@ -1187,7 +1187,6 @@ namespace MaaWpfGui.Main
Instances.TaskQueueViewModel.AddLog(string.Format(LocalizationHelper.GetString("RoguelikeInvestment"), subTaskDetails["count"], subTaskDetails["total"], subTaskDetails["deposit"]), UiLogColor.Info);
break;
case "RoguelikeSettlement":
// 肉鸽结算
bool roguelikeGamePass = (bool)subTaskDetails["game_pass"];
@@ -1456,7 +1455,7 @@ namespace MaaWpfGui.Main
/// <returns>是否有效。</returns>
private static bool IfPortEstablished(string address)
{
if (string.IsNullOrEmpty(address) || !address.Contains(":"))
if (string.IsNullOrEmpty(address) || !address.Contains(':'))
{
return false;
}
@@ -1515,7 +1514,7 @@ namespace MaaWpfGui.Main
// tcp连接测试端口是否有效超时时间500ms
// 如果是本地设备,没有冒号
bool adbResult =
(!Instances.SettingsViewModel.ConnectAddress.Contains(":") &&
(!Instances.SettingsViewModel.ConnectAddress.Contains(':') &&
!string.IsNullOrEmpty(Instances.SettingsViewModel.ConnectAddress)) ||
IfPortEstablished(Instances.SettingsViewModel.ConnectAddress);
bool bsResult = IfPortEstablished(bsHvAddress);

View File

@@ -43,7 +43,7 @@ namespace MaaWpfGui.ViewModels.UI
{
private readonly RunningState _runningState;
private static readonly ILogger _logger = Log.ForContext<CopilotViewModel>();
private List<int> _copilotIdList = new List<int>(); // 用于保存作业列表中的作业的Id对于同一个作业只有都执行成功才点赞
private List<int> _copilotIdList = new(); // 用于保存作业列表中的作业的Id对于同一个作业只有都执行成功才点赞
/// <summary>
/// Gets the view models of log items.
@@ -500,7 +500,7 @@ namespace MaaWpfGui.ViewModels.UI
return;
}
var fileName = fileInfo.Name.Substring(0, fileInfo.Name.Length - fileInfo.Extension.Length);
var fileName = fileInfo.Name[..^fileInfo.Extension.Length];
var stageName = FindStageName(fileName);
if (string.IsNullOrEmpty(stageName))
@@ -601,7 +601,7 @@ namespace MaaWpfGui.ViewModels.UI
// ReSharper disable once UnusedParameter.Global
public void OnDropDownOpened(object sender, EventArgs e)
{
if (!(sender is ComboBox comboBox))
if (sender is not ComboBox comboBox)
{
return;
}
@@ -1005,7 +1005,7 @@ namespace MaaWpfGui.ViewModels.UI
private bool _isVideoTask;
private readonly List<int> _recentlyRatedCopilotId = new List<int>(); // TODO: 可能考虑加个持久化
private readonly List<int> _recentlyRatedCopilotId = new(); // TODO: 可能考虑加个持久化
private bool _couldLikeWebJson;
@@ -1133,7 +1133,7 @@ namespace MaaWpfGui.ViewModels.UI
// ReSharper disable once UnusedParameter.Global
public void MouseDown(object sender, MouseButtonEventArgs e)
{
if (!(sender is UIElement element))
if (sender is not UIElement element)
{
return;
}
@@ -1156,7 +1156,7 @@ namespace MaaWpfGui.ViewModels.UI
return;
}
if (!(sender is UIElement element))
if (sender is not UIElement element)
{
return;
}