From 2aa9b9f45b3d5b77e7130cb6eeb36169ef9704c6 Mon Sep 17 00:00:00 2001 From: Katy Coe Date: Sat, 19 Dec 2020 20:50:05 +0100 Subject: [PATCH] Plugins: Implement PluginServices --- .../Plugins/PluginServices.cs | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Il2CppInspector.Common/Plugins/PluginServices.cs diff --git a/Il2CppInspector.Common/Plugins/PluginServices.cs b/Il2CppInspector.Common/Plugins/PluginServices.cs new file mode 100644 index 0000000..bdbc64b --- /dev/null +++ b/Il2CppInspector.Common/Plugins/PluginServices.cs @@ -0,0 +1,37 @@ +/* + Copyright 2020 Katy Coe - http://www.djkaty.com - https://github.com/djkaty + + All rights reserved. +*/ + +using System.Linq; +using Il2CppInspector.PluginAPI.V100; + +namespace Il2CppInspector +{ + /// + /// Plugin-related services we provide to plugins that they can call upon + /// + public class PluginServices + { + // The plugin we are providing services to + private IPlugin plugin; + private PluginServices(IPlugin plugin) => this.plugin = plugin; + + /// + /// Get plugin services for a specific plugin + /// Designed to be used by plugins as a service factory + /// + /// The plugin to provide services to + /// A PluginServices object + public static PluginServices For(IPlugin plugin) { + return new PluginServices(plugin); + } + + /// + /// Provide visual status update text for long-running operations + /// + /// The text to report + public void StatusUpdate(string text) => PluginManager.StatusUpdate(plugin, text); + } +}