private static void SaveList(Repository repository, Dictionary <string, MediaFolder> folders) { if (folders != null && folders.Count > 0) { var xml = DataContractSerializationHelper.SerializeAsXml(folders); var container = MediaBlobHelper.InitializeRepositoryContainer(repository); var blobClient = CloudStorageAccountHelper.GetStorageAccount().CreateCloudBlobClient(); var folderBlob = container.GetBlobReference(MediaBlobHelper.MediaDirectoryName); folderBlob.SetMediaFolderContentType(); BlobRequestOptions header = new BlobRequestOptions(); folderBlob.UploadText(xml); } else { var container = MediaBlobHelper.InitializeRepositoryContainer(repository); var blobClient = CloudStorageAccountHelper.GetStorageAccount().CreateCloudBlobClient(); var folderBlob = container.GetBlobReference(MediaBlobHelper.MediaDirectoryName); folderBlob.DeleteIfExists(); } }
public static Dictionary <string, MediaFolder> GetList(Repository repository) { var container = MediaBlobHelper.InitializeRepositoryContainer(repository); var blobClient = CloudStorageAccountHelper.GetStorageAccount().CreateCloudBlobClient(); var folderBlob = container.GetBlobReference(MediaBlobHelper.MediaDirectoryName); Dictionary <string, MediaFolder> folders = null; try { folderBlob.FetchAttributes(); if (folderBlob.CheckIfMediaFolder()) { var xml = folderBlob.DownloadText(); folders = DataContractSerializationHelper.DeserializeFromXml <Dictionary <string, MediaFolder> >(xml); } } catch { } if (folders == null) { folders = new Dictionary <string, MediaFolder>(); } return(new Dictionary <string, MediaFolder>(folders, StringComparer.OrdinalIgnoreCase)); }
public void InitializeMediaContents(Repository repository) { MediaBlobHelper.InitializeRepositoryContainer(repository); Kooboo.CMS.Content.Persistence.Default.MediaFolderProvider fileMediaFolderProvider = new Default.MediaFolderProvider(); foreach (var item in fileMediaFolderProvider.All(repository)) { ImportMediaFolderDataCascading(fileMediaFolderProvider.Get(item)); } }
public void Remove(Models.Repository item) { inner.Remove(item); MediaBlobHelper.DeleteRepositoryContainer(item); }
public void Initialize(Models.Repository repository) { inner.Initialize(repository); MediaBlobHelper.InitializeRepositoryContainer(repository); }