예제 #1
0
파일: ArcLIB.cs 프로젝트: y111303tut/GARbro
        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);
        }
예제 #2
0
파일: ArcLIBU.cs 프로젝트: zxc120/GARbro
 public override ArcFile TryOpen(ArcView file)
 {
     using (var reader = LibUReader.Create(file))
     {
         if (!reader.ReadIndex())
         {
             return(null);
         }
         return(new ArcFile(file, this, reader.Dir));
     }
 }
예제 #3
0
        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);
        }