Esempio n. 1
0
        public async Task SaveAsync(Entry entry, Image image, Stream content, ImageType type)
        {
            ImagePath path     = GetPath(entry, image);
            string    filePath = path.Get(type);

            using (FileStream target = File.Create(filePath))
                await content.CopyToAsync(target);
        }
Esempio n. 2
0
        public Task DeleteAsync(Entry entry, Image image, ImageType type)
        {
            ImagePath path     = GetPath(entry, image);
            string    filePath = path.Get(type);

            File.Delete(filePath);
            return(Task.CompletedTask);
        }
Esempio n. 3
0
        public Task <Stream> FindAsync(Entry entry, Image image, ImageType type)
        {
            ImagePath path     = GetPath(entry, image);
            string    filePath = path.Get(type);

            if (!File.Exists(filePath))
            {
                return(Task.FromResult <Stream>(null));
            }

            return(Task.FromResult <Stream>(new FileStream(filePath, FileMode.Open, FileAccess.Read)));
        }