Files
mixtape/zero.Core/FileStorage/PhysicalFileMeta.cs
T

43 lines
987 B
C#
Raw Normal View History

2021-11-25 12:00:20 +01:00
using Microsoft.Extensions.FileProviders;
namespace zero.FileStorage;
public class PhysicalFileMeta : IFileMeta
{
2021-11-25 15:38:36 +01:00
/// <inheritdoc />
public string Name { get; }
2021-11-25 12:00:20 +01:00
/// <inheritdoc />
public string Path { get; }
/// <inheritdoc />
2021-11-25 15:38:36 +01:00
public string AbsolutePath { get; }
2021-11-25 12:00:20 +01:00
/// <inheritdoc />
public string DirectoryPath { get; }
/// <inheritdoc />
public long Length { get; }
/// <inheritdoc />
public DateTimeOffset LastModifiedDate { get; }
/// <inheritdoc />
public bool IsDirectory { get; }
/// <inheritdoc />
public Dictionary<string, object> Properties { get; }
public PhysicalFileMeta(IFileInfo fileInfo, string path)
{
Path = path;
2021-11-25 15:38:36 +01:00
AbsolutePath = fileInfo.PhysicalPath;
2021-11-25 12:00:20 +01:00
Name = fileInfo.Name;
DirectoryPath = path.Substring(0, path.Length - fileInfo.Name.Length).TrimEnd('/');
LastModifiedDate = fileInfo.LastModified;
Length = fileInfo.Length;
IsDirectory = fileInfo.IsDirectory;
Properties = new();
}
}