Beispiel #1
0
        public void DoShow()
        {
            AddonLocal = new AptLocal(AddonEnv);

            if (InitializeRepository())
            {
                if (AddonRepo.IsAddonInRepository(ArgAddons[0]))
                {
                    RepositoryAddonInfo info = AddonRepo.GetAddonInfo(ArgAddons[0]);

                    PrintAddonInfo("Name", info.Name);
                    if (AddonLocal.IsInstalled(info.Name))
                    {
                        PrintAddonInfo("State", "Installed");
                        Output.Append(String.Format(" (Version {0})", AddonLocal.GetAddonInfo(info.Name).Version.Major.ToString()));
                    }
                    else
                    {
                        PrintAddonInfo("State", "Not installed");
                    }
                    if (info.Category != null)
                    {
                        PrintAddonInfo("Category", info.Category);
                    }
                    if (info.Author != null)
                    {
                        PrintAddonInfo("Author", info.Author);
                    }
                    PrintAddonInfo("Version", info.Version.Major.ToString());
                    PrintAddonInfo("Interface", info.InterfaceVersion.ToString());
                    if (info.IsStable)
                    {
                        PrintAddonInfo("Stable", "Yes");
                    }
                    else
                    {
                        PrintAddonInfo("Stable", "No");
                    }
                    if (info.PubDate != null)
                    {
                        PrintAddonInfo("Published", info.PubDate);
                    }
                    if (info.RequiredDeps != null)
                    {
                        PrintAddonInfo("Dependencies", String.Join(", ", info.RequiredDeps.ToArray()));
                    }
                    if (info.Description != null)
                    {
                        Output.NewLine();
                        PrintAddonInfo(info.Description);
                        Output.NewLine();
                    }
                }
                else
                {
                    Output.Info("Addon not found in repository.");
                }
            }
        }
Beispiel #2
0
        public void DoInstall()
        {
            AddonLocal  = new AptLocal(AddonEnv);
            AddonRemote = new AptRemote(AddonEnv);

            if (Cfg.AutoUpdateIndex)
            {
                DoUpdate();
            }

            Output.Info("Action: install addon(s).");

            int installedAddons = 0;

            if (InitializeRepository())
            {
                if (!Cfg.AutoUpdateIndex)
                {
                    Output.Info(String.Format("There are currently {0} addons in the database.", AddonRepo.GetAddonNum()));
                    PrintEnvInfo();
                }

                AptActionInstall install = new AptActionInstall(AddonEnv, AddonLocal, AddonRemote, AddonRepo);
                install.AddStatusListener(new AptAction.StatusMessageEventHandler(InstallStatusMessage));

                foreach (string addon in ArgAddons)
                {
                    if (AddonRepo.IsAddonInRepository(addon))
                    {
                        if (install.Install(addon, false))
                        {
                            installedAddons++;
                        }
                    }
                    else
                    {
                        Output.Error(String.Format("Addon not found: {0}", addon));
                    }
                }

                Output.Info(String.Format("Addons installed: {0}", installedAddons));
            }
        }