Beispiel #1
0
        public int UpdateFileName()
        {
            if (m_FileName != null)
            {
                return(1);
            }

            m_FileName = HashDictionary.Get(m_FileHash);

            if (m_FileName != null)
            {
                return(1);
            }

            return(0);
        }
Beispiel #2
0
        public static MythicPackageIndex Read(BinaryReader reader, ref int found)
        {
            MythicPackageIndex index = new MythicPackageIndex();

            index.DataBlockOffset  = reader.ReadInt64();
            index.DataLength       = reader.ReadInt32();
            index.CompressedSize   = reader.ReadInt32();
            index.DecompressedSize = reader.ReadInt32();
            index.FileHash         = reader.ReadInt64();
            index.FileName         = HashDictionary.Get(index.FileHash);
            index.CRC = reader.ReadInt32();

            if (index.FileName != null)
            {
                found += 1;
            }

            short flag = reader.ReadInt16();

            switch (flag)
            {
            case 0x0: index.Compressed = false; break;

            case 0x1: index.Compressed = true; break;

            default: throw new Exception(String.Format("Invalid compressed flag: '{0}'!", flag));
            }

            if (index.DataBlockOffset != 0)
            {
                long position = reader.BaseStream.Position;
                reader.BaseStream.Seek(index.DataBlockOffset, SeekOrigin.Begin);
                index.DataBlock = MythicPackageData.Read(reader);
                reader.BaseStream.Seek(position, SeekOrigin.Begin);
            }

            return(index);
        }