Exemple #1
0
        /*
         * public DIREntry GetEntryByID(EntryRef ID)
         * {
         *  if (m_EntryByID.ContainsKey(ID))
         *      return m_EntryByID[ID];
         *  else
         *      return null;
         * }*/
        public static void Read(DBPFFile package, byte[] file)
        {
            var gGroupID = Hash.GroupHash(Path.GetFileNameWithoutExtension(package.fname));
            var stream   = new MemoryStream(file);
            var reader   = IoBuffer.FromStream(stream, ByteOrder.LITTLE_ENDIAN);

            //var count = 0;
            while (stream.Position < file.Length)
            {
                var TypeID  = reader.ReadUInt32();
                var GroupID = reader.ReadUInt32();
                if (GroupID == 0xFFFFFFFF && package.fname != "")
                {
                    GroupID = gGroupID;
                }
                var  InstanceID  = reader.ReadUInt32();
                uint InstanceID2 = 0x00000000;
                if (package.IndexMinorVersion >= 2)
                {
                    InstanceID2 = reader.ReadUInt32();
                }
                var idEntry2 = Hash.TGIRHash(InstanceID, InstanceID2, TypeID, GroupID);
                package.GetEntryByFullID(idEntry2).uncompressedSize = reader.ReadUInt32();

                /*
                 * if (!m_EntryByFullID.ContainsKey(idEntry2))
                 *  m_EntryByFullID.Add(idEntry2, entry);
                 * entry.UncompressedFileSize = reader.ReadUInt32();
                 * count += 1;*/
            }
            reader.Dispose();
            stream.Dispose();
        }
Exemple #2
0
        public static void Read(DBPFFile package, byte[] file)
        {
            var gGroupID = package.groupID;
            var stream   = new MemoryStream(file);
            var reader   = IoBuffer.FromStream(stream, ByteOrder.LITTLE_ENDIAN);

            while (stream.Position < file.Length)
            {
                var TypeID  = reader.ReadUInt32();
                var GroupID = reader.ReadUInt32();
                if (GroupID == 0xFFFFFFFF && package.fname != "")
                {
                    GroupID = gGroupID;
                }
                var  InstanceID  = reader.ReadUInt32();
                uint InstanceID2 = 0x00000000;
                if (package.IndexMinorVersion >= 2)
                {
                    InstanceID2 = reader.ReadUInt32();
                }
                var idEntry2 = Hash.TGIRHash(InstanceID, InstanceID2, TypeID, GroupID);
                package.GetEntryByFullID(idEntry2).uncompressedSize = reader.ReadUInt32();
            }
            reader.Dispose();
            stream.Dispose();
        }