예제 #1
0
        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)
                };
            });
        }
예제 #2
0
 private static Func <long> GetSize(BlobFactoryContext context)
 {
     return(() =>
     {
         return new FileInfo(context.Path).Length;
     });
 }
예제 #3
0
 private static Func <string> GetHash(BlobFactoryContext context)
 {
     return(() =>
     {
         return Path.GetFileName(context.Path).Split('-')[1];
     });
 }
예제 #4
0
        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)
                };
            };
        }
예제 #5
0
        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()
                };
            });
        }
예제 #6
0
        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()
                };
            };
        }
예제 #7
0
 private static Func<long> GetSize(BlobFactoryContext context)
 {
     return () =>
     {
         return new FileInfo(context.Path).Length;
     };
 }
예제 #8
0
 private static Func<string> GetHash(BlobFactoryContext context)
 {
     return () =>
     {
         return Path.GetFileName(context.Path).Split('-')[1];
     };
 }