Update() public method

Updates the add-in registry.
This method must be called after modifying, installing or uninstalling add-ins. When calling Update, every add-in added to the registry is parsed and validated, and if there is any error it will be rejected. It will also cache add-in information needed at run-time. If during the update operation the registry finds new add-ins or detects that some add-ins have been deleted, the loaded extension points will be updated to include or exclude extension nodes from those add-ins.
public Update ( ) : void
return void
		protected bool InitializeAddinRegistry ()
		{
			if (string.IsNullOrEmpty (ConfigDir))
				Log.LogError ("ConfigDir must be specified");

			if (string.IsNullOrEmpty (AddinsDir))
				Log.LogError ("AddinsDir must be specified");

			if (string.IsNullOrEmpty (DatabaseDir))
				Log.LogError ("DatabaseDir must be specified");

			if (string.IsNullOrEmpty (BinDir))
				Log.LogError ("BinDir must be specified");

			ConfigDir = Path.GetFullPath (ConfigDir);
			BinDir = Path.GetFullPath (BinDir);
			AddinsDir = Path.GetFullPath (AddinsDir);
			DatabaseDir = Path.GetFullPath (DatabaseDir);

			Registry = new AddinRegistry (
				ConfigDir,
				BinDir,
				AddinsDir,
				DatabaseDir
			);

			Log.LogMessage (MessageImportance.Normal, "Updating addin database at {0}", DatabaseDir);
			Registry.Update (new LogProgressStatus (Log, 2));

			return !Log.HasLoggedErrors;
		}
		protected bool InitializeAddinRegistry ()
		{
			if (string.IsNullOrEmpty (ConfigDir))
				Log.LogError ("ConfigDir must be specified");

			if (string.IsNullOrEmpty (AddinsDir))
				Log.LogError ("AddinsDir must be specified");

			if (string.IsNullOrEmpty (DatabaseDir))
				Log.LogError ("DatabaseDir must be specified");

			if (string.IsNullOrEmpty (BinDir))
				Log.LogError ("BinDir must be specified");

			Registry = new AddinRegistry (
				ConfigDir,
				BinDir,
				AddinsDir,
				DatabaseDir
			);

			Registry.Update (new LogProgressStatus (Log, 0));

			return !Log.HasLoggedErrors;
		}
示例#3
0
        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;
            }
        }
示例#4
0
        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();
        }