예제 #1
0
 public static PackagePhysicalFileMetadata Build(string fullFilePath, PackageFileNameMetadata identity)
 {
     if (identity == null)
     {
         return(null);
     }
     try
     {
         using (var stream = new FileStream(fullFilePath, FileMode.Open, FileAccess.Read))
         {
             return(new PackagePhysicalFileMetadata(identity, fullFilePath, HashCalculator.Hash(stream), stream.Length));
         }
     }
     catch (IOException)
     {
         return(null);
     }
 }
예제 #2
0
 private IPackageExtractor FindByExtension(PackageFileNameMetadata packageFile)
 {
     return(Extractors.FirstOrDefault(p => p.Extensions.Any(ext => packageFile.Extension.Equals(ext, StringComparison.OrdinalIgnoreCase))));
 }
예제 #3
0
 public PackagePhysicalFileMetadata(PackageFileNameMetadata identity, string fullFilePath, string hash, long size) : base(identity.PackageId, identity.Version, identity.Extension)
 {
     FullFilePath = fullFilePath;
     Hash         = hash;
     Size         = size;
 }