You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
689 B
27 lines
689 B
1 year ago
|
using StabilityMatrix.Core.Models.Packages;
|
||
2 years ago
|
|
||
1 year ago
|
namespace StabilityMatrix.Core.Helper.Factory;
|
||
2 years ago
|
|
||
2 years ago
|
public class PackageFactory : IPackageFactory
|
||
2 years ago
|
{
|
||
1 year ago
|
/// <summary>
|
||
|
/// Mapping of package.Name to package
|
||
|
/// </summary>
|
||
|
private readonly Dictionary<string, BasePackage> basePackages;
|
||
2 years ago
|
|
||
2 years ago
|
public PackageFactory(IEnumerable<BasePackage> basePackages)
|
||
|
{
|
||
1 year ago
|
this.basePackages = basePackages.ToDictionary(x => x.Name);
|
||
2 years ago
|
}
|
||
|
|
||
|
public IEnumerable<BasePackage> GetAllAvailablePackages()
|
||
2 years ago
|
{
|
||
1 year ago
|
return basePackages.Values;
|
||
2 years ago
|
}
|
||
|
|
||
2 years ago
|
public BasePackage? FindPackageByName(string packageName)
|
||
2 years ago
|
{
|
||
1 year ago
|
return basePackages.GetValueOrDefault(packageName);
|
||
2 years ago
|
}
|
||
|
}
|