mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-15 17:30:27 +08:00
chore: 启动时删除多余文件
This commit is contained in:
@@ -74,11 +74,23 @@ namespace MaaWpfGui.Main
|
||||
*/
|
||||
|
||||
Directory.SetCurrentDirectory(AppContext.BaseDirectory);
|
||||
if (Directory.Exists("debug") is false)
|
||||
if (!Directory.Exists("debug"))
|
||||
{
|
||||
Directory.CreateDirectory("debug");
|
||||
}
|
||||
|
||||
// TODO: Remove after 5.10.0
|
||||
string[] filesToDelete = ["MAA_win7.exe", "启动旧版.cmd"];
|
||||
string curDir = Directory.GetCurrentDirectory();
|
||||
foreach (var file in filesToDelete)
|
||||
{
|
||||
string path = Path.Combine(curDir, file);
|
||||
if (File.Exists(path))
|
||||
{
|
||||
File.Delete(path);
|
||||
}
|
||||
}
|
||||
|
||||
const string LogFilename = "debug/gui.log";
|
||||
const string LogBakFilename = "debug/gui.bak.log";
|
||||
if (File.Exists(LogFilename) && new FileInfo(LogFilename).Length > 4 * 1024 * 1024)
|
||||
|
||||
@@ -222,26 +222,6 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
return false;
|
||||
}
|
||||
|
||||
// 如果是 Framework48,把 MAA.exe 复制一份,重命名为 MAA_win7.exe
|
||||
if (RuntimeInformation.FrameworkDescription.Contains("Framework"))
|
||||
{
|
||||
File.Copy(System.Windows.Forms.Application.ExecutablePath, Path.Combine(curDir, "MAA_win7.exe"), true);
|
||||
const string CmdFileContent = "@echo off\r\nif exist MAA.exe (\r\n ren MAA.exe MAA_v5.exe\r\n)\r\nstart \"\" .\\MAA_win7.exe";
|
||||
File.WriteAllText("启动旧版.cmd", CmdFileContent);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (File.Exists("MAA_win7.exe"))
|
||||
{
|
||||
File.Delete("MAA_win7.exe");
|
||||
}
|
||||
|
||||
if (File.Exists("启动旧版.cmd"))
|
||||
{
|
||||
File.Delete("启动旧版.cmd");
|
||||
}
|
||||
}
|
||||
|
||||
string removeListFile = Path.Combine(extractDir, "removelist.txt");
|
||||
if (File.Exists(removeListFile))
|
||||
{
|
||||
@@ -538,7 +518,8 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
{
|
||||
Process.Start(new ProcessStartInfo(UpdateUrl) { UseShellExecute = true });
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
_ = Execute.OnUIThreadAsync(() =>
|
||||
{
|
||||
using var toast = new ToastNotification((otaFound ? LocalizationHelper.GetString("NewVersionFoundTitle") : LocalizationHelper.GetString("NewVersionFoundButNoPackageTitle")) + " : " + UpdateTag);
|
||||
|
||||
Reference in New Issue
Block a user