From 8d2baeb77f045ba724defa3c888f630d4f0200b4 Mon Sep 17 00:00:00 2001 From: Hakoyu Date: Fri, 29 Mar 2024 23:49:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VPet.ModMaker/Utils/NativeUtils.cs | 24 ++++++++++++++++++++++ VPet.ModMaker/Views/ModMakerWindow.xaml.cs | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/VPet.ModMaker/Utils/NativeUtils.cs b/VPet.ModMaker/Utils/NativeUtils.cs index 1439883..a811231 100644 --- a/VPet.ModMaker/Utils/NativeUtils.cs +++ b/VPet.ModMaker/Utils/NativeUtils.cs @@ -82,4 +82,28 @@ public static class NativeUtils } return bitmapImage; } + + /// + /// 打开文件 + /// + /// 文件路径 + public static void OpenLink(string filePath) + { + System + .Diagnostics.Process.Start( + new System.Diagnostics.ProcessStartInfo(filePath) { UseShellExecute = true } + ) + ?.Close(); + } + + /// + /// 从资源管理器打开文件 + /// + /// 文件路径 + public static void OpenFileInExplorer(string filePath) + { + System + .Diagnostics.Process.Start("Explorer", $"/select,{Path.GetFullPath(filePath)}") + ?.Close(); + } } diff --git a/VPet.ModMaker/Views/ModMakerWindow.xaml.cs b/VPet.ModMaker/Views/ModMakerWindow.xaml.cs index 3654003..aa00111 100644 --- a/VPet.ModMaker/Views/ModMakerWindow.xaml.cs +++ b/VPet.ModMaker/Views/ModMakerWindow.xaml.cs @@ -72,6 +72,6 @@ public partial class ModMakerWindow : WindowX private void Hyperlink_Click(object? sender, RoutedEventArgs e) { - Process.Start(new ProcessStartInfo("https://github.com/LorisYounger/VPet.ModMaker/wiki")); + NativeUtils.OpenLink("https://github.com/LorisYounger/VPet.ModMaker/wiki"); } }