From 42d989c5747830ccbf3a1c4b7932b6b64452a028 Mon Sep 17 00:00:00 2001 From: ZouJin Date: Thu, 22 Aug 2024 00:27:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20=E5=A4=9A=E5=BC=80?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=E4=B8=8D=E5=8A=A0=E8=BD=BD=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=20fix=20#361?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VPet-Simulator.Windows/Function/CoreMOD.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/VPet-Simulator.Windows/Function/CoreMOD.cs b/VPet-Simulator.Windows/Function/CoreMOD.cs index 3b882d1..a1b49e4 100644 --- a/VPet-Simulator.Windows/Function/CoreMOD.cs +++ b/VPet-Simulator.Windows/Function/CoreMOD.cs @@ -8,6 +8,7 @@ using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; +using System.Reflection.Metadata; using System.Security.Cryptography.X509Certificates; using VPet_Simulator.Core; using VPet_Simulator.Windows.Interface; @@ -28,6 +29,7 @@ namespace VPet_Simulator.Windows "VPet-Simulator.Core.dll","VPet-Simulator.Windows.Interface.dll","LinePutScript.Localization.WPF.dll", "CSCore.dll" }; + public static Dictionary LoadPlug { get; } = new Dictionary(); public static string NowLoading = null; public string Name { get; set; } public string Author { get; set; } @@ -312,6 +314,11 @@ namespace VPet_Simulator.Windows { #endif var path = tmpfi.Name; + if (LoadPlug.ContainsKey(path)) + { + mw.Plugins.Add((MainPlugin)Activator.CreateInstance(LoadPlug[path], mw)); + continue; + } if (LoadedDLL.Contains(path)) continue; LoadedDLL.Add(path); @@ -358,6 +365,7 @@ namespace VPet_Simulator.Windows var n = exportedType.FullName.ToLower(); if (!(n.Contains("modmaker") || n.Contains("dlc"))) App.MODType.Add(exportedType.FullName); + LoadPlug.Add(path, exportedType); mw.Plugins.Add((MainPlugin)Activator.CreateInstance(exportedType, mw)); } }