private IEnumerable <AddInPackageViewModelBase> GetInstalledAddIns(IEnumerable <IPackage> installedPackages) { AddInPackageViewModelBase addInPackage; // Fill set of ID of installed NuGet packages, so we can later quickly check, whether NuGet package is installed for an AddIn HashSet <string> nuGetPackageIDs = new HashSet <string>(); foreach (IPackage package in installedPackages) { if (!nuGetPackageIDs.Contains(package.Id)) { nuGetPackageIDs.Add(package.Id); } } List <ManagedAddIn> addInList = new List <ManagedAddIn>(AddInManager.Setup.AddInsWithMarkedForInstallation); addInList.Sort(delegate(ManagedAddIn a, ManagedAddIn b) { return(a.AddIn.Name.CompareTo(b.AddIn.Name)); }); foreach (ManagedAddIn addIn in addInList) { if (string.Equals(addIn.AddIn.Properties["addInManagerHidden"], "true", StringComparison.OrdinalIgnoreCase)) { // This excludes the SharpDevelop application appearing as AddIn in the tree continue; } if (!ShowPreinstalledAddIns && AddInManager.Setup.IsAddInPreinstalled(addIn.AddIn)) { continue; } string nuGetPackageID = addIn.LinkedNuGetPackageID; if (!string.IsNullOrEmpty(nuGetPackageID)) { if (nuGetPackageIDs.Contains(nuGetPackageID)) { addIn.InstallationSource = AddInInstallationSource.NuGetRepository; } } addInPackage = new OfflineAddInsViewModel(AddInManager, addIn); yield return(addInPackage); } }
private IEnumerable<AddInPackageViewModelBase> GetInstalledAddIns(IEnumerable<IPackage> installedPackages) { AddInPackageViewModelBase addInPackage; // Fill set of ID of installed NuGet packages, so we can later quickly check, whether NuGet package is installed for an AddIn HashSet<string> nuGetPackageIDs = new HashSet<string>(); foreach (IPackage package in installedPackages) { if (!nuGetPackageIDs.Contains(package.Id)) { nuGetPackageIDs.Add(package.Id); } } List<ManagedAddIn> addInList = new List<ManagedAddIn>(AddInManager.Setup.AddInsWithMarkedForInstallation); addInList.Sort(delegate(ManagedAddIn a, ManagedAddIn b) { return a.AddIn.Name.CompareTo(b.AddIn.Name); }); foreach (ManagedAddIn addIn in addInList) { if (string.Equals(addIn.AddIn.Properties["addInManagerHidden"], "true", StringComparison.OrdinalIgnoreCase)) { // This excludes the SharpDevelop application appearing as AddIn in the tree continue; } if (!ShowPreinstalledAddIns && AddInManager.Setup.IsAddInPreinstalled(addIn.AddIn)) { continue; } string nuGetPackageID = addIn.LinkedNuGetPackageID; if (!string.IsNullOrEmpty(nuGetPackageID)) { if (nuGetPackageIDs.Contains(nuGetPackageID)) { addIn.InstallationSource = AddInInstallationSource.NuGetRepository; } } addInPackage = new OfflineAddInsViewModel(AddInManager, addIn); yield return addInPackage; } }