Beispiel #1
0
 private static void pluginManager_PluginsReady(object sender, DualityPluginEventArgs e)
 {
     if (PluginReady != null)
     {
         PluginReady(sender, new CorePluginEventArgs(e.Plugins.OfType <CorePlugin>()));
     }
 }
Beispiel #2
0
        private static void pluginManager_PluginsRemoved(object sender, DualityPluginEventArgs e)
        {
            // Clean globally cached type data
            ImageCodec.ClearTypeCache();
            ObjectCreator.ClearTypeCache();
            ReflectionHelper.ClearTypeCache();
            Component.RequireMap.ClearTypeCache();
            Component.ExecOrder.ClearTypeCache();
            Serializer.ClearTypeCache();
            CloneProvider.ClearTypeCache();

            // Clean input sources that a disposed Assembly forgot to unregister.
            foreach (CorePlugin plugin in e.Plugins)
            {
                CleanInputSources(plugin.PluginAssembly);
            }

            // Clean event bindings that are still linked to the disposed Assembly.
            foreach (CorePlugin plugin in e.Plugins)
            {
                CleanEventBindings(plugin.PluginAssembly);
            }

            // Reload user and app data
            DualityApp.AppData.Load();
            DualityApp.UserData.Load();
        }
Beispiel #3
0
 private static void pluginManager_PluginsRemoving(object sender, DualityPluginEventArgs e)
 {
     // Dispose any existing Resources that could reference plugin data
     if (!Scene.Current.IsEmpty)
     {
         Scene.Current.Dispose();
     }
 }
Beispiel #4
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 #5
0
        private static void pluginManager_PluginsRemoving(object sender, DualityPluginEventArgs e)
        {
            // Save user and app data, they'll be reloaded after plugin reload is done,
            // as they can reference plugin data as well.
            DualityApp.UserData.Save();
            DualityApp.AppData.Save();

            // Dispose static Resources that could reference plugin data
            VisualLogs.ClearAll();
            if (!Scene.Current.IsEmpty)
            {
                Scene.Current.Dispose();
            }

            // Gather all other Resources that could reference plugin data
            List <Resource> pluginContent = new List <Resource>();
            Assembly        coreAssembly  = typeof(Resource).GetTypeInfo().Assembly;

            foreach (Resource resource in ContentProvider.GetLoadedContent <Resource>())
            {
                if (resource.IsDefaultContent)
                {
                    continue;
                }

                Assembly assembly = resource.GetType().GetTypeInfo().Assembly;
                bool     canReferencePluginData =
                    resource is Prefab ||
                    resource is Scene ||
                    assembly != coreAssembly;

                if (canReferencePluginData)
                {
                    pluginContent.Add(resource);
                }
            }

            // Dispose gathered content to avoid carrying over old instances by accident
            foreach (Resource r in pluginContent)
            {
                ContentProvider.RemoveContent(r);
            }
        }
Beispiel #6
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);
            }
        }
Beispiel #7
0
        private static void pluginManager_PluginsRemoved(object sender, DualityPluginEventArgs e)
        {
            // Clean globally cached type data
            ObjectCreator.ClearTypeCache();
            ReflectionHelper.ClearTypeCache();
            Component.RequireMap.ClearTypeCache();
            Component.ExecOrder.ClearTypeCache();

            // Clean input sources that a disposed Assembly forgot to unregister.
            foreach (CorePlugin plugin in e.Plugins)
            {
                CleanInputSources(plugin.PluginAssembly);
            }

            // Clean event bindings that are still linked to the disposed Assembly.
            foreach (CorePlugin plugin in e.Plugins)
            {
                CleanEventBindings(plugin.PluginAssembly);
            }
        }