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

30 lines
865 B

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