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); } }
public int GetIndex(string path) => Files.FindIndex(f => WildcardPath.Match(f, path));