/// <summary> /// Method for disposing object references, only if all other references /// to this class have already been disposed. This also disposes /// managed resources. /// </summary> /// <param name="disposing"> /// Flag for indicating that this was called from the public <see cref="Dispose()"/> /// method, and thus we really do want to dispose this class reference. /// </param> private void Dispose(Boolean disposing) { if (_isDisposed) { return; } if (disposing) { if (_refCount == 0) { _instance = null; _initialized = false; if (this._plugins != null) { foreach (AvailablePlugin p in this._plugins) { if ((p.Instance.IsInitialized) || (!p.Instance.IsDisposed)) { p.Instance.Dispose(); } } this._plugins.Clear(); this._plugins = null; } _isDisposed = true; } } }
/// <summary> /// Initializes the plugin manager. /// </summary> public void Initialize() { if (_initialized) { return; } this._plugins = new AvailablePluginCollection(); _initialized = true; }
/// <summary> /// Determines if the specified <b>AvailablePlugins</b> collection is /// null or empty. /// </summary> /// <param name="collection"> /// The <b>AvailablePlugins</b> collection to check. /// </param> /// <returns> /// true if the specified collection is null or empty; Otherwise, false. /// </returns> public static Boolean IsNullOrEmpty(AvailablePluginCollection collection) { return((collection == null) || (collection.Count == 0)); }