Пример #1
0
        public override bool OnInitialize()
        {
            base.OnInitialize();

            _strings.Clear();

            byte *floor = (byte *)WorkingUncompressed.Address;
            int   length = WorkingUncompressed.Length;
            bint *offsets = (bint *)floor;
            int   index, last, current;

            for (index = 1, last = offsets[0]; last != length; index++)
            {
                current = offsets[index];
                if (current < last || current > length)
                {
                    break;
                }

                _strings.Add(MSBinDecoder.DecodeString(floor + last, current - last));

                last = current;
            }

            return(false);
        }
Пример #2
0
        public override int OnCalculateSize(bool force)
        {
            int len = (_strings.Count + 1) << 2;
            foreach (string s in _strings)
            {
                len += MSBinDecoder.GetStringSize(s);
            }

            return len;
        }
Пример #3
0
        public override void OnRebuild(VoidPtr address, int length, bool force)
        {
            bint* offsets = (bint*) address;
            byte* current = (byte*) (offsets + _strings.Count + 1);
            foreach (string s in _strings)
            {
                *offsets++ = (int) current - (int) address;
                current += MSBinDecoder.EncodeString(s, current);
            }

            *offsets = (int) current - (int) address;
        }