Beispiel #1
0
 private static void pluginManager_PluginsRemoving(object sender, DualityPluginEventArgs e)
 {
     // Dispose any existing Resources that could reference plugin data
     //VisualLog.ClearAll();
     if (!Scene.Current.IsEmpty)
     {
         Scene.Current.Dispose();
     }
     foreach (Resource r in ContentProvider.EnumeratePluginContent().ToArray())
     {
         ContentProvider.RemoveContent(r.Path);
     }
 }
Beispiel #2
0
        private static void OnDiscardPluginData(IEnumerable <CorePlugin> oldPlugins)
        {
            oldPlugins = oldPlugins.NotNull().Distinct();
            if (!oldPlugins.Any())
            {
                oldPlugins = null;
            }

            if (DiscardPluginData != null)
            {
                DiscardPluginData(null, EventArgs.Empty);
            }

            // Clean globally cached type values
            availTypeDict.Clear();
            ReflectionHelper.ClearTypeCache();
            Component.ClearTypeCache();

            // Dispose any existing Resources that could reference plugin data
            if (!Scene.Current.IsEmpty)
            {
                Scene.Current.Dispose();
            }
            foreach (Resource r in ContentProvider.EnumeratePluginContent().ToArray())
            {
                ContentProvider.RemoveContent(r.Path);
            }

            // Clean input sources that a disposed Assembly forgot to unregister.
            if (oldPlugins != null)
            {
                foreach (CorePlugin plugin in oldPlugins)
                {
                    CleanInputSources(plugin.PluginAssembly);
                }
            }
            // Clean event bindings that are still linked to the disposed Assembly.
            if (oldPlugins != null)
            {
                foreach (CorePlugin plugin in oldPlugins)
                {
                    CleanEventBindings(plugin.PluginAssembly);
                }
            }
        }
Beispiel #3
0
        private static void pluginManager_PluginsRemoving(object sender, DualityPluginEventArgs e)
        {
            // Wrapper method for delivering the old API until removing it in v3.0
            if (DiscardPluginData != null)
            {
                DiscardPluginData(sender, e);
            }

            // Dispose any existing Resources that could reference plugin data
            VisualLog.ClearAll();
            if (!Scene.Current.IsEmpty)
            {
                Scene.Current.Dispose();
            }
            foreach (Resource r in ContentProvider.EnumeratePluginContent().ToArray())
            {
                ContentProvider.RemoveContent(r.Path);
            }
        }