/// <summary> /// Gets a reference to an extensible application /// </summary> /// <param name="name"> /// Name of the application /// </param> /// <param name="searchPaths"> /// Custom paths where to look for the application. /// </param> /// <returns> /// The Application object. Null if not found. /// </returns> public static Application GetExtensibleApplication(string name, IEnumerable <string> searchPaths) { AddinsPcFileCache pcc = GetAddinsPcFileCache(searchPaths); PackageInfo pi = pcc.GetPackageInfoByName(name, searchPaths); if (pi != null) { return(new Application(pi)); } else { return(null); } }
/// <summary> /// Gets a lis of all known extensible applications /// </summary> /// <param name="searchPaths"> /// Custom paths where to look for applications. /// </param> /// <returns> /// A list of applications. /// </returns> public static Application[] GetExtensibleApplications(IEnumerable <string> searchPaths) { List <Application> list = new List <Application> (); AddinsPcFileCache pcc = GetAddinsPcFileCache(searchPaths); foreach (PackageInfo pinfo in pcc.GetPackages(searchPaths)) { if (pinfo.IsValidPackage) { list.Add(new Application(pinfo)); } } return(list.ToArray()); }
static AddinsPcFileCache GetAddinsPcFileCache(IEnumerable <string> searchPaths) { if (pcFileCache == null) { pcFileCache = new AddinsPcFileCache(); if (searchPaths != null) { pcFileCache.Update(searchPaths); } else { pcFileCache.Update(); } } return(pcFileCache); }
static AddinsPcFileCache GetAddinsPcFileCache(IEnumerable<string> searchPaths) { if (pcFileCache == null) { pcFileCache = new AddinsPcFileCache (); if (searchPaths != null) pcFileCache.Update (searchPaths); else pcFileCache.Update (); } return pcFileCache; }