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); }
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); }
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))); }