Пример #1
0
        internal void HandleSubrecord(
            MainRecord rec, PluginFileSource source, ref int defIndex
            )
        {
            var subrecord = source.currentSubrecord;
            var def       = GetMemberDef(subrecord.signature, ref defIndex);

            if (def == null)
            {
                rec._unexpectedSubrecords.Add(subrecord);
                source.SubrecordHandled();
            }
            else if (def.IsSubrecord())
            {
                def.ReadElement(rec, source, subrecord.dataSize);
                source.SubrecordHandled();
                defIndex++;
            }
            else
            {
                var container = (Container)def.PrepareElement(rec);
                def.SubrecordFound(container, source);
                defIndex++;
            }
        }
Пример #2
0
        public override void SubrecordFound(
            Container container, PluginFileSource source
            )
        {
            int defIndex  = 0;
            var subrecord = source.currentSubrecord;
            var memberDef = GetMemberDef(subrecord.signature, ref defIndex);

            if (memberDef == null)
            {
                return;
            }
            if (memberDef.IsSubrecord())
            {
                memberDef.ReadElement(container, source, subrecord.dataSize);
                source.SubrecordHandled();
            }
            else
            {
                memberDef.SubrecordFound(container, source);
            }
        }
Пример #3
0
        internal bool HandleSubrecord(
            Container container, PluginFileSource source, ref int defIndex
            )
        {
            var subrecord = source.currentSubrecord;
            var def       = GetMemberDef(subrecord.signature, ref defIndex);

            if (def == null)
            {
                return(false);
            }
            if (def.IsSubrecord())
            {
                def.ReadElement(container, source, subrecord.dataSize);
                source.SubrecordHandled();
            }
            else
            {
                var e = (Container)def.PrepareElement(container);
                def.SubrecordFound(e, source);
            }
            defIndex++;
            return(true);
        }