/// Adds an upscaler plugin to the list of available plugins.
/// If a plugin of the same type already exists in the list, then the new plugin won't be added and the index of the existing plugin will be returned instead.
/// </summary>
/// <param name="plugin">The plugin to add</param>
/// <returns>The index in the plugins list where the plugin can be found. Returns a negative number if the plugin could not be added.</returns>
publicstaticintAddPlugin(UpscalerPluginplugin)
{
if(plugin==null)
return-1;
// Check if we already have a plugin of the same type
varpluginType=plugin.GetType();
for(inti=0;i<AvailablePlugins.Count;++i)
{
if(AvailablePlugins[i].GetType()==pluginType)
returni;
}
AvailablePlugins.Add(plugin);
returnAvailablePlugins.Count-1;
}
/// <summary>
/// Sets the currently active upscaler plugin.
/// This deactivates the previously active plugin and creates a new device for the newly activated plugin.
/// If the chosen plugin is already active, then this won't do anything.
/// </summary>
/// <param name="pluginIndex">The index in the available plugin list of the upscaler plugin to activate.</param>
/// <returns>Whether the plugin was successfully changed and activated.</returns>