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); }
public bool Install(IProgressStatus statusMonitor, params string[] files) { Package[] packages = new Package [files.Length]; for (int n = 0; n < files.Length; n++) { packages [n] = AddinPackage.FromFile(files [n]); } return(Install(statusMonitor, packages)); }
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); }