Пример #1
0
        public IEnumerable<MediaFolder> GetMediaFolders(string path) {
            var mediaFolders = new List<MediaFolder>();
            var folders = _storageProvider.ListFolders(path);

            foreach (var folder in folders) {
                var mediaFolder = new MediaFolder {
                    Name = folder.GetName(),
                    Size = folder.GetSize(),
                    LastUpdated = folder.GetLastUpdated(),
                    MediaPath = folder.GetPath(),
                };
                mediaFolders.Add(mediaFolder);
            }
            return mediaFolders;
        }
Пример #2
0
        private Models.ImageGallery CreateImageGalleryFromMediaFolder(MediaFolder mediaFolder)
        {
            var images = _mediaService.GetMediaFiles(mediaFolder.MediaPath);
            ImageGallerySettingsRecord imageGallerySettings = GetImageGallerySettings(GetName(mediaFolder.MediaPath)) ??
                                                              CreateImageGallerySettings(mediaFolder.MediaPath, ThumbnailDefaultSize,
                                                                                         ThumbnailDefaultSize, DefaultKeepAspectRatio);

            return new Models.ImageGallery
                   {
                       Id = imageGallerySettings.Id,
                       LastUpdated = mediaFolder.LastUpdated,
                       MediaPath = mediaFolder.MediaPath,
                       Name = mediaFolder.Name,
                       Size = mediaFolder.Size,
                       User = mediaFolder.User,
                       ThumbnailHeight = imageGallerySettings.ThumbnailHeight,
                       ThumbnailWidth = imageGallerySettings.ThumbnailWidth,
                       Images = images.Select(image => CreateImageFromMediaFile(image, imageGallerySettings)).OrderBy(image => image.Position),
                       KeepAspectRatio = imageGallerySettings.KeepAspectRatio
                   };
        }