/// <summary> /// Returns a collection of all Durian packages that are referenced by the specified <paramref name="assembly"/>. /// </summary> /// <param name="assembly"><see cref="Assembly"/> to get all the referenced Durian packages of.</param> /// <returns>A new instance of <see cref="PackageContainer"/> that contains the referenced Durian packages.</returns> /// <exception cref="ArgumentNullException"><paramref name="assembly"/> is <see langword="null"/>.</exception> public static PackageContainer GetReferencedPackages(this Assembly assembly) { if (assembly is null) { throw new ArgumentNullException(nameof(assembly)); } PackageContainer all = PackageIdentity.GetAllPackages(); return(assembly.GetReferencedPackages(all.AsEnums())); }
/// <summary> /// Returns a collection of all Durian packages present in the provided collection of <paramref name="packages"/> that are referenced by the specified <paramref name="assembly"/>. /// </summary> /// <param name="assembly"><see cref="Assembly"/> to get the referenced Durian packages from.</param> /// <param name="packages"><see cref="PackageContainer"/> that provides a collection of Durian packages to pick from.</param> /// <returns>A new instance of <see cref="PackageContainer"/> that contains the referenced Durian packages.</returns> /// <exception cref="ArgumentNullException"><paramref name="assembly"/> is <see langword="null"/>. -or- <paramref name="packages"/> is <see langword="null"/>.</exception> public static PackageContainer GetReferencedPackages(this Assembly assembly, PackageContainer packages) { if (assembly is null) { throw new ArgumentNullException(nameof(assembly)); } if (packages is null) { throw new ArgumentNullException(nameof(packages)); } if (packages.Count == 0) { return(new PackageContainer()); } return(assembly.GetReferencedPackages(packages.AsEnums())); }
/// <summary> /// Returns a collection of all Durian packages present in the provided collection of <paramref name="packages"/> that are not referenced by the calling <see cref="Assembly"/>. /// </summary> /// <param name="packages"><see cref="PackageContainer"/> that provides a collection of Durian packages to pick from.</param> /// <returns>A new instance of <see cref="PackageContainer"/> that contains the not referenced Durian packages.</returns> /// <exception cref="ArgumentNullException"><paramref name="packages"/> is <see langword="null"/>.</exception> public static PackageContainer GetNotReferencedPackages(PackageContainer packages) { return(Assembly.GetCallingAssembly().GetNotReferencedPackages(packages)); }