public override ArcFile TryOpen(ArcView file) { int count = file.View.ReadInt32(0x28); if (!IsSaneCount(count)) { return(null); } var reader = new PacReader(file, count); var dir = reader.ReadIndex(); if (null == dir) { return(null); } if (reader.Encrypted) { return(new EmicArchive(file, this, dir, reader.Key)); } else { return(new ArcFile(file, this, dir)); } }
public override Stream OpenEntry(ArcFile arc, Entry entry) { var emic = arc as EmicArchive; if (null == emic) { return(arc.File.CreateStream(entry.Offset, entry.Size)); } var reader = new PacReader(emic.File, emic.Key); var data = new byte[entry.Size]; reader.Read(entry.Offset, data, 0, data.Length); return(new MemoryStream(data)); }