ImageResizer
3.4.0
|
Provides thread-safe access to plugin addition, removal, and querying methods More...
Public Member Functions | |
PluginConfig (Config c) | |
Creates a new plugin config section, attached to the specified parent More... | |
void | LoadPlugins () |
Processes the <plugins> section if they are not already loaded. Thread safe. Only executes once. More... | |
void | ForceLoadPlugins () |
Forces loading of the plugins specified in configuration, even if they have already been loaded. Will add duplicate plugins and throw exceptions if you do not call RemoveAll() first. More... | |
IList< IPlugin > | GetPlugins (Type type) |
Returns the subset of installed plugins which implement the specified type or interface More... | |
IList< T > | GetAll< T > () |
Returns all registered instances of the specified plugins More... | |
bool | HasPlugin (Type type) |
Returns true if at least one plugin of the specified type is registered. More... | |
bool | Has< T > () |
Returns true if 1 or more instances of the type are registered. More... | |
T | Get< T > () |
Returns the first registerd instance of the specified plugin. For IMultiInstancePlugins, use GetAll() More... | |
T | GetOrInstall< T > () |
Returns the first registered instance of the specified plugin, or creates a new instance if the plugin isn't installed. More... | |
T | GetOrInstall< T > (T newInstance) |
Returns the first registered instance of the specified plugin, or installs the given instance instead, then re-tries the query More... | |
IPlugin | Install (IPlugin plugin) |
Installs the specified plugin, returning the plugin instance. Convenience method, same as plugin.Install(Config.Current). More... | |
bool | Uninstall (IPlugin plugin) |
Attempts uninstallation of the specified plugin, returning true if successful. Convenience method, same as plugin.Uninstall(Config.Current). More... | |
delegate void | LoggingAvaialableEvent (ILogManager logger) |
IEncoder | GetEncoder (ResizeSettings settings, object original) |
Returns an instance of the first encoder that claims to be able to handle the specified settings. Returns null if no encoders are available. More... | |
Type | FindPluginType (string searchName) |
Searches all loaded assemblies for the specified type, applying rules and prefixes to resolve the namespace and assembly. Returns null if it could not find the type, and logs an issue. More... | |
void | remove_plugin (object plugin) |
For use only by plugins during .Uninstall. Removes the specified plugin from AllPlugins, QuerystringPlugins, CachingSystems, ImageEncoders, and ImageBuiderExtensions, based on which interfaces the instance implements. Plugins may register event handlers and modify settings - thus you should use the plugin's method to uninstall them vs. using this method. More... | |
void | add_plugin (IPlugin plugin) |
Only for use by plugins during IPlugin.Install. Call Plugin.Install instead of this method, since plugins often must perform other initialization actions. Adds the specified plugin to AllPlugins, QuerystringPlugins, CachingSystems, ImageEncoders, and ImageBuiderExtensions, based on which interfaces the instance implements. For ICache and IEncoder, the plugin is inserted at the beginning of CachingSystems and ImageEncoders respectively. To reiterate, plugins may register event handlers and modify settings - thus you should use the plugin's method to uninstall them vs. using this method. Will not register a plugin that is already installed, unless it implementes IMultiInstancePlugin. More... | |
void | RemoveAll () |
Removes all plugins, of every kind. Logs any errors encountered. (Not all plugins support uninstallation) More... | |
override IEnumerable< IIssue > | GetIssues () |
Returns a copy of the list of reported issues. More... | |
Public Member Functions inherited from ImageResizer.Configuration.Issues.IssueSink | |
IssueSink (string defaultSource) | |
virtual void | AcceptIssue (IIssue i) |
Adds the specified issue to the list unless it is an exact duplicate of another instance. More... | |
Public Attributes | |
LoggingAvaialableEvent | LoggingAvailable |
Protected Member Functions | |
void | loadPluginsInternal () |
Not thread safe. Performs actual work. More... | |
void | remove_plugins_by_name (string name) |
void | add_plugin_by_name (string name, NameValueCollection args) |
void | clear_plugins_by_type (string type) |
List< string > | GetOptimizedAssemblyList (string assemblyName, string pluginName) |
This is called to get a sorted list of plugins based on their likelyhood of having the plugin. More... | |
IPlugin | CreatePluginByName (string name, NameValueCollection args) |
IPlugin | CreatePluginByType (Type t, NameValueCollection args) |
Protected Attributes | |
NativeDependencyManager | ndeps = new NativeDependencyManager() |
Config | c |
volatile bool | _pluginsLoaded = false |
object | _loadPluginsSync = new object() |
SafeList< ICurrentConfigProvider > | configProviders = null |
SafeList< BuilderExtension > | imageBuilderExtensions = null |
SafeList< IEncoder > | imageEncoders = null |
SafeList< ICache > | cachingSystems = null |
SafeList< IQuerystringPlugin > | querystringPlugins = null |
SafeList< IFileExtensionPlugin > | fileExtensionPlugins = null |
SafeList< IVirtualImageProvider > | virtualProviderPlugins = null |
SafeList< ISettingsModifier > | settingsModifierPlugins = null |
SafeList< IPlugin > | allPlugins = null |
ILogManager | _logManager = null |
Protected Attributes inherited from ImageResizer.Configuration.Issues.IssueSink | |
string | defaultSource = null |
Properties | |
bool | PluginsLoaded [get] |
Returns true if the <plugins> section has been processed More... | |
SafeList< ICurrentConfigProvider > | ConfigProviders [get] |
Currently registered ICurrentConfigProviders. More... | |
SafeList< BuilderExtension > | ImageBuilderExtensions [get] |
Currently registered set of ImageBuilderExtensions. More... | |
SafeList< IEncoder > | ImageEncoders [get] |
Currently registered IEncoders. More... | |
SafeList< ICache > | CachingSystems [get] |
Currently registered ICache instances More... | |
SafeList< IQuerystringPlugin > | QuerystringPlugins [get] |
Plugins which accept querystring arguments are registered here. More... | |
SafeList< IFileExtensionPlugin > | FileExtensionPlugins [get] |
Plugins which accept new file extensions (in the url) are registered here. More... | |
SafeList< IVirtualImageProvider > | VirtualProviderPlugins [get] |
Plugins which provide virtual files are registered here. More... | |
SafeList< ISettingsModifier > | SettingsModifierPlugins [get] |
Plugins which modify image processing settings. More... | |
SafeList< IPlugin > | AllPlugins [get] |
All plugins should be registered here. Used for diagnostic purposes. More... | |
IEncoderProvider | EncoderProvider [get] |
ILogManager | LogManager [get, set] |
Returns the most recently registered Logging plugin, or null. More... | |
Provides thread-safe access to plugin addition, removal, and querying methods
Definition at line 24 of file PluginConfig.cs.
|
inline |
Creates a new plugin config section, attached to the specified parent
c |
Definition at line 35 of file PluginConfig.cs.
|
inline |
Only for use by plugins during IPlugin.Install. Call Plugin.Install instead of this method, since plugins often must perform other initialization actions. Adds the specified plugin to AllPlugins, QuerystringPlugins, CachingSystems, ImageEncoders, and ImageBuiderExtensions, based on which interfaces the instance implements. For ICache and IEncoder, the plugin is inserted at the beginning of CachingSystems and ImageEncoders respectively. To reiterate, plugins may register event handlers and modify settings - thus you should use the plugin's method to uninstall them vs. using this method. Will not register a plugin that is already installed, unless it implementes IMultiInstancePlugin.
plugin |
Definition at line 542 of file PluginConfig.cs.
|
inline |
Searches all loaded assemblies for the specified type, applying rules and prefixes to resolve the namespace and assembly. Returns null if it could not find the type, and logs an issue.
searchName |
Definition at line 377 of file PluginConfig.cs.
|
inline |
Forces loading of the plugins specified in configuration, even if they have already been loaded. Will add duplicate plugins and throw exceptions if you do not call RemoveAll() first.
Definition at line 66 of file PluginConfig.cs.
|
inline |
Returns the first registerd instance of the specified plugin. For IMultiInstancePlugins, use GetAll()
T |
Definition at line 156 of file PluginConfig.cs.
|
inline |
Returns all registered instances of the specified plugins
T |
Definition at line 120 of file PluginConfig.cs.
|
inline |
Returns an instance of the first encoder that claims to be able to handle the specified settings. Returns null if no encoders are available.
settings | Request settings, like format, quality, colors, dither, etc. |
original | May be a Drawing.Image instance, a path, or null. To provide both, set Image.tag to the path. Helps the encoder detect the original format if the format was not specified. May also be used for palette generation hinting by some encoders. |
Implements ImageResizer.Encoding.IEncoderProvider.
Definition at line 295 of file PluginConfig.cs.
|
inlinevirtual |
Returns a copy of the list of reported issues.
Reimplemented from ImageResizer.Configuration.Issues.IssueSink.
Definition at line 590 of file PluginConfig.cs.
|
inlineprotected |
This is called to get a sorted list of plugins based on their likelyhood of having the plugin.
assemblyName | |
pluginName |
Definition at line 346 of file PluginConfig.cs.
|
inline |
Returns the first registered instance of the specified plugin, or creates a new instance if the plugin isn't installed.
T |
T | : | IPlugin | |
T | : | new() |
Definition at line 169 of file PluginConfig.cs.
|
inline |
Returns the first registered instance of the specified plugin, or installs the given instance instead, then re-tries the query
T |
newInstance |
T | : | IPlugin |
Definition at line 184 of file PluginConfig.cs.
|
inline |
Returns the subset of installed plugins which implement the specified type or interface
type |
Definition at line 108 of file PluginConfig.cs.
|
inline |
Returns true if 1 or more instances of the type are registered.
T |
Definition at line 146 of file PluginConfig.cs.
|
inline |
Returns true if at least one plugin of the specified type is registered.
type |
Definition at line 134 of file PluginConfig.cs.
Installs the specified plugin, returning the plugin instance. Convenience method, same as plugin.Install(Config.Current).
plugin |
Definition at line 201 of file PluginConfig.cs.
|
inline |
Processes the <plugins> section if they are not already loaded. Thread safe. Only executes once.
Definition at line 56 of file PluginConfig.cs.
|
inlineprotected |
Not thread safe. Performs actual work.
Definition at line 86 of file PluginConfig.cs.
|
inline |
For use only by plugins during .Uninstall. Removes the specified plugin from AllPlugins, QuerystringPlugins, CachingSystems, ImageEncoders, and ImageBuiderExtensions, based on which interfaces the instance implements. Plugins may register event handlers and modify settings - thus you should use the plugin's method to uninstall them vs. using this method.
plugin |
Definition at line 521 of file PluginConfig.cs.
|
inline |
Removes all plugins, of every kind. Logs any errors encountered. (Not all plugins support uninstallation)
Definition at line 567 of file PluginConfig.cs.
|
inline |
Attempts uninstallation of the specified plugin, returning true if successful. Convenience method, same as plugin.Uninstall(Config.Current).
plugin |
Definition at line 211 of file PluginConfig.cs.
|
get |
All plugins should be registered here. Used for diagnostic purposes.
Definition at line 272 of file PluginConfig.cs.
|
get |
Currently registered ICache instances
Definition at line 239 of file PluginConfig.cs.
Referenced by ImageResizer.Configuration.PipelineConfig.GetCachingSystem().
|
get |
Currently registered ICurrentConfigProviders.
Definition at line 220 of file PluginConfig.cs.
|
get |
Plugins which accept new file extensions (in the url) are registered here.
Definition at line 252 of file PluginConfig.cs.
Referenced by ImageResizer.Configuration.PipelineConfig._cacheUrlData().
|
get |
Currently registered set of ImageBuilderExtensions.
Definition at line 227 of file PluginConfig.cs.
|
get |
Currently registered IEncoders.
Definition at line 233 of file PluginConfig.cs.
|
getset |
Returns the most recently registered Logging plugin, or null.
Definition at line 281 of file PluginConfig.cs.
Referenced by ImageResizer.Plugins.SourceDiskCache.SourceDiskCachePlugin.Install(), and ImageResizer.Plugins.DiskCache.DiskCache.Install().
|
get |
Returns true if the <plugins> section has been processed
Definition at line 77 of file PluginConfig.cs.
|
get |
Plugins which accept querystring arguments are registered here.
Definition at line 245 of file PluginConfig.cs.
Referenced by ImageResizer.Configuration.PipelineConfig._cacheUrlData().
|
get |
Plugins which modify image processing settings.
Definition at line 265 of file PluginConfig.cs.
Referenced by ImageResizer.Configuration.PipelineConfig.Modify().
|
get |
Plugins which provide virtual files are registered here.
Definition at line 259 of file PluginConfig.cs.
Referenced by ImageResizer.Configuration.PipelineConfig.FileExists(), and ImageResizer.Configuration.PipelineConfig.GetFile().