示例#1
0
        public override uint WriteStrings(VoidPtr address, uint initialOffset)
        {
            uint offset = initialOffset;

            foreach (TySealNode sticker in Children)
            {
                if ((sticker.Name == "<null>" || string.IsNullOrEmpty(sticker.Name)) &&
                    string.IsNullOrEmpty(sticker.BRRES) || sticker.Name.Equals(sticker.BRRES))
                {
                    uint lengthCalc = (uint)(sticker.BRRES.UTF8Length() + 1).Align(4);
                    address.WriteUTF8String(sticker.BRRES, true, offset, lengthCalc);
                    sticker.NameOffset  = offset - TyDataHeader.HeaderSize;
                    sticker.BrresOffset = offset - TyDataHeader.HeaderSize;
                    offset += lengthCalc + 4;
                }
                else
                {
                    uint lengthCalc = (uint)(sticker.Name.UTF8Length() + 1).Align(4);
                    address.WriteUTF8String(sticker.Name, true, offset, lengthCalc);
                    sticker.NameOffset = offset - TyDataHeader.HeaderSize;
                    offset            += lengthCalc;
                    lengthCalc         = (uint)(sticker.BRRES.UTF8Length() + 1).Align(4);
                    address.WriteUTF8String(sticker.BRRES, true, offset, lengthCalc);
                    sticker.BrresOffset = offset - TyDataHeader.HeaderSize;
                    offset += lengthCalc;
                }
            }

            return(offset);
        }
示例#2
0
        public override void OnRebuild(VoidPtr address, int length, bool force)
        {
            strOffset = 0;
            TLST *header = (TLST *)address;

            *header = new TLST();
            header->_tag        = TLST.Tag;
            header->_count      = (uint)Children.Count;
            header->_fileSize   = (ushort)length;
            header->_nameOffset = (ushort)(TLST.HeaderSize + Children.Count * TLSTEntry.Size);

            uint offset = TLST.HeaderSize;

            foreach (ResourceNode n in Children)
            {
                int size = n.CalculateSize(true);
                n.Rebuild(address + offset, size, true);
                offset += (uint)size;
            }

            foreach (TLSTEntryNode n in Children)
            {
                if (!string.IsNullOrEmpty(n.SongFileName))
                {
                    offset += address.WriteUTF8String(n.SongFileName, true, offset);
                }

                if (!string.IsNullOrEmpty(n._name) && n._name != "<null>")
                {
                    offset += address.WriteUTF8String(n._name, true, offset);
                }
            }
        }
示例#3
0
        public override void OnRebuild(VoidPtr address, int length, bool force)
        {
            ASLS *header = (ASLS *)address;

            *header = new ASLS();
            header->_tag        = ASLS.Tag;
            header->_count      = (ushort)Children.Count;
            header->_nameOffset = (ushort)(ASLS.HeaderSize + Children.Count * ASLSEntry.Size);

            uint offset    = ASLS.HeaderSize;
            int  strOffset = 0;

            foreach (ResourceNode n in Children)
            {
                int size = n.CalculateSize(true);
                ((ASLSEntryNode)n).StrOffset = (ushort)strOffset;
                n.Rebuild(address + offset, size, true);
                offset    += (uint)size;
                strOffset += n.Name.UTF8Length() + 1;
            }
            foreach (ResourceNode n in Children)
            {
                offset += address.WriteUTF8String(n.Name, true, offset);
            }
        }