2012-08-13 10:04:31 -01:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.IO;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Umbraco.Core.IO
|
|
|
|
|
|
{
|
2014-01-09 18:08:13 +11:00
|
|
|
|
//TODO: There is no way to create a directory here without creating a file in a directory and then deleting it
|
2014-10-22 15:52:32 +10:00
|
|
|
|
//TODO: Should probably implement a rename?
|
2014-01-09 18:08:13 +11:00
|
|
|
|
|
2013-01-15 01:19:51 +03:00
|
|
|
|
public interface IFileSystem
|
2012-08-13 10:04:31 -01:00
|
|
|
|
{
|
2012-08-14 09:11:49 -01:00
|
|
|
|
IEnumerable<string> GetDirectories(string path);
|
|
|
|
|
|
|
2012-08-13 10:04:31 -01:00
|
|
|
|
void DeleteDirectory(string path);
|
|
|
|
|
|
|
|
|
|
|
|
void DeleteDirectory(string path, bool recursive);
|
|
|
|
|
|
|
2012-08-14 09:11:49 -01:00
|
|
|
|
bool DirectoryExists(string path);
|
2016-01-26 14:18:30 +01:00
|
|
|
|
|
2012-08-14 09:11:49 -01:00
|
|
|
|
void AddFile(string path, Stream stream);
|
2012-08-13 10:04:31 -01:00
|
|
|
|
|
2016-01-26 14:18:30 +01:00
|
|
|
|
void AddFile(string path, Stream stream, bool overrideIfExists);
|
2012-08-13 10:04:31 -01:00
|
|
|
|
|
2012-08-14 09:11:49 -01:00
|
|
|
|
IEnumerable<string> GetFiles(string path);
|
|
|
|
|
|
|
|
|
|
|
|
IEnumerable<string> GetFiles(string path, string filter);
|
|
|
|
|
|
|
|
|
|
|
|
Stream OpenFile(string path);
|
2012-08-13 10:04:31 -01:00
|
|
|
|
|
|
|
|
|
|
void DeleteFile(string path);
|
|
|
|
|
|
|
|
|
|
|
|
bool FileExists(string path);
|
|
|
|
|
|
|
2012-08-14 09:11:49 -01:00
|
|
|
|
string GetRelativePath(string fullPathOrUrl);
|
2012-08-13 10:04:31 -01:00
|
|
|
|
|
2012-08-14 09:11:49 -01:00
|
|
|
|
string GetFullPath(string path);
|
2012-08-13 10:04:31 -01:00
|
|
|
|
|
2012-08-14 09:11:49 -01:00
|
|
|
|
string GetUrl(string path);
|
2012-08-13 10:04:31 -01:00
|
|
|
|
|
|
|
|
|
|
DateTimeOffset GetLastModified(string path);
|
|
|
|
|
|
|
|
|
|
|
|
DateTimeOffset GetCreated(string path);
|
|
|
|
|
|
}
|
2016-09-16 16:18:59 +02:00
|
|
|
|
|
|
|
|
|
|
// this should be part of IFileSystem but we don't want to change the interface
|
|
|
|
|
|
public interface IFileSystem2 : IFileSystem
|
|
|
|
|
|
{
|
|
|
|
|
|
long GetSize(string path);
|
|
|
|
|
|
}
|
2012-08-13 10:04:31 -01:00
|
|
|
|
}
|