From c6716aa8fe045e170acd09fdd3e05f6e1db567f4 Mon Sep 17 00:00:00 2001 From: Hakoyu Date: Fri, 24 Nov 2023 15:38:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=A8=A1=E7=BB=84=E8=BD=BD?= =?UTF-8?q?=E5=85=A5=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VPet.ModMaker/ViewModels/ModMakerWindowVM.cs | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/VPet.ModMaker/ViewModels/ModMakerWindowVM.cs b/VPet.ModMaker/ViewModels/ModMakerWindowVM.cs index 486c394..5433c2c 100644 --- a/VPet.ModMaker/ViewModels/ModMakerWindowVM.cs +++ b/VPet.ModMaker/ViewModels/ModMakerWindowVM.cs @@ -245,13 +245,27 @@ public class ModMakerWindowVM MessageBox.Show("模组载入失败:\n{0}".Translate(ex)); pendingHandler.Close(); } - if (loader is not null) + if (loader is null) + return; + ModInfoModel? modInfo = null; + try { - var modInfo = new ModInfoModel(loader); + modInfo = new ModInfoModel(loader); EditMod(modInfo); - pendingHandler.Close(); ModEditWindow.InitializeData(); } + catch (Exception ex) + { + pendingHandler.Close(); + ModEditWindow?.Close(); + ModMakerWindow.Show(); + MessageBox.Show("模组载入失败:\n{0}".Translate(ex)); + ModInfoModel.Current = null; + } + finally + { + pendingHandler.Close(); + } } #endregion }