예제 #1
0
        public override void Read(BinaryReader file, uint size)
        {
            //Read the 8 unknown bytes.
            Unknown1.Read(file, 4);
            Unknown2.Read(file, 4);

            Resources.Read(file, 0);
            Objects.Read(file, 0);

            // Read the data block.
            blocksize.Read(file, 0);

            for (int i = 0; i < Objects.elements.Count; i++)
            {
                CSectorDataObject curobj = (CSectorDataObject)Objects.GetEditableVariables()[i];

                ulong curoffset = curobj.offset.val;
                byte  type      = curobj.type.val;
                if (!(type == 0x1 || type == 0x2))
                {
                    //System.Diagnostics.Debugger.Break();
                    //throw new NotImplementedException();
                }

                ulong len;
                if (i < Objects.elements.Count - 1)
                {
                    CSectorDataObject nextobj    = (CSectorDataObject)Objects.GetEditableVariables()[i + 1];
                    ulong             nextoffset = nextobj.offset.val;
                    len = nextoffset - curoffset;
                }
                else
                {
                    len = (ulong)blocksize.val - curoffset;
                }
                var blockdata = new SBlockData(cr2w);
                blockdata.Read(file, (uint)len);
                BlockData.AddVariable(blockdata);
            }
        }
예제 #2
0
        public override void Read(BinaryReader file, uint size)
        {
            base.Read(file, size);

            blocksize.Read(file, 1);
            for (int i = 0; i < Objects.elements.Count; i++)
            {
                CSectorDataObject curobj = Objects[i];

                ulong curoffset = curobj.offset.val;
                byte  type      = curobj.type.val;
                if (!(type == 0x1 || type == 0x2))
                {
                    //System.Diagnostics.Debugger.Break();
                    //throw new NotImplementedException();
                }

                ulong len;
                if (i < Objects.elements.Count - 1)
                {
                    CSectorDataObject nextobj    = Objects[i + 1];
                    ulong             nextoffset = nextobj.offset.val;
                    len = nextoffset - curoffset;
                }
                else
                {
                    len = (ulong)blocksize.val - curoffset;
                }

                var blockdata = new SBlockData(cr2w, BlockData, "")
                {
                    packedObjectType = (Enums.BlockDataObjectType)curobj.type.val
                };
                blockdata.Read(file, (uint)len);
                BlockData.AddVariable(blockdata);
            }
        }