Пример #1
0
        void Update(string [] args)
        {
            bool showAll = args.Length > 0 && args [0] == "-a";

            Console.WriteLine("Looking for updates...");
            service.Repositories.UpdateAllRepositories(null);

            PackageCollection packs = new PackageCollection();

            AddinRepositoryEntry[] addins = service.Repositories.GetAvailableAddins();
            foreach (PackageRepositoryEntry addin in addins)
            {
                Addin sinfo = registry.GetAddin(addin.Addin.Id);
                if (!showAll && IsHidden(sinfo))
                {
                    continue;
                }
                if (sinfo != null && Addin.CompareVersions(sinfo.Version, addin.Addin.Version) == 1)
                {
                    packs.Add(AddinPackage.FromRepository(addin));
                }
            }
            if (packs.Count > 0)
            {
                Install(packs);
            }
            else
            {
                Console.WriteLine("No updates found.");
            }
        }
Пример #2
0
        void CheckInstall(string[] args)
        {
            if (args.Length < 1)
            {
                PrintHelp("check-install");
                return;
            }

            PackageCollection packs = new PackageCollection();

            for (int n = 0; n < args.Length; n++)
            {
                Addin addin = registry.GetAddin(GetFullId(args[n]));
                if (addin != null)
                {
                    continue;
                }
                string aname    = Addin.GetIdName(GetFullId(args[n]));
                string aversion = Addin.GetIdVersion(args[n]);
                if (aversion.Length == 0)
                {
                    aversion = null;
                }

                AddinRepositoryEntry[] ads = service.Repositories.GetAvailableAddin(aname, aversion);
                if (ads.Length == 0)
                {
                    throw new InstallException("The addin '" + args[n] + "' is not available for install.");
                }
                packs.Add(AddinPackage.FromRepository(ads[ads.Length - 1]));
            }
            Install(packs, false);
        }
Пример #3
0
        void Install(string[] args)
        {
            if (args.Length < 1)
            {
                PrintHelp("install");
                return;
            }

            PackageCollection packs = new PackageCollection();

            for (int n = 0; n < args.Length; n++)
            {
                if (File.Exists(args [n]))
                {
                    packs.Add(AddinPackage.FromFile(args [n]));
                }
                else
                {
                    string aname    = Addin.GetIdName(GetFullId(args[n]));
                    string aversion = Addin.GetIdVersion(args[n]);
                    if (aversion.Length == 0)
                    {
                        aversion = null;
                    }

                    AddinRepositoryEntry[] ads = service.Repositories.GetAvailableAddin(aname, aversion);
                    if (ads.Length == 0)
                    {
                        throw new InstallException("The addin '" + args[n] + "' is not available for install.");
                    }
                    packs.Add(AddinPackage.FromRepository(ads[ads.Length - 1]));
                }
            }
            Install(packs, true);
        }
Пример #4
0
 public bool ResolveDependencies(IProgressStatus statusMonitor, AddinRepositoryEntry[] addins, out PackageCollection resolved, out PackageCollection toUninstall, out DependencyCollection unresolved)
 {
     resolved = new PackageCollection();
     for (int n = 0; n < addins.Length; n++)
     {
         resolved.Add(AddinPackage.FromRepository(addins [n]));
     }
     return(ResolveDependencies(statusMonitor, resolved, out toUninstall, out unresolved));
 }
Пример #5
0
        public bool Install(IProgressStatus statusMonitor, params AddinRepositoryEntry[] addins)
        {
            Package[] packages = new Package [addins.Length];
            for (int n = 0; n < addins.Length; n++)
            {
                packages [n] = AddinPackage.FromRepository(addins [n]);
            }

            return(Install(statusMonitor, packages));
        }
Пример #6
0
        internal void ResolveDependency(IProgressMonitor monitor, Dependency dep, AddinPackage parentPackage, PackageCollection toInstall, PackageCollection toUninstall, PackageCollection installedRequired, DependencyCollection unresolved)
        {
            AddinDependency adep = dep as AddinDependency;

            if (adep == null)
            {
                return;
            }

            string nsid = Addin.GetFullId(parentPackage.Addin.Namespace, adep.AddinId, null);

            foreach (Package p in toInstall)
            {
                AddinPackage ap = p as AddinPackage;
                if (ap != null)
                {
                    if (Addin.GetIdName(ap.Addin.Id) == nsid && ((AddinInfo)ap.Addin).SupportsVersion(adep.Version))
                    {
                        return;
                    }
                }
            }

            ArrayList addins = new ArrayList();

            addins.AddRange(service.Registry.GetAddins());
            addins.AddRange(service.Registry.GetAddinRoots());

            foreach (Addin addin in addins)
            {
                if (Addin.GetIdName(addin.Id) == nsid && addin.SupportsVersion(adep.Version))
                {
                    AddinPackage p = AddinPackage.FromInstalledAddin(addin);
                    if (!installedRequired.Contains(p))
                    {
                        installedRequired.Add(p);
                    }
                    return;
                }
            }

            AddinRepositoryEntry[] avaddins = service.Repositories.GetAvailableAddins();
            foreach (PackageRepositoryEntry avAddin in avaddins)
            {
                if (Addin.GetIdName(avAddin.Addin.Id) == nsid && ((AddinInfo)avAddin.Addin).SupportsVersion(adep.Version))
                {
                    toInstall.Add(AddinPackage.FromRepository(avAddin));
                    return;
                }
            }
            unresolved.Add(adep);
        }
Пример #7
0
        void Install(string[] args)
        {
            if (args.Length < 1)
            {
                PrintHelp("install");
                return;
            }

            PackageCollection packs = new PackageCollection();

            for (int n = 0; n < args.Length; n++)
            {
                if (File.Exists(args [n]))
                {
                    packs.Add(AddinPackage.FromFile(args [n]));
                }
                else
                {
                    string[] aname             = args[n].Split('/');
                    AddinRepositoryEntry[] ads = service.Repositories.GetAvailableAddin(aname[0], null);
                    if (ads.Length == 0)
                    {
                        throw new InstallException("The addin '" + args[n] + "' is not available for install.");
                    }
                    if (ads.Length > 1)
                    {
                        if (aname.Length < 2)
                        {
                            Console.WriteLine(args[n] + ": the addin version is required because there are several versions of the same addin available.");
                            return;
                        }
                        ads = service.Repositories.GetAvailableAddin(aname[0], aname[1]);
                        if (ads.Length == 0)
                        {
                            throw new InstallException("The addin " + aname[0] + " v" + aname[1] + " is not available.");
                        }
                    }

                    packs.Add(AddinPackage.FromRepository(ads[0]));
                }
            }
            Install(packs);
        }