You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

518 lines
26 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.IO;
  5. using System.Linq;
  6. using System.Reflection;
  7. using System.Runtime.InteropServices;
  8. using System.Text;
  9. using IPA.Config;
  10. using IPA.Old;
  11. using IPA.Utilities;
  12. using Mono.Cecil;
  13. using UnityEngine;
  14. using Logger = IPA.Logging.Logger;
  15. using System.Threading.Tasks;
  16. using IPA.Utilities.Async;
  17. using IPA.Loader.Features;
  18. #if NET4
  19. using TaskEx = System.Threading.Tasks.Task;
  20. using TaskEx6 = System.Threading.Tasks.Task;
  21. using Task = System.Threading.Tasks.Task;
  22. #endif
  23. #if NET3
  24. using Net3_Proxy;
  25. using Path = Net3_Proxy.Path;
  26. using File = Net3_Proxy.File;
  27. using Directory = Net3_Proxy.Directory;
  28. using Array = Net3_Proxy.Array;
  29. #endif
  30. namespace IPA.Loader
  31. {
  32. /// <summary>
  33. /// The manager class for all plugins.
  34. /// </summary>
  35. public static class PluginManager
  36. {
  37. #pragma warning disable CS0618 // Type or member is obsolete (IPlugin)
  38. private static List<PluginExecutor> _bsPlugins;
  39. internal static IEnumerable<PluginExecutor> BSMetas => _bsPlugins;
  40. /// <summary>
  41. /// Gets info about the enabled plugin with the specified name.
  42. /// </summary>
  43. /// <param name="name">the name of the plugin to get (must be an exact match)</param>
  44. /// <returns>the plugin metadata for the requested plugin or <see langword="null"/> if it doesn't exist or is disabled</returns>
  45. public static PluginMetadata GetPlugin(string name)
  46. => BSMetas.Select(p => p.Metadata).FirstOrDefault(p => p.Name == name);
  47. /// <summary>
  48. /// Gets info about the enabled plugin with the specified ID.
  49. /// </summary>
  50. /// <param name="name">the ID name of the plugin to get (must be an exact match)</param>
  51. /// <returns>the plugin metadata for the requested plugin or <see langword="null"/> if it doesn't exist or is disabled</returns>
  52. public static PluginMetadata GetPluginFromId(string name)
  53. => BSMetas.Select(p => p.Metadata).FirstOrDefault(p => p.Id == name);
  54. /// <summary>
  55. /// Gets a disabled plugin's metadata by its name.
  56. /// </summary>
  57. /// <param name="name">the name of the disabled plugin to get</param>
  58. /// <returns>the metadata for the corresponding plugin</returns>
  59. public static PluginMetadata GetDisabledPlugin(string name) =>
  60. DisabledPlugins.FirstOrDefault(p => p.Name == name);
  61. /// <summary>
  62. /// Gets a disabled plugin's metadata by its ID.
  63. /// </summary>
  64. /// <param name="name">the ID of the disabled plugin to get</param>
  65. /// <returns>the metadata for the corresponding plugin</returns>
  66. public static PluginMetadata GetDisabledPluginFromId(string name) =>
  67. DisabledPlugins.FirstOrDefault(p => p.Id == name);
  68. /// <summary>
  69. /// Creates a new transaction for mod enabling and disabling mods simultaneously.
  70. /// </summary>
  71. /// <returns>a new <see cref="StateTransitionTransaction"/> that captures the current state of loaded mods</returns>
  72. public static StateTransitionTransaction PluginStateTransaction()
  73. => new StateTransitionTransaction(EnabledPlugins, DisabledPlugins);
  74. private static readonly object commitTransactionLockObject = new object();
  75. internal static Task CommitTransaction(StateTransitionTransaction transaction)
  76. {
  77. if (!transaction.HasStateChanged) return TaskEx.WhenAll();
  78. if (!UnityGame.OnMainThread)
  79. {
  80. var transactionCopy = transaction.Clone();
  81. transaction.Dispose();
  82. return UnityMainThreadTaskScheduler.Factory.StartNew(() => CommitTransaction(transactionCopy)).Unwrap();
  83. }
  84. lock (commitTransactionLockObject)
  85. {
  86. if (transaction.CurrentlyEnabled.Except(EnabledPlugins)
  87. .Concat(EnabledPlugins.Except(transaction.CurrentlyEnabled)).Any()
  88. || transaction.CurrentlyDisabled.Except(DisabledPlugins)
  89. .Concat(DisabledPlugins.Except(transaction.CurrentlyDisabled)).Any())
  90. { // ensure that the transaction's base state reflects the current state, otherwise throw
  91. transaction.Dispose();
  92. throw new InvalidOperationException("Transaction no longer resembles the current state of plugins");
  93. }
  94. var toEnable = transaction.ToEnable;
  95. var toDisable = transaction.ToDisable;
  96. transaction.Dispose();
  97. using var disabledChangeTransaction = DisabledConfig.Instance.ChangeTransaction();
  98. {
  99. // first enable the mods that need to be
  100. void DeTree(List<PluginMetadata> into, IEnumerable<PluginMetadata> tree)
  101. {
  102. foreach (var st in tree)
  103. if (toEnable.Contains(st) && !into.Contains(st))
  104. {
  105. DeTree(into, st.Dependencies);
  106. into.Add(st);
  107. }
  108. }
  109. var enableOrder = new List<PluginMetadata>();
  110. DeTree(enableOrder, toEnable);
  111. foreach (var meta in enableOrder)
  112. {
  113. var executor = runtimeDisabledPlugins.FirstOrDefault(e => e.Metadata == meta);
  114. if (meta.RuntimeOptions == RuntimeOptions.DynamicInit)
  115. {
  116. if (executor != null)
  117. runtimeDisabledPlugins.Remove(executor);
  118. else
  119. executor = PluginLoader.InitPlugin(meta, EnabledPlugins);
  120. if (executor == null) continue; // couldn't initialize, skip to next
  121. }
  122. PluginLoader.DisabledPlugins.Remove(meta);
  123. DisabledConfig.Instance.DisabledModIds.Remove(meta.Id ?? meta.Name);
  124. PluginEnabled?.Invoke(meta, meta.RuntimeOptions != RuntimeOptions.DynamicInit);
  125. if (meta.RuntimeOptions == RuntimeOptions.DynamicInit)
  126. {
  127. _bsPlugins.Add(executor);
  128. try
  129. {
  130. executor.Enable();
  131. }
  132. catch (Exception e)
  133. {
  134. Logger.loader.Error($"Error while enabling {meta.Id}:");
  135. Logger.loader.Error(e);
  136. // this should still be considered enabled, hence its position
  137. }
  138. }
  139. }
  140. }
  141. var result = TaskEx.WhenAll();
  142. {
  143. // then disable the mods that need to be
  144. static DisableExecutor MakeDisableExec(PluginExecutor e)
  145. => new DisableExecutor
  146. {
  147. Executor = e,
  148. Dependents = BSMetas.Where(f => f.Metadata.Dependencies.Contains(e.Metadata)).Select(MakeDisableExec)
  149. };
  150. var disableExecs = toDisable.Select(m => BSMetas.FirstOrDefault(e => e.Metadata == m)).NonNull().ToArray(); // eagerly evaluate once
  151. foreach (var exec in disableExecs)
  152. {
  153. PluginLoader.DisabledPlugins.Add(exec.Metadata);
  154. DisabledConfig.Instance.DisabledModIds.Add(exec.Metadata.Id ?? exec.Metadata.Name);
  155. if (exec.Metadata.RuntimeOptions == RuntimeOptions.DynamicInit)
  156. {
  157. runtimeDisabledPlugins.Add(exec);
  158. _bsPlugins.Remove(exec);
  159. }
  160. PluginDisabled?.Invoke(exec.Metadata, exec.Metadata.RuntimeOptions != RuntimeOptions.DynamicInit);
  161. }
  162. var disableStructure = disableExecs.Select(MakeDisableExec);
  163. static Task Disable(DisableExecutor exec, Dictionary<PluginExecutor, Task> alreadyDisabled)
  164. {
  165. if (alreadyDisabled.TryGetValue(exec.Executor, out var task))
  166. return task;
  167. else
  168. {
  169. if (exec.Executor.Metadata.RuntimeOptions != RuntimeOptions.DynamicInit)
  170. return TaskEx6.FromException(new CannotRuntimeDisableException(exec.Executor.Metadata));
  171. var res = TaskEx.WhenAll(exec.Dependents.Select(d => Disable(d, alreadyDisabled)))
  172. .ContinueWith(t =>
  173. {
  174. if (t.IsFaulted) {
  175. return TaskEx.WhenAll(t, TaskEx6.FromException(
  176. new CannotRuntimeDisableException(exec.Executor.Metadata, "Dependents cannot be disabled for plugin")));
  177. }
  178. return exec.Executor.Disable()
  179. .ContinueWith(t =>
  180. {
  181. foreach (var feature in exec.Executor.Metadata.Features)
  182. {
  183. try {
  184. feature.AfterDisable(exec.Executor.Metadata);
  185. }
  186. catch (Exception e)
  187. {
  188. Logger.loader.Critical($"Feature errored in {nameof(Feature.AfterDisable)}: {e}");
  189. }
  190. }
  191. }, UnityMainThreadTaskScheduler.Default);
  192. }, UnityMainThreadTaskScheduler.Default).Unwrap();
  193. // We do not want to call the disable method if a dependent couldn't be disabled
  194. // By scheduling on a UnityMainThreadScheduler, we ensure that Disable() is always called on the Unity main thread
  195. alreadyDisabled.Add(exec.Executor, res);
  196. return res;
  197. }
  198. }
  199. var disabled = new Dictionary<PluginExecutor, Task>();
  200. result = TaskEx.WhenAll(disableStructure.Select(d => Disable(d, disabled)));
  201. }
  202. OnAnyPluginsStateChanged?.Invoke(result, toEnable, toDisable);
  203. // if there are any that are capable of enabling/disabling at runtime, run event handler
  204. if (toEnable.Concat(toDisable).Any(m => m.RuntimeOptions == RuntimeOptions.DynamicInit))
  205. OnPluginsStateChanged?.Invoke(result);
  206. //DisabledConfig.Instance.Changed();
  207. // changed is handled by transaction
  208. return result;
  209. }
  210. }
  211. private struct DisableExecutor
  212. {
  213. public PluginExecutor Executor;
  214. public IEnumerable<DisableExecutor> Dependents;
  215. }
  216. /// <summary>
  217. /// Checks if a given plugin is disabled.
  218. /// </summary>
  219. /// <param name="meta">the plugin to check</param>
  220. /// <returns><see langword="true"/> if the plugin is disabled, <see langword="false"/> otherwise.</returns>
  221. public static bool IsDisabled(PluginMetadata meta) => DisabledPlugins.Contains(meta);
  222. /// <summary>
  223. /// Checks if a given plugin is enabled.
  224. /// </summary>
  225. /// <param name="meta">the plugin to check</param>
  226. /// <returns><see langword="true"/> if the plugin is enabled, <see langword="false"/> otherwise.</returns>
  227. public static bool IsEnabled(PluginMetadata meta) => BSMetas.Any(p => p.Metadata == meta);
  228. /// <summary>
  229. /// An invoker for the <see cref="PluginEnabled"/> event.
  230. /// </summary>
  231. /// <param name="plugin">the plugin that was enabled</param>
  232. /// <param name="needsRestart">whether it needs a restart to take effect</param>
  233. public delegate void PluginEnableDelegate(PluginMetadata plugin, bool needsRestart);
  234. /// <summary>
  235. /// An invoker for the <see cref="PluginDisabled"/> event.
  236. /// </summary>
  237. /// <param name="plugin">the plugin that was disabled</param>
  238. /// <param name="needsRestart">whether it needs a restart to take effect</param>
  239. public delegate void PluginDisableDelegate(PluginMetadata plugin, bool needsRestart);
  240. /// <summary>
  241. /// A delegate representing a state change event for any plugin.
  242. /// </summary>
  243. /// <param name="changeTask">the <see cref="Task"/> representing the change</param>
  244. /// <param name="enabled">the plugins that were enabled in the change</param>
  245. /// <param name="disabled">the plugins that were disabled in the change</param>
  246. public delegate void OnAnyPluginsStateChangedDelegate(Task changeTask, IEnumerable<PluginMetadata> enabled, IEnumerable<PluginMetadata> disabled);
  247. /// <summary>
  248. /// Called whenever a plugin is enabled, before the plugin in question is enabled.
  249. /// </summary>
  250. public static event PluginEnableDelegate PluginEnabled;
  251. /// <summary>
  252. /// Called whenever a plugin is disabled, before the plugin in question is enabled.
  253. /// </summary>
  254. public static event PluginDisableDelegate PluginDisabled;
  255. /// <summary>
  256. /// Called whenever any plugins have their state changed at runtime with the <see cref="Task"/> representing that state change.
  257. /// </summary>
  258. /// <remarks>
  259. /// Note that this is called on the Unity main thread, and cannot therefore block, as the <see cref="Task"/>
  260. /// provided represents operations that also run on the Unity main thread.
  261. /// </remarks>
  262. public static event Action<Task> OnPluginsStateChanged;
  263. /// <summary>
  264. /// Called whenever any plugins, regardless of whether or not their change occurs during runtime, have their state changed.
  265. /// </summary>
  266. /// <remarks>
  267. /// Note that this is called on the Unity main thread, and cannot therefore block, as the <see cref="Task"/>
  268. /// provided represents operations that also run on the Unity main thread.
  269. /// </remarks>
  270. public static event OnAnyPluginsStateChangedDelegate OnAnyPluginsStateChanged;
  271. /// <summary>
  272. /// Gets a list of all enabled BSIPA plugins. Use <see cref="EnabledPlugins"/> instead of this.
  273. /// </summary>
  274. /// <value>a collection of all enabled plugins as <see cref="PluginMetadata"/>s</value>
  275. [Obsolete("This is an old name that no longer accurately represents its value. Use EnabledPlugins instead.")]
  276. public static IEnumerable<PluginMetadata> AllPlugins => EnabledPlugins;
  277. /// <summary>
  278. /// Gets a collection of all enabled plugins, as represented by <see cref="PluginMetadata"/>.
  279. /// </summary>
  280. /// <value>a collection of all enabled plugins</value>
  281. public static IEnumerable<PluginMetadata> EnabledPlugins => BSMetas.Select(p => p.Metadata);
  282. /// <summary>
  283. /// Gets a list of disabled BSIPA plugins.
  284. /// </summary>
  285. /// <value>a collection of all disabled plugins as <see cref="PluginMetadata"/></value>
  286. public static IEnumerable<PluginMetadata> DisabledPlugins => PluginLoader.DisabledPlugins;
  287. private static readonly HashSet<PluginExecutor> runtimeDisabledPlugins = new HashSet<PluginExecutor>();
  288. /// <summary>
  289. /// Gets a read-only dictionary of an ignored plugin to the reason it was ignored, as an <see cref="IgnoreReason"/>.
  290. /// </summary>
  291. /// <value>a dictionary of <see cref="PluginMetadata"/> to <see cref="IgnoreReason"/> of ignored plugins</value>
  292. public static IReadOnlyDictionary<PluginMetadata, IgnoreReason> IgnoredPlugins => PluginLoader.ignoredPlugins;
  293. /// <summary>
  294. /// An <see cref="IEnumerable{T}"/> of old IPA plugins.
  295. /// </summary>
  296. /// <value>all legacy plugin instances</value>
  297. [Obsolete("This exists only to provide support for legacy IPA plugins based on the IPlugin interface.")]
  298. public static IEnumerable<Old.IPlugin> Plugins => _ipaPlugins;
  299. private static List<Old.IPlugin> _ipaPlugins;
  300. internal static IConfigProvider SelfConfigProvider { get; set; }
  301. internal static void Load()
  302. {
  303. string pluginDirectory = UnityGame.PluginsPath;
  304. // Process.GetCurrentProcess().MainModule crashes the game and Assembly.GetEntryAssembly() is NULL,
  305. // so we need to resort to P/Invoke
  306. string exeName = Path.GetFileNameWithoutExtension(AppInfo.StartupPath);
  307. _bsPlugins = new List<PluginExecutor>();
  308. _ipaPlugins = new List<Old.IPlugin>();
  309. if (!Directory.Exists(pluginDirectory)) return;
  310. string cacheDir = Path.Combine(pluginDirectory, ".cache");
  311. if (!Directory.Exists(cacheDir))
  312. {
  313. Directory.CreateDirectory(cacheDir);
  314. }
  315. else
  316. {
  317. foreach (string plugin in Directory.GetFiles(cacheDir, "*"))
  318. File.Delete(plugin);
  319. }
  320. // initialize BSIPA plugins first
  321. _bsPlugins.AddRange(PluginLoader.LoadPlugins());
  322. var metadataPaths = PluginLoader.PluginsMetadata.Select(m => m.File.FullName).ToList();
  323. var ignoredPaths = PluginLoader.ignoredPlugins.Select(m => m.Key.File.FullName)
  324. .Concat(PluginLoader.ignoredPlugins.SelectMany(m => m.Key.AssociatedFiles.Select(f => f.FullName))).ToList();
  325. var disabledPaths = DisabledPlugins.Select(m => m.File.FullName).ToList();
  326. //Copy plugins to .cache
  327. string[] originalPlugins = Directory.GetFiles(pluginDirectory, "*.dll");
  328. foreach (string s in originalPlugins)
  329. {
  330. if (metadataPaths.Contains(s)) continue;
  331. if (ignoredPaths.Contains(s)) continue;
  332. if (disabledPaths.Contains(s)) continue;
  333. string pluginCopy = Path.Combine(cacheDir, Path.GetFileName(s));
  334. #region Fix assemblies for refactor
  335. var module = ModuleDefinition.ReadModule(Path.Combine(pluginDirectory, s));
  336. foreach (var @ref in module.AssemblyReferences)
  337. { // fix assembly references
  338. if (@ref.Name == "IllusionPlugin" || @ref.Name == "IllusionInjector")
  339. {
  340. @ref.Name = "IPA.Loader";
  341. }
  342. }
  343. foreach (var @ref in module.GetTypeReferences())
  344. { // fix type references
  345. if (@ref.FullName == "IllusionPlugin.IPlugin") @ref.Namespace = "IPA.Old"; //@ref.Name = "";
  346. if (@ref.FullName == "IllusionPlugin.IEnhancedPlugin") @ref.Namespace = "IPA.Old"; //@ref.Name = "";
  347. if (@ref.FullName == "IllusionPlugin.IniFile") @ref.Namespace = "IPA.Config"; //@ref.Name = "";
  348. if (@ref.FullName == "IllusionPlugin.IModPrefs") @ref.Namespace = "IPA.Config"; //@ref.Name = "";
  349. if (@ref.FullName == "IllusionPlugin.ModPrefs") @ref.Namespace = "IPA.Config"; //@ref.Name = "";
  350. if (@ref.FullName == "IllusionPlugin.Utils.ReflectionUtil") @ref.Namespace = "IPA.Utilities"; //@ref.Name = "";
  351. if (@ref.FullName == "IllusionPlugin.Logging.Logger") @ref.Namespace = "IPA.Logging"; //@ref.Name = "";
  352. if (@ref.FullName == "IllusionPlugin.Logging.LogPrinter") @ref.Namespace = "IPA.Logging"; //@ref.Name = "";
  353. if (@ref.FullName == "IllusionInjector.PluginManager") @ref.Namespace = "IPA.Loader"; //@ref.Name = "";
  354. if (@ref.FullName == "IllusionInjector.PluginComponent") @ref.Namespace = "IPA.Loader"; //@ref.Name = "";
  355. if (@ref.FullName == "IllusionInjector.CompositeBSPlugin") @ref.Namespace = "IPA.Loader.Composite"; //@ref.Name = "";
  356. if (@ref.FullName == "IllusionInjector.CompositeIPAPlugin") @ref.Namespace = "IPA.Loader.Composite"; //@ref.Name = "";
  357. if (@ref.FullName == "IllusionInjector.Logging.UnityLogInterceptor") @ref.Namespace = "IPA.Logging"; //@ref.Name = "";
  358. if (@ref.FullName == "IllusionInjector.Logging.StandardLogger") @ref.Namespace = "IPA.Logging"; //@ref.Name = "";
  359. if (@ref.FullName == "IllusionInjector.Updating.SelfPlugin") @ref.Namespace = "IPA.Updating"; //@ref.Name = "";
  360. if (@ref.FullName == "IllusionInjector.Updating.Backup.BackupUnit") @ref.Namespace = "IPA.Updating.Backup"; //@ref.Name = "";
  361. if (@ref.Namespace == "IllusionInjector.Utilities") @ref.Namespace = "IPA.Utilities"; //@ref.Name = "";
  362. if (@ref.Namespace == "IllusionInjector.Logging.Printers") @ref.Namespace = "IPA.Logging.Printers"; //@ref.Name = "";
  363. }
  364. module.Write(pluginCopy);
  365. #endregion
  366. }
  367. //Load copied plugins
  368. string[] copiedPlugins = Directory.GetFiles(cacheDir, "*.dll");
  369. foreach (string s in copiedPlugins)
  370. {
  371. var result = LoadPluginsFromFile(s);
  372. if (result == null) continue;
  373. _ipaPlugins.AddRange(result.NonNull());
  374. }
  375. Logger.log.Info(exeName);
  376. Logger.log.Info($"Running on Unity {Application.unityVersion}");
  377. Logger.log.Info($"Game version {UnityGame.GameVersion}");
  378. Logger.log.Info("-----------------------------");
  379. Logger.log.Info($"Loading plugins from {Utils.GetRelativePath(pluginDirectory, Environment.CurrentDirectory)} and found {_bsPlugins.Count + _ipaPlugins.Count}");
  380. Logger.log.Info("-----------------------------");
  381. foreach (var plugin in _bsPlugins)
  382. {
  383. Logger.log.Info($"{plugin.Metadata.Name} ({plugin.Metadata.Id}): {plugin.Metadata.Version}");
  384. }
  385. Logger.log.Info("-----------------------------");
  386. foreach (var plugin in _ipaPlugins)
  387. {
  388. Logger.log.Info($"{plugin.Name}: {plugin.Version}");
  389. }
  390. Logger.log.Info("-----------------------------");
  391. }
  392. private static IEnumerable<Old.IPlugin> LoadPluginsFromFile(string file)
  393. {
  394. var ipaPlugins = new List<Old.IPlugin>();
  395. if (!File.Exists(file) || !file.EndsWith(".dll", true, null))
  396. return ipaPlugins;
  397. T OptionalGetPlugin<T>(Type t) where T : class
  398. {
  399. if (t.FindInterfaces((t, o) => t == (o as Type), typeof(T)).Length > 0)
  400. {
  401. try
  402. {
  403. T pluginInstance = Activator.CreateInstance(t) as T;
  404. return pluginInstance;
  405. }
  406. catch (Exception e)
  407. {
  408. Logger.loader.Error($"Could not load plugin {t.FullName} in {Path.GetFileName(file)}! {e}");
  409. }
  410. }
  411. return null;
  412. }
  413. try
  414. {
  415. Assembly assembly = Assembly.LoadFrom(file);
  416. foreach (Type t in assembly.GetTypes())
  417. {
  418. var ipaPlugin = OptionalGetPlugin<Old.IPlugin>(t);
  419. if (ipaPlugin != null)
  420. {
  421. ipaPlugins.Add(ipaPlugin);
  422. }
  423. }
  424. }
  425. catch (ReflectionTypeLoadException e)
  426. {
  427. Logger.loader.Error($"Could not load the following types from {Path.GetFileName(file)}:");
  428. Logger.loader.Error($" {string.Join("\n ", e.LoaderExceptions?.Select(e1 => e1?.Message).StrJP() ?? Array.Empty<string>())}");
  429. }
  430. catch (Exception e)
  431. {
  432. Logger.loader.Error($"Could not load {Path.GetFileName(file)}!");
  433. Logger.loader.Error(e);
  434. }
  435. return ipaPlugins;
  436. }
  437. internal static class AppInfo
  438. {
  439. [DllImport("kernel32.dll", CharSet = CharSet.Unicode, ExactSpelling = false)]
  440. private static extern int GetModuleFileName(HandleRef hModule, StringBuilder buffer, int length);
  441. private static HandleRef NullHandleRef = new HandleRef(null, IntPtr.Zero);
  442. public static string StartupPath
  443. {
  444. get
  445. {
  446. StringBuilder stringBuilder = new StringBuilder(260);
  447. GetModuleFileName(NullHandleRef, stringBuilder, stringBuilder.Capacity);
  448. return stringBuilder.ToString();
  449. }
  450. }
  451. }
  452. #pragma warning restore CS0618 // Type or member is obsolete (IPlugin)
  453. }
  454. }