57 lines
1.6 KiB
C#
57 lines
1.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
|
|
namespace ln.http.resources
|
|
{
|
|
|
|
public delegate Resource ResourceTypeHook(DirectoryResource directoryResource, FileInfo fileInfo);
|
|
|
|
public class DirectoryResource : Resource
|
|
{
|
|
public ResourceTypeHook ResourceTypeHook { get; set; }
|
|
|
|
DirectoryInfo DirectoryInfo { get; }
|
|
Dictionary<string, DirectoryResource> cache = new Dictionary<string, DirectoryResource>();
|
|
|
|
public DirectoryResource(String path)
|
|
:base(System.IO.Path.GetFileName(path))
|
|
{
|
|
DirectoryInfo = new DirectoryInfo(path);
|
|
}
|
|
public DirectoryResource(Resource container,String path)
|
|
:base(container, System.IO.Path.GetFileName(path))
|
|
{
|
|
DirectoryInfo = new DirectoryInfo(path);
|
|
}
|
|
|
|
public override bool Contains(string name)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public override void AddResource(Resource resource)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public override void RemoveResource(Resource resource)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public override IEnumerable<Resource> GetResources()
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public override HttpResponse GetResponse(HttpRequest httpRequest)
|
|
{
|
|
if (DefaultResource != null)
|
|
return httpRequest.Redirect(String.Join("/", DefaultResource.Path));
|
|
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|
|
}
|