Added a basic cache service to handle interations with the underlying cache implementation. Refactored some code to be more robust.

This commit is contained in:
Joseph Milazzo 2021-01-09 16:14:28 -06:00
parent 59a4921ba9
commit cd8a1d2892
8 changed files with 149 additions and 34 deletions

View file

@ -2,6 +2,7 @@
using System.IO;
using System.IO.Compression;
using System.Linq;
using API.Extensions;
using NetVips;
namespace API.IO
@ -21,7 +22,7 @@ namespace API.IO
if (!File.Exists(filepath) || !Parser.Parser.IsArchive(filepath)) return Array.Empty<byte>();
using ZipArchive archive = ZipFile.OpenRead(filepath);
if (archive.Entries.Count <= 0) return Array.Empty<byte>();
if (!archive.HasFiles()) return Array.Empty<byte>();
@ -48,7 +49,7 @@ namespace API.IO
}
}
return ExtractEntryToImage(entry);
return ExtractEntryToImage(entry);
}
private static byte[] ExtractEntryToImage(ZipArchiveEntry entry)