Exemplo n.º 1
0
 public byte[] GetFile(string path)
 {
     using (var reader = new BinaryReader(this, Encoding.UTF8, true))
     {
         var indexEntry = Index.Find(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);
     }
 }
Exemplo n.º 2
0
 public int GetIndex(string path)
 {
     return(Files.FindIndex(f => WildcardPath.Match(f, path)));
 }