/// <summary> /// Determines if the specified plugin is active. /// </summary> /// <param name="p_strPath">The path to the plugin whose active status is to be determined.</param> /// <returns><c>true</c> if the specified plugin is active; /// <c>false</c> otherwise.</returns> public bool IsPluginActive(string p_strPath) { string strPath = p_strPath; if (!Path.IsPathRooted(p_strPath)) { strPath = Path.Combine(GameMode.PluginDirectory, GameMode.GetModFormatAdjustedPath(null, p_strPath, true)); } return(ActivePlugins.Contains(ManagedPluginRegistry.GetPlugin(strPath))); }
/// <summary> /// Adds the specified plugin to the list of managed plugins. /// </summary> /// <param name="p_strPluginPath">The path to the plugin to add.</param> /// <returns><c>true</c> if the specified plugin was added; /// <c>false</c> otherwise.</returns> public bool AddPlugin(string p_strPluginPath) { bool booSuccess = ManagedPluginRegistry.RegisterPlugin(p_strPluginPath); if (booSuccess) { PluginOrderLog.SetPluginOrderIndex(ManagedPluginRegistry.GetPlugin(p_strPluginPath), PluginOrderLog.OrderedPlugins.Count); } return(booSuccess); }
/// <summary> /// Determines if the specified plugin is active. /// </summary> /// <param name="p_strPath">The path to the plugin whose active status is to be determined.</param> /// <returns><c>true</c> if the specified plugin is active; /// <c>false</c> otherwise.</returns> public bool IsPluginActive(string p_strPath) { string strPath = p_strPath; if (!Path.IsPathRooted(p_strPath)) { strPath = Path.Combine(GameMode.GameModeEnvironmentInfo.InstallationPath, p_strPath); } return(ActivePlugins.Contains(ManagedPluginRegistry.GetPlugin(strPath))); }
/// <summary> /// Determines if the specified file is a plugin that can be activated for the game mode. /// </summary> /// <param name="p_strPath">The path to the file for which it is to be determined if it is a plugin file.</param> /// <returns><c>true</c> if the specified file is a plugin file that can be activated in the game mode; /// <c>false</c> otherwise.</returns> public bool IsActivatiblePluginFile(string p_strPath) { string strPath = p_strPath; if (!Path.IsPathRooted(p_strPath)) { strPath = Path.Combine(GameMode.GameModeEnvironmentInfo.InstallationPath, p_strPath); } return(ManagedPluginRegistry.IsActivatiblePluginFile(strPath)); }
/// <summary> /// Loads the data from the Install Log file. /// </summary> private void LoadPluginLog() { m_ostActivePlugins.Clear(); if (LogSerializer != null) { foreach (string strPlugin in LogSerializer.LoadPluginLog()) { m_ostActivePlugins.Add(ManagedPluginRegistry.GetPlugin(strPlugin)); } } }
/// <summary> /// Loads the plugin order data from the permanent store. /// </summary> private void LoadPluginOrder() { Trace.TraceInformation("Loading Plugin Order..."); Trace.Indent(); m_oclOrderedPlugins = new ThreadSafeObservableList <Plugin>(); if (LogSerializer != null) { foreach (string strPlugin in LogSerializer.LoadPluginOrder()) { Plugin plgPlugin = ManagedPluginRegistry.GetPlugin(strPlugin); Trace.TraceInformation("Loading {0} (IsNull={1})", strPlugin, (plgPlugin == null)); if (plgPlugin != null) { m_oclOrderedPlugins.Add(plgPlugin); } } } Trace.Unindent(); }
/// <summary> /// Gets the specified plugin. /// </summary> /// <param name="p_strPath">The path of the plugin to retrieve.</param> /// <returns>The specified plugin, or <c>null</c> if the plugin is not registered.</returns> public Plugin GetRegisteredPlugin(string p_strPath) { //TODO this check doesn't work for Gamebryo based games // GetFormatSpecificInstallPath() (or whatever it is called) should be // used instead of InstallationPath // but we can't use it because asking for the mod format here makes no // sense // as such, mods should pass in the full path, or at least a path relative to // InstallationPath // Really, I think GetFormatSpecificInstallPath() should be scrapped, // and mods should adjust for the current game mode, not the game mode for the // current mod format string strPath = p_strPath; if (!Path.IsPathRooted(p_strPath)) { strPath = Path.Combine(GameMode.PluginDirectory, GameMode.GetModFormatAdjustedPath(null, p_strPath, true)); } return(ManagedPluginRegistry.GetPlugin(strPath)); }
/// <summary> /// Loads the data from the Install Log file. /// </summary> private void LoadPluginLog() { if (m_ostActivePlugins != null) { m_ostActivePlugins.Clear(); } else { m_ostActivePlugins = new ObservableSet <Plugin>(PluginComparer.Filename); } if (LogSerializer != null) { foreach (string strPlugin in LogSerializer.LoadPluginLog()) { if (!String.IsNullOrEmpty(strPlugin)) { m_ostActivePlugins.Add(ManagedPluginRegistry.GetPlugin(strPlugin)); } } } }
/// <summary> /// Removes the specified plugin from the list of managed plugins. /// </summary> /// <param name="p_strPluginPath">The path to the plugin to remove.</param> public void RemovePlugin(string p_strPluginPath) { RemovePlugin(ManagedPluginRegistry.GetPlugin(p_strPluginPath)); }
/// <summary> /// Removes the given plugin from the list of managed plugins. /// </summary> /// <param name="p_plgPlugin">The plugin to remove.</param> public void RemovePlugin(Plugin p_plgPlugin) { ActivePluginLog.DeactivatePlugin(p_plgPlugin); PluginOrderLog.RemovePlugin(p_plgPlugin); ManagedPluginRegistry.UnregisterPlugin(p_plgPlugin); }
/// <summary> /// Deactivates the specified plugin. /// </summary> /// <param name="p_strPath">The path to the plugin to deactivate.</param> public void DeactivatePlugin(string p_strPath) { DeactivatePlugin(ManagedPluginRegistry.GetPlugin(p_strPath)); }