Ejemplo n.º 1
0
        public override void Read(BinaryReader file, uint size)
        {
            CVariable parsedvar = null;
            var       varsize   = file.ReadUInt32();
            var       buffer    = file.ReadBytes((int)varsize - 4);

            using (var ms = new MemoryStream(buffer))
                using (var br = new BinaryReader(ms))
                {
                    var nameId = br.ReadUInt16();
                    var typeId = br.ReadUInt16();

                    if (nameId == 0)
                    {
                        return;
                    }

                    var typename = cr2w.Names[typeId].Str;
                    var varname  = cr2w.Names[nameId].Str;

                    parsedvar = CR2WTypeManager.Create(typename, varname, cr2w, this);
                    parsedvar.IsSerialized = true;
                    parsedvar.Read(br, size);
                    this.SetREDName(varname);
                }

            Variant = parsedvar;
        }
Ejemplo n.º 2
0
        protected void Read(BinaryReader file, uint size, int elementcount)
        {
            for (int i = 0; i < elementcount; i++)
            {
                CVariable element = CR2WTypeManager.Create(Elementtype, i.ToString(), cr2w, this);

                // no actual way to find out the elementsize of an array element
                // bacause cdpr serialized classes have no fixed size
                // solution? not sure: pass 0 and disable checks?
                element.Read(file, (uint)0);
                if (element is T te)
                {
                    te.IsSerialized = true;
                    Elements.Add(te);
                }
            }
        }
Ejemplo n.º 3
0
        public override void Read(BinaryReader file, uint size)
        {
            var typepos = file.BaseStream.Position;

            var typeId   = file.ReadUInt16();
            var typename = cr2w.Names[typeId].Str;

            var varsize = file.ReadUInt32() - 4;

            if (varsize > 0)
            {
                Variant = CR2WTypeManager.Create(typename, nameof(Variant), cr2w, this);
                Variant.Read(file, varsize);
                Variant.IsSerialized = true;
            }
            else
            {
                // do nothing I guess?
            }
        }
Ejemplo n.º 4
0
 public gameDeviceResourceData(CR2WFile cr2w, CVariable parent, string name) : base(cr2w, parent, name)
 {
     CookedDeviceData = CR2WTypeManager.Create("array:gameCookedDeviceDataCompressed",
                                               nameof(CookedDeviceData), cr2w, this) as CArray <gameCookedDeviceDataCompressed>;
 }