pull/179/head
Halil İbrahim Kalkan 8 years ago
parent 63587a2fb5
commit 6488277c7c

@ -45,8 +45,7 @@ namespace Volo.Abp.VirtualFileSystem.Embedded
resourcePath,
fullPath,
CalculateFileName(fullPath),
lastModificationTime,
false
lastModificationTime
);
}
}
@ -58,13 +57,10 @@ namespace Volo.Abp.VirtualFileSystem.Embedded
return;
}
files[directoryPath] = new EmbeddedResourceFileInfo( //TODO: Create a different simpler class!
Assembly,
null,
files[directoryPath] = new VirtualDirectoryFileInfo(
directoryPath,
CalculateFileName(directoryPath),
lastModificationTime,
true
lastModificationTime
);
if (directoryPath.Contains("/"))

@ -33,14 +33,12 @@ namespace Volo.Abp.VirtualFileSystem.Embedded
public string Name { get; }
public ManifestResourceInfo ManifestResourceInfo { get; }
/// <summary>
/// The time, in UTC.
/// </summary>
public DateTimeOffset LastModified { get; }
public bool IsDirectory { get; }
public bool IsDirectory => false;
private readonly Assembly _assembly;
private readonly string _resourcePath;
@ -50,28 +48,19 @@ namespace Volo.Abp.VirtualFileSystem.Embedded
string resourcePath,
string physicalPath,
string name,
DateTimeOffset lastModified,
bool isDirectory)
DateTimeOffset lastModified)
{
_assembly = assembly;
_resourcePath = resourcePath;
PhysicalPath = physicalPath;
Name = name;
if (_resourcePath != null)
{
ManifestResourceInfo = _assembly.GetManifestResourceInfo(_resourcePath);
}
LastModified = lastModified;
IsDirectory = isDirectory;
}
/// <inheritdoc />
public Stream CreateReadStream()
{
var stream = _assembly.GetManifestResourceStream(_resourcePath);
if (!_length.HasValue)

@ -0,0 +1,33 @@
using System;
using System.IO;
using Microsoft.Extensions.FileProviders;
namespace Volo.Abp.VirtualFileSystem
{
public class VirtualDirectoryFileInfo : IFileInfo
{
public bool Exists => true;
public long Length => 0;
public string PhysicalPath { get; }
public string Name { get; }
public DateTimeOffset LastModified { get; }
public bool IsDirectory => true;
public VirtualDirectoryFileInfo(string physicalPath, string name, DateTimeOffset lastModified)
{
PhysicalPath = physicalPath;
Name = name;
LastModified = lastModified;
}
public Stream CreateReadStream()
{
throw new InvalidOperationException();
}
}
}
Loading…
Cancel
Save