Exemplo n.º 1
0
        // Register a repository
        /// <summary>
        /// Register a repository with our server.
        /// </summary>
        /// <returns>
        /// result of the action
        /// </returns>
        /// <param name='repo'>
        /// The URL of the repository we want to add
        /// </param>
        public bool AddRepository(string repo)
        {
            Repositories.RegisterRepository(null, repo, true);
            PluginRegistry.Rebuild(null);

            return(true);
        }
Exemplo n.º 2
0
        public void ResolveInstalledDuplicateAddin(string version)
        {
            var dir      = Util.GetSampleDirectory("ScanTest");
            var registry = new AddinRegistry(Path.Combine(dir, "Config"), Path.Combine(dir, "App"), Path.Combine(dir, "Addins"));

            // Hide the user addin. We'll simulate that the add-in is added
            var addinPath = Path.Combine(dir, "Addins", "SimpleAddin.addin.xml");

            File.Move(addinPath, addinPath + ".x");

            registry.Rebuild(new ConsoleProgressStatus(true));

            // Query using a lower version number
            var addin = registry.GetAddin("SimpleApp.Ext" + version);

            Assert.IsNotNull(addin);
            Assert.AreEqual("AppDir", addin.Properties.GetPropertyValue("Origin"));

            // Now simulate that the add-in is added

            File.Move(addinPath + ".x", addinPath);
            registry.Update(new ConsoleProgressStatus(true));
            addin = registry.GetAddin("SimpleApp.Ext" + version);
            Assert.IsNotNull(addin);
            Assert.AreEqual("AddinsDir", addin.Properties.GetPropertyValue("Origin"));
        }
Exemplo n.º 3
0
 void RepairRegistry(string[] args)
 {
     registry.Rebuild(new ConsoleProgressStatus(verbose));
 }
Exemplo n.º 4
0
        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);

            bool rebuild = false;

            //the registry can get confused if we switch bindirs
            var markerFile = Path.Combine(DatabaseDir, "lastbin.txt");

            if (Directory.Exists(DatabaseDir))
            {
                if (!File.Exists(markerFile) || File.ReadAllText(markerFile) != BinDir)
                {
                    rebuild = true;
                }
            }

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

            Registry.RegisterExtension(new CecilReflectorExtension());

            var progress = new LogProgressStatus(Log, 2);

            if (rebuild)
            {
                Log.LogMessage(MessageImportance.Normal, "Rebuilding addin database at {0}", DatabaseDir);
                Registry.Rebuild(progress);
            }
            else
            {
                Log.LogMessage(MessageImportance.Normal, "Updating addin database at {0}", DatabaseDir);
                Registry.Update(progress);
            }

            File.WriteAllText(markerFile, BinDir);

            return(!Log.HasLoggedErrors);
        }