Moving media, appdata, and vpp services into Orchard.FileSystems namespace

--HG--
branch : dev
This commit is contained in:
Louis DeJardin
2010-05-16 13:35:35 -07:00
parent d46d94f1ee
commit 04a53cb2d1
34 changed files with 116 additions and 93 deletions

View File

@@ -1,65 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Orchard.Environment.Configuration;
namespace Orchard.Azure.Environment.Configuration {
public class AzureAppDataFolder : IAppDataFolder {
private readonly AzureFileSystem _fs;
public AzureAppDataFolder() {
_fs = new AzureFileSystem("appdata", null, true);
}
public void CreateFile(string path, string content) {
if(_fs.FileExists(path)) {
DeleteFile(path);
}
using (var stream = _fs.CreateFile(path).OpenWrite()) {
using(var writer = new StreamWriter(stream)) {
writer.Write(content);
}
}
}
public string ReadFile(string path) {
using ( var stream = _fs.GetFile(path).OpenRead() ) {
using ( var reader = new StreamReader(stream) ) {
return reader.ReadToEnd();
}
}
}
public void DeleteFile(string path) {
_fs.DeleteFile(path);
}
public bool FileExists(string path) {
return _fs.FileExists(path);
}
public IEnumerable<string> ListFiles(string path) {
return _fs.ListFiles(path).Select(sf => sf.GetPath());
}
public IEnumerable<string> ListDirectories(string path) {
return _fs.ListFolders(path).Select(sf => sf.GetName());
}
public string CreateDirectory(string path) {
_fs.CreateFolder(path);
return Path.GetDirectoryName(path);
}
public void SetBasePath(string basePath) {
throw new NotImplementedException();
}
public string MapPath(string path) {
throw new NotImplementedException();
}
}
}