An IProgressStatus class which writes output to the console.
상속: System.MarshalByRefObject, IProgressStatus
예제 #1
0
		/// <summary>
        /// Installs the plugin.
        /// </summary>
        /// <returns>
        /// The plugin.
        /// </returns>
        /// <param name='args'>
        /// Arguments.
        /// </param>
        public bool InstallPlugin(int ndx, out Dictionary<string, object> result)
        {
            Dictionary<string, object> res = new Dictionary<string, object>();

            PackageCollection pack = new PackageCollection();
            PackageCollection toUninstall;
            DependencyCollection unresolved;

            IProgressStatus ps = new ConsoleProgressStatus(false);

            AddinRepositoryEntry[] available = GetSortedAvailbleAddins();

            if (ndx > (available.Length - 1))
            {
                MainConsole.Instance.Output("Selection out of range");
                result = res;
                return false;
            }

            AddinRepositoryEntry aentry = available[ndx];

            Package p = Package.FromRepository(aentry);
            pack.Add(p);

            ResolveDependencies(ps, pack, out toUninstall, out unresolved);

            // Attempt to install the plugin disabled
            if (Install(ps, pack) == true)
            {
                MainConsole.Instance.Output("Ignore the following error...");
                PluginRegistry.Update(ps);
                Addin addin = PluginRegistry.GetAddin(aentry.Addin.Id);
                PluginRegistry.DisableAddin(addin.Id);
                addin.Enabled = false;
                
                MainConsole.Instance.Output("Installation Success");
                ListInstalledAddins(out res);
                result = res;
                return true;
            } 
            else
            {                
                MainConsole.Instance.Output("Installation Failed");
                result = res;
                return false;
            }
        }
예제 #2
0
 // Sync to repositories
 /// <summary>
 /// Update this instance.
 /// </summary>
 public string Update()
 {
     IProgressStatus ps = new ConsoleProgressStatus(true);
     Repositories.UpdateAllRepositories(ps);
     return "Update";
 }
예제 #3
0
        // Enable plugin
        /// <summary>
        /// Enables the plugin.
        /// </summary>
        /// <param name='args'>
        /// Arguments.
        /// </param>
        public void EnablePlugin(string[] args)
        {
            Addin[] addins = GetSortedAddinList("RobustPlugin");

            int n = Convert.ToInt16(args[2]);
            if (n > (addins.Length -1))
            {
                MainConsole.Instance.Output("Selection out of range");
                return;
            }

            Addin addin = addins[n];

            addin.Enabled = true;
            AddinManager.Registry.EnableAddin(addin.Id);
            // AddinManager.Registry.Update();
            if(PluginRegistry.IsAddinEnabled(addin.Id))
            {
                ConsoleProgressStatus ps = new ConsoleProgressStatus(false);
                if (!AddinManager.AddinEngine.IsAddinLoaded(addin.Id))
                {
                    MainConsole.Instance.Output("Ignore the following error...");
                    AddinManager.Registry.Rebuild(ps);
                    AddinManager.AddinEngine.LoadAddin(ps, addin.Id);
                }
            }
            else
            {
                MainConsole.Instance.OutputFormat("Not Enabled in this domain {0}", addin.Name);
            }
            return;
        }
예제 #4
0
        // List available updates ** 1
        /// <summary>
        /// Lists the updates.
        /// </summary>
        public void ListUpdates()
        {
            IProgressStatus ps = new ConsoleProgressStatus(true);
            Console.WriteLine ("Looking for updates...");
            Repositories.UpdateAllRepositories (ps);
            Console.WriteLine ("Available add-in updates:");

            AddinRepositoryEntry[] entries = Repositories.GetAvailableUpdates();

            foreach (AddinRepositoryEntry entry in entries)
            {
                Console.WriteLine(String.Format("{0}",entry.Addin.Id));
            }
        }
예제 #5
0
        // Remove plugin
        /// <summary>
        /// Uns the install.
        /// </summary>
        /// <param name='args'>
        /// Arguments.
        /// </param>
        public void UnInstall(int ndx)
        {
            Addin[] addins = GetSortedAddinList("RobustPlugin");

            if (ndx > (addins.Length -1))
            {
                MainConsole.Instance.Output("Selection out of range");
                return;
            }

            Addin addin = addins[ndx];
            MainConsole.Instance.OutputFormat("Uninstalling plugin {0}", addin.Id);
            AddinManager.Registry.DisableAddin(addin.Id);
            addin.Enabled = false;
            IProgressStatus ps = new ConsoleProgressStatus(false);
            Uninstall(ps, addin.Id);
            MainConsole.Instance.Output("Uninstall Success - restart to complete operation");
            return;
        }
예제 #6
0
        public void TestSetup()
        {
            setup = new SetupService ();
            baseDir = Path.GetDirectoryName (new Uri (typeof(TestBase).Assembly.CodeBase).LocalPath);
            addinsDir = new DirectoryInfo (baseDir).Parent.Parent.Parent.FullName;
            addinsDir = Path.Combine (addinsDir, "lib");

            repoDir = Path.Combine (TempDir, "repo");
            repoExtrasDir = Path.Combine (repoDir,"extras");
            monitor = new ConsoleProgressStatus (true);

            repoBaseUrl = new Uri (repoDir).ToString ();
            repoUrl = new Uri (Path.Combine (repoDir, "main.mrep")).ToString ();
        }
예제 #7
0
        void Install(PackageCollection packs, bool prompt)
        {
            PackageCollection toUninstall;
            DependencyCollection unresolved;

            IProgressStatus m = new ConsoleProgressStatus (verbose);
            int n = packs.Count;
            if (!service.Store.ResolveDependencies (m, packs, out toUninstall, out unresolved))
                throw new InstallException ("Not all dependencies could be resolved.");

            bool ask = false;
            if (prompt && (packs.Count != n || toUninstall.Count != 0)) {
                Console.WriteLine ("The following packages will be installed:");
                foreach (Package p in packs)
                    Console.WriteLine (" - " + p.Name);
                ask = true;
            }
            if (prompt && (toUninstall.Count != 0)) {
                Console.WriteLine ("The following packages need to be uninstalled:");
                foreach (Package p in toUninstall)
                    Console.WriteLine (" - " + p.Name);
                ask = true;
            }
            if (ask) {
                Console.WriteLine ();
                Console.Write ("Are you sure you want to continue? (y/N): ");
                string res = Console.ReadLine ();
                if (res != "y" && res != "Y")
                    return;
            }

            if (!service.Store.Install (m, packs)) {
                Console.WriteLine ("Install operation failed.");
            }
        }
예제 #8
0
        void BuildPackage(string[] args)
        {
            if (args.Length < 1)
                throw new InstallException ("A file name is required.");

            var monitor= new ConsoleProgressStatus (verbose);

            var outputFile= GetOption("of",service.BuildPackageFilename(monitor,GetOption ("d", "."),args[0]));

            if(!string.IsNullOrEmpty(outputFile))
                service.BuildPackage (monitor, outputFile, args[0]);
        }