Beispiel #1
0
        void ReadEncrypted(byte key)
        {
            uint index_offset = 0;

            for (;;)
            {
                index_offset += 0x10;
                if (m_entry_buf.AsciiEqual(0, "ffffffffffffffff"))
                {
                    break;
                }
                var name   = m_enc.GetString(m_entry_buf, 0, 8);
                var offset = m_enc.GetString(m_entry_buf, 8, 8);
                var entry  = new Entry {
                    Name = name, Offset = Convert.ToUInt32(offset, 16)
                };
                m_dir.Add(entry);
                if (0x10 != m_file.View.Read(index_offset, m_entry_buf, 0, 0x10))
                {
                    throw new InvalidFormatException();
                }
                key = OdnOpener.Decrypt(m_entry_buf, 0x10, key);
            }
            foreach (var entry in m_dir)
            {
                entry.Offset += index_offset;
            }
        }
Beispiel #2
0
 public List <Entry> ReadIndex()
 {
     m_file.View.Read(0, m_entry_buf, 0, 0x1C);
     if (m_entry_buf.AsciiEqual(8, "00000000"))
     {
         ReadV1();
     }
     else if (IsAscii(m_entry_buf, 0x10))
     {
         var name = m_enc.GetString(m_entry_buf, 0, 4);
         if (m_entry_buf.AsciiEqual(0x10, name))
         {
             ReadV2(0x10);
         }
         else if (m_entry_buf.AsciiEqual(0x18, name))
         {
             ReadV2(0x18);
         }
     }
     else
     {
         var key = OdnOpener.Decrypt(m_entry_buf, 0x10, 0xFF);
         if (m_entry_buf.AsciiEqual(8, "00000000"))
         {
             ReadEncrypted(key);
         }
     }
     if (0 == m_dir.Count)
     {
         return(null);
     }
     FixupDir();
     return(m_dir);
 }