示例#1
0
 public IEnumerable <byte> GetFile(string path)
 {
     using (var reader = new BinaryReader(this, Encoding.UTF8, true))
     {
         var indexEntry = Index.First(e => WildcardPath.Match(e.Path, path));
         if (indexEntry == null)
         {
             throw new FileNotFoundException(string.Format("File not found in archive - {0}", path));
         }
         Seek((long)indexEntry.Offset, SeekOrigin.Begin);
         var result = new byte[indexEntry.Length];
         Read(result, 0, (int)indexEntry.Length);
         return(result);
     }
 }
示例#2
0
 public int GetIndex(string path) => Files.FindIndex(f => WildcardPath.Match(f, path));