コード例 #1
0
        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();
            }
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        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));
            }
        }
コード例 #4
0
 public void Remove(Models.Repository item)
 {
     inner.Remove(item);
     MediaBlobHelper.DeleteRepositoryContainer(item);
 }
コード例 #5
0
 public void Initialize(Models.Repository repository)
 {
     inner.Initialize(repository);
     MediaBlobHelper.InitializeRepositoryContainer(repository);
 }