private static Func <string, BlobDeployment> DeployTo(BlobFactoryContext context) { return(destination => { ZipFile.ExtractToDirectory(context.Path, destination); List <BlobFile> files = new List <BlobFile>(); foreach (string path in Directory.GetFiles(destination)) { files.Add(new BlobFile { Path = path, Name = Path.GetFileName(path) }); } return new BlobDeployment { Path = destination, Files = new BlobFileCollection { Items = files.ToArray() }, Find = Find(files) }; }); }
private static Func <long> GetSize(BlobFactoryContext context) { return(() => { return new FileInfo(context.Path).Length; }); }
private static Func <string> GetHash(BlobFactoryContext context) { return(() => { return Path.GetFileName(context.Path).Split('-')[1]; }); }
private static Func<string, BlobDeployment> DeployTo(BlobFactoryContext context) { return destination => { ZipFile.ExtractToDirectory(context.Path, destination); List<BlobFile> files = new List<BlobFile>(); foreach (string path in Directory.GetFiles(destination)) { files.Add(new BlobFile { Path = path, Name = Path.GetFileName(path) }); } return new BlobDeployment { Path = destination, Files = new BlobFileCollection { Items = files.ToArray() }, Find = Find(files) }; }; }
private static Func <BlobFileCollection> GetFiles(BlobFactoryContext context) { return(() => { List <BlobFile> files = new List <BlobFile>(); using (ZipArchive archive = ZipFile.OpenRead(context.Path)) { foreach (ZipArchiveEntry entry in archive.Entries) { files.Add(new BlobFile { Name = entry.Name, Path = entry.FullName }); } } return new BlobFileCollection { Items = files.ToArray() }; }); }
private static Func<BlobFileCollection> GetFiles(BlobFactoryContext context) { return () => { List<BlobFile> files = new List<BlobFile>(); using (ZipArchive archive = ZipFile.OpenRead(context.Path)) { foreach (ZipArchiveEntry entry in archive.Entries) { files.Add(new BlobFile { Name = entry.Name, Path = entry.FullName }); } } return new BlobFileCollection { Items = files.ToArray() }; }; }
private static Func<long> GetSize(BlobFactoryContext context) { return () => { return new FileInfo(context.Path).Length; }; }
private static Func<string> GetHash(BlobFactoryContext context) { return () => { return Path.GetFileName(context.Path).Split('-')[1]; }; }