Skip to content

Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.

920 B
Raw Blame
//Source https://github.com/OrchardCMS/OrchardCore/tree/dev/src/OrchardCore

using Grand.Business.Core.Interfaces.Storage;
using Microsoft.Extensions.FileProviders;

namespace Grand.Business.Storage.Services;

public class FileSystemStoreEntry : IFileStoreEntry
{
    private readonly IFileInfo _fileInfo;

    internal FileSystemStoreEntry(string path, IFileInfo fileInfo)
    {
        _fileInfo = fileInfo ?? throw new ArgumentNullException(nameof(fileInfo));
        Path = path ?? throw new ArgumentNullException(nameof(path));
    }

    public string Path { get; }

    public string Name => _fileInfo.Name;
    public string DirectoryPath => Path[..^Name.Length].TrimEnd('/');
    public string PhysicalPath => _fileInfo.PhysicalPath;
    public DateTime LastModifiedUtc => _fileInfo.LastModified.UtcDateTime;
    public long Length => _fileInfo.Length;
    public bool IsDirectory => _fileInfo.IsDirectory;
}