private void LoadPlugin(string pluginClassName, CPRoConPluginLoaderFactory pluginFactory, bool blSandboxDisabled) { bool blSandboxEnabled = (blSandboxDisabled == true) ? false : true; string outputAssembly = Path.Combine(PluginBaseDirectory, pluginClassName + ".dll"); if (File.Exists(outputAssembly) == true) { IPRoConPluginInterface pluginRemoteInterface = pluginFactory.Create(outputAssembly, "PRoConEvents." + pluginClassName, null); // Indirectely invoke registercallbacks since the delegates cannot go in the interface. pluginRemoteInterface.Invoke("RegisterCallbacks", new object[] {new CPRoConMarshalByRefObject.ExecuteCommandHandler(PluginCallbacks.ExecuteCommand_Callback), new CPRoConMarshalByRefObject.GetAccountPrivilegesHandler(PluginCallbacks.GetAccountPrivileges_Callback), new CPRoConMarshalByRefObject.GetVariableHandler(PluginCallbacks.GetVariable_Callback), new CPRoConMarshalByRefObject.GetVariableHandler(PluginCallbacks.GetSvVariable_Callback), new CPRoConMarshalByRefObject.GetMapDefinesHandler(PluginCallbacks.GetMapDefines_Callback), new CPRoConMarshalByRefObject.TryGetLocalizedHandler(PluginCallbacks.TryGetLocalized_Callback), new CPRoConMarshalByRefObject.RegisterCommandHandler(PluginCallbacks.RegisterCommand_Callback), new CPRoConMarshalByRefObject.UnregisterCommandHandler(PluginCallbacks.UnregisterCommand_Callback), new CPRoConMarshalByRefObject.GetRegisteredCommandsHandler(PluginCallbacks.GetRegisteredCommands_Callback), new CPRoConMarshalByRefObject.GetWeaponDefinesHandler(PluginCallbacks.GetWeaponDefines_Callback), new CPRoConMarshalByRefObject.GetSpecializationDefinesHandler(PluginCallbacks.GetSpecializationDefines_Callback), new CPRoConMarshalByRefObject.GetLoggedInAccountUsernamesHandler(PluginCallbacks.GetLoggedInAccountUsernames_Callback), new CPRoConMarshalByRefObject.RegisterEventsHandler(PluginCallbacks.RegisterEvents_Callback)}); Plugins.AddLoadedPlugin(pluginClassName, pluginRemoteInterface); /* if (this.m_dicLoadedPlugins.ContainsKey(pluginClassName) == false) { this.m_dicLoadedPlugins.Add(pluginClassName, loRemote); } else { this.m_dicLoadedPlugins[pluginClassName] = loRemote; } this.LoadedClassNames.Add(pluginClassName); */ var pluginEnvironment = new List<string>() { Assembly.GetExecutingAssembly().GetName().Version.ToString(), ProconClient.GameType, ProconClient.CurrentServerInfo.GameMod.ToString(), blSandboxEnabled.ToString() }; InvokeOnLoaded(pluginClassName, "OnPluginLoadingEnv", pluginEnvironment); WritePluginConsole("Loading {0}... ^2Loaded", pluginClassName); InvokeOnLoaded(pluginClassName, "OnPluginLoaded", ProconClient.HostName, ProconClient.Port.ToString(CultureInfo.InvariantCulture), Assembly.GetExecutingAssembly().GetName().Version.ToString()); if (PluginLoaded != null) { FrostbiteConnection.RaiseEvent(PluginLoaded.GetInvocationList(), pluginClassName); } } //else { // this.CacheFailCompiledPluginVariables.Add(pluginClassName, new Dictionary<string, string>()); //} }
private void LoadPlugin(string pluginClassName, CPRoConPluginLoaderFactory pluginFactory) { string outputAssembly = Path.Combine(this.PluginBaseDirectory, pluginClassName + ".dll"); if (File.Exists(outputAssembly) == true) { IPRoConPluginInterface loRemote = (IPRoConPluginInterface)pluginFactory.Create(outputAssembly, "PRoConEvents." + pluginClassName, null); // Indirectely invoke registercallbacks since the delegates cannot go in the interface. loRemote.Invoke("RegisterCallbacks", new object[] { new CPRoConMarshalByRefObject.ExecuteCommandHandler(this.m_cpPluginCallbacks.ExecuteCommand_Callback), new CPRoConMarshalByRefObject.GetAccountPrivilegesHandler(this.m_cpPluginCallbacks.GetAccountPrivileges_Callback), new CPRoConMarshalByRefObject.GetVariableHandler(this.m_cpPluginCallbacks.GetVariable_Callback), new CPRoConMarshalByRefObject.GetVariableHandler(this.m_cpPluginCallbacks.GetSvVariable_Callback), new CPRoConMarshalByRefObject.GetMapDefinesHandler(this.m_cpPluginCallbacks.GetMapDefines_Callback), new CPRoConMarshalByRefObject.TryGetLocalizedHandler(this.m_cpPluginCallbacks.TryGetLocalized_Callback), new CPRoConMarshalByRefObject.RegisterCommandHandler(this.m_cpPluginCallbacks.RegisterCommand_Callback), new CPRoConMarshalByRefObject.UnregisterCommandHandler(this.m_cpPluginCallbacks.UnregisterCommand_Callback), new CPRoConMarshalByRefObject.GetRegisteredCommandsHandler(this.m_cpPluginCallbacks.GetRegisteredCommands_Callback), new CPRoConMarshalByRefObject.GetWeaponDefinesHandler(this.m_cpPluginCallbacks.GetWeaponDefines_Callback), new CPRoConMarshalByRefObject.GetSpecializationDefinesHandler(this.m_cpPluginCallbacks.GetSpecializationDefines_Callback), new CPRoConMarshalByRefObject.GetLoggedInAccountUsernamesHandler(this.m_cpPluginCallbacks.GetLoggedInAccountUsernames_Callback), new CPRoConMarshalByRefObject.RegisterEventsHandler(this.m_cpPluginCallbacks.RegisterEvents_Callback) }); this.Plugins.AddLoadedPlugin(pluginClassName, loRemote); /* if (this.m_dicLoadedPlugins.ContainsKey(pluginClassName) == false) { this.m_dicLoadedPlugins.Add(pluginClassName, loRemote); } else { this.m_dicLoadedPlugins[pluginClassName] = loRemote; } this.LoadedClassNames.Add(pluginClassName); */ this.WritePluginConsole("Loading {0}... ^2Loaded", pluginClassName); this.InvokeOnLoaded(pluginClassName, "OnPluginLoaded", this.m_client.HostName, this.m_client.Port.ToString(), Assembly.GetExecutingAssembly().GetName().Version.ToString()); if (this.PluginLoaded != null) { FrostbiteConnection.RaiseEvent(this.PluginLoaded.GetInvocationList(), pluginClassName); } } //else { // this.CacheFailCompiledPluginVariables.Add(pluginClassName, new Dictionary<string, string>()); //} }