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.
recyclarr/src/Recyclarr.TrashLib/Repo/RepoMetadataBuilder.cs

29 lines
820 B

using System.IO.Abstractions;
namespace Recyclarr.TrashLib.Repo;
public class RepoMetadataBuilder : IRepoMetadataBuilder
{
private readonly Lazy<RepoMetadata> _metadata;
private readonly IDirectoryInfo _repoPath;
public RepoMetadataBuilder(ITrashGuidesRepo repo)
{
_repoPath = repo.Path;
_metadata = new Lazy<RepoMetadata>(
() => TrashRepoJsonParser.Deserialize<RepoMetadata>(_repoPath.File("metadata.json")));
}
public IReadOnlyList<IDirectoryInfo> ToDirectoryInfoList(IEnumerable<string> listOfDirectories)
{
return listOfDirectories.Select(x => _repoPath.SubDirectory(x)).ToList();
}
public IDirectoryInfo DocsDirectory => _repoPath.SubDirectory("docs");
public RepoMetadata GetMetadata()
{
return _metadata.Value;
}
}