mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 03:25:23 +08:00
Remove IAppDataFolder implementation for Azure
We don't need this. Azure supports writing tp ~/App_Data. There is no guarantee that the content will persist, but that's exactly the assumption of the IAppDataFolder abstraction: it's a local cache, which persists for _some_ time accross app restarts. --HG-- branch : dev
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using Microsoft.WindowsAzure;
|
||||
using Microsoft.WindowsAzure.ServiceRuntime;
|
||||
using Microsoft.WindowsAzure.StorageClient;
|
||||
using System.IO;
|
||||
using Orchard.FileSystems.Media;
|
||||
|
||||
namespace Orchard.Azure {
|
||||
|
@@ -2,14 +2,13 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Yaml.Serialization;
|
||||
using JetBrains.Annotations;
|
||||
using Microsoft.WindowsAzure;
|
||||
using Microsoft.WindowsAzure.ServiceRuntime;
|
||||
using Microsoft.WindowsAzure.StorageClient;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Environment.Configuration;
|
||||
using Microsoft.WindowsAzure;
|
||||
using Orchard.Localization;
|
||||
|
||||
namespace Orchard.Azure.Environment.Configuration {
|
||||
|
||||
|
@@ -1,70 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Orchard.Environment.Configuration;
|
||||
using Orchard.FileSystems.AppData;
|
||||
|
||||
namespace Orchard.Azure.FileSystems.AppData {
|
||||
public class AzureAppDataFolder : IAppDataFolder {
|
||||
|
||||
private readonly AzureFileSystem _fs;
|
||||
|
||||
public AzureAppDataFolder() {
|
||||
_fs = new AzureFileSystem("appdata", null, true);
|
||||
}
|
||||
|
||||
public void CreateFile(string path, string content) {
|
||||
using ( new HttpContextWeaver() ) {
|
||||
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 ( new HttpContextWeaver() ) {
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
@@ -76,7 +76,6 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="CloudBlobContainerExtensions.cs" />
|
||||
<Compile Include="HttpContextWeaver.cs" />
|
||||
<Compile Include="FileSystems\AppData\AzureAppDataFolder.cs" />
|
||||
<Compile Include="Environment\Configuration\AzureShellSettingsManager.cs" />
|
||||
<Compile Include="FileSystems\Media\AzureBlobStorageProvider.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
|
Reference in New Issue
Block a user