Exemplo n.º 1
0
        public List <Entry> Read()
        {
            long data_size    = m_file.View.ReadInt64(0x10);
            long index_offset = m_file.View.ReadInt64(0x28);

            if (data_size >= m_file.MaxOffset || index_offset >= m_file.MaxOffset)
            {
                return(null);
            }
            uint index_size = m_file.View.ReadUInt32(0x30);
            uint flags      = m_file.View.ReadUInt32(0x38);
            var  key        = m_file.View.ReadBytes(0x58, 8);

            m_base_offset = m_file.MaxOffset - data_size;
            foreach (var scheme in KnownSchemes)
            {
                m_dir.Clear();
                try
                {
                    using (var stream = m_file.CreateStream(m_base_offset + index_offset, index_size))
                        using (var index = scheme.TransformStream(stream, key, flags))
                        {
                            if (ReadIndex(index))
                            {
                                this.Scheme = scheme;
                                return(m_dir);
                            }
                        }
                }
                catch { /* invalid scheme, retry */ }
            }
            return(null);
        }
Exemplo n.º 2
0
 public PcfArchive(ArcView arc, ArchiveFormat impl, ICollection <Entry> dir, PrimelScheme scheme)
     : base(arc, impl, dir)
 {
     Scheme = scheme;
 }