/// <summary> /// Read entry via entry struct /// </summary> /// <param name="entry"></param> /// <returns></returns> public Memory <byte> ReadEntry(PAKEntry entry) { if (entry.Size == 0) { return(new Memory <byte>()); } EnsureCanRead(); var blob = new Memory <byte>(new byte[entry.Size]); BaseStream.Position = DataStart + entry.Offset; BaseStream.Read(blob.Span); if (entry.IsEncrypted) { Recode(blob.Span, entry.Key); } return(blob); }
/// <summary> /// Gets an entry from it's filepath. /// </summary> /// <param name="path"></param> /// <param name="entry"></param> /// <returns></returns> public bool TryGetEntry(string path, out PAKEntry entry) { entry = Entries.FirstOrDefault(x => x.Filename == path); return(entry.Filename == path); }