C# Class BlogEngine.Core.Web.Extensions.ExtensionManager

Datei anzeigen Open project: rasmuskl/ReSharperCourse

Private Properties

Property Type Description
DataStoreExtension BlogEngine.Core.Web.Extensions.ManagedExtension
IsNewExtension bool
LoadExtensions void
SaveToCache void

Public Methods

Method Description
ChangeStatus ( string extension, bool enabled ) : void

Method to change extension status

Contains ( Type type ) : bool

Tell if manager already has this extension

ExtensionEnabled ( string extensionName ) : bool

Enabled / Disabled

GetExtension ( string extensionName ) : BlogEngine.Core.Web.Extensions.ManagedExtension

Returns extension to the client based on name

GetSettings ( string extensionName ) : BlogEngine.Core.Web.Extensions.ExtensionSettings

Method to get settings collection

GetSettings ( string extensionName, string settingName ) : BlogEngine.Core.Web.Extensions.ExtensionSettings

Returns settings for specified extension

ImportSettings ( BlogEngine.Core.Web.Extensions.ExtensionSettings settings ) : bool

Do initial import here. If already imported, let extension manager take care of settings To reset, blogger has to delete all settings in the manager

ImportSettings ( string extensionName, BlogEngine.Core.Web.Extensions.ExtensionSettings settings ) : bool

Imports the settings.

InitSettings ( string extensionName, BlogEngine.Core.Web.Extensions.ExtensionSettings settings ) : BlogEngine.Core.Web.Extensions.ExtensionSettings

Initializes settings by importing default parameters

Save ( ) : void

Will serialize and cache ext. mgr. object

SaveSettings ( BlogEngine.Core.Web.Extensions.ExtensionSettings settings ) : void

Will save settings (add to extension object, then cache and serialize all object hierarhy to XML)

SaveSettings ( string extensionName, BlogEngine.Core.Web.Extensions.ExtensionSettings settings ) : void

The save settings.

SaveToStorage ( ) : bool

Saves ext. manager object to XML file or database table using provider model

SaveToStorage ( BlogEngine.Core.Web.Extensions.ManagedExtension ext ) : bool

Save individual extension to storage

SetAdminPage ( string extension, string url ) : void

A way to let extension author to use custom admin page. Will show up as link on extensions page

SetStatus ( string extension, bool enabled ) : void

Only change status on first load; This allows to enable/disable extension on initial load and then be able to override it with change status from admin interface

ShowSettings ( string extensionName, bool flag ) : void

Show of hide settings in the admin/extensions list

Private Methods

Method Description
DataStoreExtension ( string name ) : BlogEngine.Core.Web.Extensions.ManagedExtension

Returns extension object

IsNewExtension ( string name ) : bool

Extension is "new" if it is loaded from assembly but not yet saved to the disk. This state is needed so that we can initialize extension and its settings on the first load and then override it from admin

LoadExtensions ( ) : void

If extensions not in the cache will load from the XML file. If file not exists will load from assembly using reflection

SaveToCache ( ) : void

Caches for performance. If manager cached and not updates done, chached copy always returned

Method Details

ChangeStatus() public static method

Method to change extension status
public static ChangeStatus ( string extension, bool enabled ) : void
extension string /// Extensio Name ///
enabled bool /// If true, enables extension ///
return void

Contains() public static method

Tell if manager already has this extension
public static Contains ( Type type ) : bool
type System.Type /// Extension Type ///
return bool

ExtensionEnabled() public static method

Enabled / Disabled
public static ExtensionEnabled ( string extensionName ) : bool
extensionName string /// Name of the extension. ///
return bool

GetExtension() public static method

Returns extension to the client based on name
public static GetExtension ( string extensionName ) : BlogEngine.Core.Web.Extensions.ManagedExtension
extensionName string /// Extension name ///
return BlogEngine.Core.Web.Extensions.ManagedExtension

GetSettings() public static method

Method to get settings collection
public static GetSettings ( string extensionName ) : BlogEngine.Core.Web.Extensions.ExtensionSettings
extensionName string /// Extension Name ///
return BlogEngine.Core.Web.Extensions.ExtensionSettings

GetSettings() public static method

Returns settings for specified extension
public static GetSettings ( string extensionName, string settingName ) : BlogEngine.Core.Web.Extensions.ExtensionSettings
extensionName string /// Extension Name ///
settingName string /// Settings Name ///
return BlogEngine.Core.Web.Extensions.ExtensionSettings

ImportSettings() public static method

Do initial import here. If already imported, let extension manager take care of settings To reset, blogger has to delete all settings in the manager
public static ImportSettings ( BlogEngine.Core.Web.Extensions.ExtensionSettings settings ) : bool
settings BlogEngine.Core.Web.Extensions.ExtensionSettings /// The settings. ///
return bool

ImportSettings() public static method

Imports the settings.
public static ImportSettings ( string extensionName, BlogEngine.Core.Web.Extensions.ExtensionSettings settings ) : bool
extensionName string /// Name of the extension. ///
settings BlogEngine.Core.Web.Extensions.ExtensionSettings /// The settings. ///
return bool

InitSettings() public static method

Initializes settings by importing default parameters
public static InitSettings ( string extensionName, BlogEngine.Core.Web.Extensions.ExtensionSettings settings ) : BlogEngine.Core.Web.Extensions.ExtensionSettings
extensionName string /// Extension Name ///
settings BlogEngine.Core.Web.Extensions.ExtensionSettings /// Settings object ///
return BlogEngine.Core.Web.Extensions.ExtensionSettings

Save() public static method

Will serialize and cache ext. mgr. object
public static Save ( ) : void
return void

SaveSettings() public static method

Will save settings (add to extension object, then cache and serialize all object hierarhy to XML)
public static SaveSettings ( BlogEngine.Core.Web.Extensions.ExtensionSettings settings ) : void
settings BlogEngine.Core.Web.Extensions.ExtensionSettings /// Settings object ///
return void

SaveSettings() public static method

The save settings.
public static SaveSettings ( string extensionName, BlogEngine.Core.Web.Extensions.ExtensionSettings settings ) : void
extensionName string /// The extension name. ///
settings BlogEngine.Core.Web.Extensions.ExtensionSettings /// The settings. ///
return void

SaveToStorage() public static method

Saves ext. manager object to XML file or database table using provider model
public static SaveToStorage ( ) : bool
return bool

SaveToStorage() public static method

Save individual extension to storage
public static SaveToStorage ( BlogEngine.Core.Web.Extensions.ManagedExtension ext ) : bool
ext BlogEngine.Core.Web.Extensions.ManagedExtension /// The Extension ///
return bool

SetAdminPage() public static method

A way to let extension author to use custom admin page. Will show up as link on extensions page
public static SetAdminPage ( string extension, string url ) : void
extension string /// Extension Name ///
url string /// Path to custom admin page ///
return void

SetStatus() public static method

Only change status on first load; This allows to enable/disable extension on initial load and then be able to override it with change status from admin interface
public static SetStatus ( string extension, bool enabled ) : void
extension string /// Extension Name ///
enabled bool /// Enable/disable extension on initial load ///
return void

ShowSettings() public static method

Show of hide settings in the admin/extensions list
public static ShowSettings ( string extensionName, bool flag ) : void
extensionName string /// Extension name ///
flag bool /// True of false ///
return void