public override ArcFile TryOpen(ArcView file) { if (file.MaxOffset <= 0x10) { return(null); } var header = new byte[0x10]; foreach (var scheme in KnownSchemes.Values) { var decryptor = scheme.CreateDecryptor(); ReadEncrypted(file.View, decryptor, 0, header, 0, 0x10); ILibIndexReader reader; if (Binary.AsciiEqual(header, 0, "LIBP")) { reader = new LibPReader(file, decryptor, header, scheme); } else if (Binary.AsciiEqual(header, 0, "LIBU")) { reader = LibUReader.Create(file, decryptor); } else { continue; } using (reader) { if (reader.ReadIndex()) { return(new MalieArchive(file, this, reader.Dir, decryptor)); } } } return(null); }
public override ArcFile TryOpen(ArcView file) { using (var reader = LibUReader.Create(file)) { if (!reader.ReadIndex()) { return(null); } return(new ArcFile(file, this, reader.Dir)); } }
public override ArcFile TryOpen(ArcView file) { if (file.MaxOffset <= 0x10) { return(null); } var header = new byte[0x10]; foreach (var key in KnownKeys.Values) { var encryption = new Camellia(key); ReadEncrypted(file.View, encryption, 0, header, 0, 0x10); LibIndexReader reader; if (Binary.AsciiEqual(header, 0, "LIBP")) { reader = new LibPReader(file, encryption, header); } else if (Binary.AsciiEqual(header, 0, "LIBU")) { reader = new LibUReader(file, encryption, header); } else { continue; } using (reader) { var dir = reader.ReadIndex(); if (dir != null) { return(new MalieArchive(file, this, dir, encryption)); } } } return(null); }