From c4bc2a1375a73a8ae57c0a7386a3f49aa4bfbc1a Mon Sep 17 00:00:00 2001 From: Renaud Paquay Date: Wed, 16 Jun 2010 15:44:53 -0700 Subject: [PATCH] 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 --- src/Orchard.Azure/AzureFileSystem.cs | 3 +- .../AzureShellSettingsManager.cs | 5 +- .../FileSystems/AppData/AzureAppDataFolder.cs | 70 ------------------- src/Orchard.Azure/Orchard.Azure.csproj | 1 - 4 files changed, 3 insertions(+), 76 deletions(-) delete mode 100644 src/Orchard.Azure/FileSystems/AppData/AzureAppDataFolder.cs diff --git a/src/Orchard.Azure/AzureFileSystem.cs b/src/Orchard.Azure/AzureFileSystem.cs index e34a00535..6de706353 100644 --- a/src/Orchard.Azure/AzureFileSystem.cs +++ b/src/Orchard.Azure/AzureFileSystem.cs @@ -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 { diff --git a/src/Orchard.Azure/Environment/Configuration/AzureShellSettingsManager.cs b/src/Orchard.Azure/Environment/Configuration/AzureShellSettingsManager.cs index dfdef5d78..65a7a7240 100644 --- a/src/Orchard.Azure/Environment/Configuration/AzureShellSettingsManager.cs +++ b/src/Orchard.Azure/Environment/Configuration/AzureShellSettingsManager.cs @@ -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 { diff --git a/src/Orchard.Azure/FileSystems/AppData/AzureAppDataFolder.cs b/src/Orchard.Azure/FileSystems/AppData/AzureAppDataFolder.cs deleted file mode 100644 index d233b68d6..000000000 --- a/src/Orchard.Azure/FileSystems/AppData/AzureAppDataFolder.cs +++ /dev/null @@ -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 ListFiles(string path) { - return _fs.ListFiles(path).Select(sf => sf.GetPath()); - } - - public IEnumerable 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(); - } - } -} \ No newline at end of file diff --git a/src/Orchard.Azure/Orchard.Azure.csproj b/src/Orchard.Azure/Orchard.Azure.csproj index 3ec4ece08..00771440f 100644 --- a/src/Orchard.Azure/Orchard.Azure.csproj +++ b/src/Orchard.Azure/Orchard.Azure.csproj @@ -76,7 +76,6 @@ -