private void Created(string folderPath)
        {
            lock (_lock)
            {
                _log.Debug("PluginService: folder '{0}' created.", folderPath);
                var mefLoader = SeparateAppDomain.CreateInstance <MefLoader>(folderPath, folderPath);
                var plugins   = LoadPlugins(mefLoader);
                if (plugins.Count == 0)
                {
                    SeparateAppDomain.Delete(folderPath);
                    return;
                }

                _plugins.Add(folderPath, plugins);
                PluginsAdded(this, plugins);
            }
        }
        private void Renamed(string oldFolderPath, string newFolderPath)
        {
            lock (_lock)
            {
                _log.Debug("PluginService: folder '{0}' renamed into '{1}'.", oldFolderPath, newFolderPath);

                //try remove old
                AppDomain      oldAppDomain = null;
                List <TPlugin> oldPlugins   = new List <TPlugin>();
                if (_plugins.ContainsKey(oldFolderPath))
                {
                    oldPlugins = _plugins[oldFolderPath];
                    _plugins.Remove(oldFolderPath);
                    oldAppDomain = SeparateAppDomain.Extract(oldFolderPath);
                }

                //try create new
                var mefLoader  = SeparateAppDomain.CreateInstance <MefLoader>(newFolderPath, newFolderPath);
                var newPlugins = LoadPlugins(mefLoader);
                if (newPlugins.Count != 0)
                {
                    _plugins.Add(newFolderPath, newPlugins);
                }

                //raise event
                PluginsChanged(this, oldPlugins, newPlugins);

                if (newPlugins.Count == 0)
                {
                    SeparateAppDomain.Delete(newFolderPath);
                }
                if (oldAppDomain != null)
                {
                    AppDomain.Unload(oldAppDomain);
                }
            }
        }