internal static void Reload() { List<object> singletonNames = AppDomain.CurrentDomain.GetData("Singletons") as List<object>; AppDomain.Unload(domain); domain = null; pluginLoader = null; if (singletonNames != null) foreach (var s in singletonNames) s.GetType().InvokeMember("_Instance", BindingFlags.Static | BindingFlags.FlattenHierarchy | BindingFlags.NonPublic | BindingFlags.SetField, null, s, new object[] { null }); Load(); }
static void Load() { if (AppDomain.CurrentDomain.FriendlyName != "OnlineVideosSiteUtilDlls") { if (useSeperateDomain) { domain = AppDomain.CreateDomain("OnlineVideosSiteUtilDlls", null, null, null, true); pluginLoader = (PluginLoader)domain.CreateInstanceAndUnwrap( typeof(PluginLoader).Assembly.FullName, typeof(PluginLoader).FullName); domain.SetData(typeof(PluginLoader).FullName, pluginLoader); } else { domain = AppDomain.CurrentDomain; pluginLoader = new PluginLoader(); } } else { domain = AppDomain.CurrentDomain; pluginLoader = (PluginLoader)AppDomain.CurrentDomain.GetData(typeof(PluginLoader).FullName); } }