private void SetupAPI() { Logger.Log2("Load API"); API.Common.ServerInstnace = this; AppDomain.CurrentDomain.AssemblyResolve += ModuleAssemblyResolver; PluginLoader.LoadFromAssembly(Assembly.GetExecutingAssembly(), false); DirectoryInfo ModulesDir = new DirectoryInfo(Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "Modules")); if (ModulesDir.Exists) { foreach (var module in ModulesDir.GetFiles("*.dll")) { try { var a = Assembly.LoadFile(module.FullName); if (a != null) { ModuleAssemblies.Add(a); PluginLoader.LoadFromAssembly(a, false); } } catch (System.Exception ex) { Logger.Log1("Unable to load module " + module.Name + " :" + ex.ToString()); } } // load the build in modules first Logger.Log2("Modules Startup"); PluginLoader.Startup(this); ModuleLoadComplete?.Invoke(this, EventArgs.Empty); } foreach (var f in ConfigData.PlugIns) { try { DirectoryInfo PluginDir = new DirectoryInfo(Path.GetDirectoryName(f)); var a = Assembly.LoadFile(f); if (a != null) { ModuleAssemblies.Add(a); PluginLoader.LoadFromAssembly(a, true); } } catch (System.Exception ex) { Logger.Log1("Unable to load plug-in " + f + " :" + ex.ToString()); } } Logger.Log2("Plug-ins Startup"); PluginLoader.Startup(this); APILoadComplete?.Invoke(this, EventArgs.Empty); ConfigLoaded?.Invoke(this, EventArgs.Empty); }
private void LoadConfig() { Packages.Clear(); var cfg = UploaderConfigFile.Parse(ConfigKey); if (cfg == null) { return; } ConfigLoaded?.Raise(cfg); var pkgs = cfg.LocalPackages .Select(p => LocalR2Package.From(p)); AsUI(_ => Packages.Swap(pkgs)); if (Packages.Any()) { Package = Packages[0]; } }
/// <summary> /// Load PAD settings to form. /// </summary> /// <param name="padSetting">Settings to read.</param> /// <param name="padIndex">Destination pad index.</param> public void LoadPadSettingsIntoSelectedDevice(MapTo padIndex, PadSetting ps) { // Get pad control with settings. var padControl = Global._MainWindow.MainPanel.MainBodyPanel.PadControls[(int)padIndex - 1]; // Get selected setting. var setting = padControl.CurrentUserSetting; // Return if nothing selected. if (setting == null) { return; } // If setting not supplied then use empty (clear settings). if (ps == null) { ps = new PadSetting(); } LoadPadSettingAndCleanup(setting, ps); SyncFormFromPadSetting(padIndex, ps); RaiseSettingsChanged(null); loadCount++; ConfigLoaded?.Invoke(this, new SettingEventArgs(typeof(PadSetting).Name, loadCount)); }
internal static void Postfix(CameraPlus.Configuration.CameraConfig __instance) { ConfigLoaded?.Invoke(__instance); }
public void LoadConfig(ScreenConfig config) { Config = config; ConfigLoaded?.Invoke(config, null); }