From bbb218217581f538ca1ae9a7b7db468d55f385a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E8=BD=BB=E8=AF=AD?= Date: Sun, 17 May 2026 04:33:49 +0800 Subject: [PATCH] chore: add handle valid check --- Plain Craft Launcher 2/Application.xaml.vb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Plain Craft Launcher 2/Application.xaml.vb b/Plain Craft Launcher 2/Application.xaml.vb index a529f2e..e5d352b 100644 --- a/Plain Craft Launcher 2/Application.xaml.vb +++ b/Plain Craft Launcher 2/Application.xaml.vb @@ -201,11 +201,10 @@ RetryCacheCheck: ''' 从文件锁中尝试拖出进程 ''' Public Sub DropToTopByLock(LockPath As String) - Dim Content = File.ReadAllBytes(LockPath) Dim Pid As Integer - If Not Integer.TryParse(Encoding.UTF8.GetString(Content), Pid) Then Return - ShowWindowToTop(Process.GetProcessById(Pid).MainWindowHandle) - + If Not Integer.TryParse(File.ReadAllText(LockPath), Pid) Then Return + Dim Handle = Process.GetProcessById(Pid)?.MainWindowHandle + If Handle <> Intptr.Zero ShowWindowToTop(Handle) End Sub '结束