internal void Initialize(Assembly startupAsm, string customStartupDirectory, string configDir, string addinsDir, string databaseDir) { lock (LocalLock) { if (initialized) { return; } Initialize(this); string asmFile = null; if (startupAsm != null) { asmFile = new Uri(startupAsm.CodeBase).LocalPath; startupDirectory = System.IO.Path.GetDirectoryName(asmFile); } else { startupDirectory = customStartupDirectory; } string customDir = Environment.GetEnvironmentVariable("MONO_ADDINS_REGISTRY"); if (customDir != null && customDir.Length > 0) { configDir = customDir; } if (string.IsNullOrEmpty(configDir)) { registry = AddinRegistry.GetGlobalRegistry(this, startupDirectory); } else { registry = new AddinRegistry(this, configDir, startupDirectory, addinsDir, databaseDir); } if ((asmFile != null && registry.CreateHostAddinsFile(asmFile)) || registry.UnknownDomain) { registry.Update(new ConsoleProgressStatus(false)); } initialized = true; ActivateRoots(); OnAssemblyLoaded(null, null); AppDomain.CurrentDomain.AssemblyLoad += new AssemblyLoadEventHandler(OnAssemblyLoaded); AppDomain.CurrentDomain.AssemblyResolve += CurrentDomainAssemblyResolve; } }
public static void Initialize(string configDir) { if (initialized) { return; } Assembly asm = Assembly.GetEntryAssembly(); if (asm == null) { asm = Assembly.GetCallingAssembly(); } string asmFile = new Uri(asm.CodeBase).LocalPath; startupDirectory = Path.GetDirectoryName(asmFile); string customDir = Environment.GetEnvironmentVariable("MONO_ADDINS_REGISTRY"); if (customDir != null && customDir.Length > 0) { configDir = customDir; } if (configDir == null || configDir.Length == 0) { registry = AddinRegistry.GetGlobalRegistry(startupDirectory); } else { registry = new AddinRegistry(configDir, startupDirectory); } if (registry.CreateHostAddinsFile(asmFile)) { registry.Update(new ConsoleProgressStatus(false)); } initialized = true; SessionService.Initialize(); }