/// <summary> /// Initialize and register an addon /// </summary> /// <param name="addon"></param> private static void RegisterAddon(IAddon addon) { // initialize addon.Initialize(); // add AddonsDictionary.Add(addon.Name, addon); // if this addon has a tab, add it if (addon.HasTab) { TabsDictionary.Add(addon, addon.TabPage); } // if this addon has a settings page, add it if (addon.HasConfig) { SettingsDictionary.Add(addon, addon.ConfigPage); } }
/// <summary> /// Get the instance of a loaded core addon /// </summary> /// <param name="addon">The addon to load</param> /// <returns>Returns the addon if possible, null if the addon isn't loaded</returns> public static IAddon GetRequiredAddon(RequiredAddon addon) { return(AddonsDictionary.ContainsKey(addon.ToString()) ? AddonsDictionary[addon.ToString()] : null); }
/// <summary> /// Get the instance of a loaded addon /// </summary> /// <param name="name">The name of the addon</param> /// <returns>Returns the addon if possible, null if the addon isn't loaded</returns> public static IAddon GetAddon(string name) { return(AddonsDictionary.ContainsKey(name) ? AddonsDictionary[name] : null); }