diff --git a/resource/global/YoStarEN/resource/tasks.json b/resource/global/YoStarEN/resource/tasks.json
index d3c359bee9..71c3b6e32d 100644
--- a/resource/global/YoStarEN/resource/tasks.json
+++ b/resource/global/YoStarEN/resource/tasks.json
@@ -210,7 +210,7 @@
"位移"
],
[
- "Crowd Control",
+ "Crowd-Control",
"控场"
],
[
diff --git a/resource/tasks.json b/resource/tasks.json
index 65f55f63e2..1e993776f1 100644
--- a/resource/tasks.json
+++ b/resource/tasks.json
@@ -1557,9 +1557,9 @@
"algorithm": "JustReturn",
"action": "DoNothing",
"next": [
+ "UsePrts-Annihilation",
"UsePrts",
"UsePrts-StageSN",
- "UsePrts-Annihilation",
"StartButton1",
"PRTS3",
"PRTS",
@@ -1679,6 +1679,7 @@
],
"cache": false,
"next": [
+ "UsePrts-Annihilation",
"StartButton1"
]
},
@@ -2445,9 +2446,9 @@
],
"action": "ClickSelf",
"next": [
+ "UsePrts-Annihilation",
"UsePrts",
"UsePrts-StageSN",
- "UsePrts-Annihilation",
"StartButton1"
]
},
diff --git a/src/MeoAsstGui/Bootstrapper.cs b/src/MeoAsstGui/Bootstrapper.cs
index 4d6e2c7f3c..5017b63546 100644
--- a/src/MeoAsstGui/Bootstrapper.cs
+++ b/src/MeoAsstGui/Bootstrapper.cs
@@ -55,6 +55,7 @@ namespace MeoAsstGui
/// 初始化些啥自己加。
protected override void OnStart()
{
+ System.IO.Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory);
base.OnStart();
ViewStatusStorage.Load();
Localization.Load();
diff --git a/src/MeoAsstGui/ViewModels/TaskQueueViewModel.cs b/src/MeoAsstGui/ViewModels/TaskQueueViewModel.cs
index 9e23dce44a..1ca4ad5d03 100644
--- a/src/MeoAsstGui/ViewModels/TaskQueueViewModel.cs
+++ b/src/MeoAsstGui/ViewModels/TaskQueueViewModel.cs
@@ -16,6 +16,7 @@ using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
+using System.Runtime.InteropServices;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows;
@@ -958,6 +959,60 @@ namespace MeoAsstGui
settings.RoguelikeSquad, settings.RoguelikeRoles, settings.RoguelikeCoreChar);
}
+ [DllImport("user32.dll", EntryPoint = "FindWindow")]
+ private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
+
+ [DllImport("User32.dll", CharSet = CharSet.Auto)]
+ private static extern int GetWindowThreadProcessId(IntPtr hwnd, out int id);
+
+ ///
+ /// Kills emulator by Window hwnd.
+ ///
+ /// Whether the operation is successful.
+ public bool killEumlatorbyWindow()
+ {
+ IntPtr hwnd;
+ int pid = 0;
+ var windowname = new[] { "BlueStacks App Player", "BlueStacks", "明日方舟 - MuMu模拟器", "夜神模拟器", "逍遥模拟器", "明日方舟" };
+ Process emulator;
+ foreach (string i in windowname)
+ {
+ hwnd = FindWindow(null, i);
+ if (hwnd != IntPtr.Zero)
+ {
+ GetWindowThreadProcessId(hwnd, out pid);
+ break;
+ }
+ }
+
+ if (pid != 0)
+ {
+ emulator = Process.GetProcessById(pid);
+ emulator.CloseMainWindow();
+ if (!emulator.HasExited)
+ {
+ try
+ {
+ emulator.Kill();
+ }
+ catch
+ {
+ return killEmulator();
+ }
+
+ return true;
+ }
+ else
+ {
+ return true;
+ }
+ }
+ else
+ {
+ return killEmulator();
+ }
+ }
+
///
/// Kills emulator.
///
@@ -1104,7 +1159,7 @@ namespace MeoAsstGui
break;
case ActionType.ExitEmulator:
- if (!killEmulator())
+ if (!killEumlatorbyWindow())
{
AddLog(Localization.GetString("CloseEmulatorFailed"), "DarkRed");
}
@@ -1112,7 +1167,7 @@ namespace MeoAsstGui
break;
case ActionType.ExitEmulatorAndSelf:
- if (!killEmulator())
+ if (!killEumlatorbyWindow())
{
AddLog(Localization.GetString("CloseEmulatorFailed"), "DarkRed");
}