public override void Read(BinaryReader file, uint size)
        {
            base.Read(file, size);

            var startpos = file.BaseStream.Position;

            var bytecount = file.ReadUInt32();

            // read classes
            var count = file.ReadBit6();

            for (int i = 0; i < count; i++)
            {
                var ClassName = new CName(cr2w, null, "");
                ClassName.Read(file, 2);

                var parsedvar = CR2WTypeManager.Create(ClassName.Value, "", cr2w, Data);
                parsedvar.Read(file, size);


                Data.AddVariable(parsedvar);
            }


            //check
            var endpos    = file.BaseStream.Position;
            var bytesread = endpos - startpos;

            if (bytesread != bytecount)
            {
                throw new InvalidParsingException($"Error in parsing SAppearanceAttachment: Data Variable. Bytes read: {bytesread} out of {bytecount}.");
            }
        }
        public override void Write(BinaryWriter file)
        {
            base.Write(file);

            byte[] buffer;
            using (var ms = new MemoryStream())
                using (var bw = new BinaryWriter(ms))
                {
                    bw.WriteBit6(Data.elements.Count);
                    foreach (var cvar in Data.elements)
                    {
                        var ClassName = new CName(cr2w, null, "")
                        {
                            Value = cvar.REDType
                        };
                        ClassName.Write(bw);

                        cvar.Write(bw);
                    }
                    buffer = ms.ToArray();
                }

            file.Write(buffer.Length + 4);
            file.Write(buffer);
        }
Beispiel #3
0
 public IdHandle(CR2WFile cr2w) : base(cr2w)
 {
     handlename = new CName(cr2w)
     {
         Name = "handlename"
     };
     handle = new CHandle(cr2w)
     {
         Name = "handle"
     };
 }
Beispiel #4
0
        public override void Read(BinaryReader file, uint size)
        {
            var count = file.ReadByte();

            for (var i = 0; i < count; i++)
            {
                var var = new CName(cr2w);
                var.Read(file, 0);
                AddVariable(var);
            }
        }
Beispiel #5
0
            public List <CurvePiece> pieces; // MAX LIMIT 4

            public CurveInfo(CR2WFile cr2w) : base(cr2w)
            {
                someName = new CName(cr2w)
                {
                    Name = "someName", Type = "CName"
                };
                someByte = new CUInt8(cr2w)
                {
                    Name = "someByte", Type = "CUInt8"
                };
                pieces = new List <CurvePiece>();
            }
Beispiel #6
0
        public override void Read(BinaryReader file, uint size)
        {
            var pos   = file.BaseStream.Position;
            var count = file.ReadBit6();

            for (var i = 0; i < count; i++)
            {
                var var = new CName(cr2w, tags, i.ToString());
                var.Read(file, 0);
                AddVariable(var);
            }
        }
Beispiel #7
0
        }                                                                            // MAX LIMIT 4

        public CurveInfo(CR2WFile cr2w, CVariable parent, string name) : base(cr2w, parent, name)
        {
            someName = new CName(cr2w, this, nameof(someName))
            {
                IsSerialized = true
            };
            someByte = new CUInt8(cr2w, this, nameof(someByte))
            {
                IsSerialized = true
            };
            pieces = new CCompressedBuffer <CurvePiece>(cr2w, this, nameof(pieces))
            {
                IsSerialized = true
            };
        }
 public SEntityBufferType2(CR2WFile cr2w, CVariable parent, string name) : base(cr2w, parent, name)
 {
     componentName = new CName(cr2w, this, nameof(componentName))
     {
         IsSerialized = true
     };
     sizeofdata = new CUInt32(cr2w, this, nameof(sizeofdata))
     {
         IsSerialized = true
     };
     variables = new CBufferUInt32 <CVariantSizeTypeName>(cr2w, this, nameof(variables))
     {
         IsSerialized = true
     };
 }
Beispiel #9
0
 public CMaterialGraphParameter(CR2WFile cr2w)
     : base(cr2w)
 {
     unk1 = new CUInt8(cr2w)
     {
         Name = "Type", Type = "UInt8"
     };
     unk2 = new CUInt8(cr2w)
     {
         Name = "Offset?", Type = "UInt8"
     };
     name = new CName(cr2w)
     {
         Name = "Name", Type = "CName"
     };
 }
Beispiel #10
0
 public SDynamicDecalMaterialInfo(CR2WFile cr2w) : base(cr2w)
 {
     diffuseTexture = new CHandle(cr2w)
     {
         Name = "diffuseTexture", Type = "CHandle"
     };
     normalTexture = new CHandle(cr2w)
     {
         Name = "normalTexture", Type = "CHandle"
     };
     specularColor = new CColor(cr2w)
     {
         Name = "specularColor", Type = "Color"
     };
     specularScale = new CFloat(cr2w)
     {
         Name = "specularScale", Type = "Float"
     };
     specularBase = new CFloat(cr2w)
     {
         Name = "specularBase", Type = "Float"
     };
     specularity = new CFloat(cr2w)
     {
         Name = "specularity", Type = "Float"
     };
     additiveNormals = new CBool(cr2w)
     {
         Name = "additiveNormals", Type = "Bool"
     };
     diffuseRandomColor0 = new CColor(cr2w)
     {
         Name = "diffuseRandomColor0", Type = "Color"
     };
     diffuseRandomColor1 = new CColor(cr2w)
     {
         Name = "diffuseRandomColor1", Type = "Color"
     };
     subUVType = new CName(cr2w)
     {
         Name = "subUVType", Type = "CName"
     };
 }
Beispiel #11
0
 public CFXTrackItem(CR2WFile cr2w, CVariable parent, string name) : base(cr2w, parent, name)
 {
     buffername = new CName(cr2w, this, nameof(buffername))
     {
         IsSerialized = true
     };
     count = new CDynamicInt(cr2w, this, nameof(count))
     {
         IsSerialized = true
     };
     unk = new CUInt8(cr2w, this, nameof(unk))
     {
         IsSerialized = true
     };
     buffer = new CCompressedBuffer <CBufferUInt16 <CFloat> >(cr2w, this, nameof(buffer))
     {
         IsSerialized = true
     };
 }
Beispiel #12
0
 public CFXTrackItem(CR2WFile cr2w) :
     base(cr2w)
 {
     buffername = new CName(cr2w)
     {
         Name = "buffername"
     };
     count = new CDynamicInt(cr2w)
     {
         Name = "count"
     };
     unk = new CUInt8(cr2w)
     {
         Name = "unk"
     };
     buffer = new CCompressedBuffer <CBufferUInt16 <CFloat> >(cr2w, _ => new CBufferUInt16 <CFloat>(_, x => new CFloat(x)))
     {
         Name = "buffer"
     };
 }
Beispiel #13
0
 public CParticleSystem(CR2WFile cr2w) : base(cr2w)
 {
     lods = new CArray("array:0,0,SParticleSystemLODLevel", "SParticleSystemLODLevel", true, cr2w)
     {
         Name = "lods", Type = "CArray"
     };
     emitters = new CArray("array:0,0,ptr:CParticleEmitter", "CParticleEmitter", true, cr2w)
     {
         Name = "emitters", Type = "CArray"
     };
     autoHideDistance = new CFloat(cr2w)
     {
         Name = "autoHideDistance", Type = "CFloat"
     };
     autoHideRange = new CFloat(cr2w)
     {
         Name = "autoHideRange", Type = "CFloat"
     };
     previewBackgroundColor = new CColor(cr2w)
     {
         Name = "previewBackgroundColor", Type = "Color"
     };
     previewShowGrid = new CBool(cr2w)
     {
         Name = "previewShowGrid", Type = "CBool"
     };
     visibleThroughWalls = new CBool(cr2w)
     {
         Name = "visibleThroughWalls", Type = "CBool"
     };
     prewarmingTime = new CFloat(cr2w)
     {
         Name = "prewarmingTime", Type = "CFloat"
     };
     renderingPlane = new CName(cr2w)
     {
         Name = "renderingPlane", Type = "CName"
     };
 }
Beispiel #14
0
 public CDecalSpawner(CR2WFile cr2w) : base(cr2w)
 {
     material = new SDynamicDecalMaterialInfo(cr2w)
     {
         Name = "material", Type = "SDynamicDecalMaterialInfo"
     };
     farZ = new CFloat(cr2w)
     {
         Name = "farZ", Type = "CFloat"
     };
     nearZ = new CFloat(cr2w)
     {
         Name = "nearZ", Type = "CFloat"
     };
     ssize = new CPtr(cr2w)
     {
         Name = "size", Type = "IEvaluatorFloat"
     };
     depthFadePower = new CFloat(cr2w)
     {
         Name = "depthFadePower", Type = "CFloat"
     };
     normalFadeBias = new CFloat(cr2w)
     {
         Name = "normalFadeBias", Type = "CFloat"
     };
     normalFadeScale = new CFloat(cr2w)
     {
         Name = "normalFadeScale", Type = "CFloat"
     };
     doubleSided = new CBool(cr2w)
     {
         Name = "doubleSided", Type = "CBool"
     };
     projectionMode = new CName(cr2w)
     {
         Name = "projectionMode", Type = "CName"
     };
     decalLifetime = new CPtr(cr2w)
     {
         Name = "decalLifetime", Type = "IEvaluatorFloat"
     };
     decalFadeTime = new CFloat(cr2w)
     {
         Name = "decalFadeTime", Type = "CFloat"
     };
     decalFadeInTime = new CFloat(cr2w)
     {
         Name = "decalFadeInTime", Type = "CFloat"
     };
     projectOnlyOnStatic = new CBool(cr2w)
     {
         Name = "projectOnlyOnStatic", Type = "CBool"
     };
     startScale = new CFloat(cr2w)
     {
         Name = "startScale", Type = "CFloat"
     };
     scaleTime = new CFloat(cr2w)
     {
         Name = "scaleTime", Type = "CFloat"
     };
     useVerticalProjection = new CBool(cr2w)
     {
         Name = "useVerticalProjection", Type = "CBool"
     };
     spawnPriority = new CName(cr2w)
     {
         Name = "spawnPriority", Type = "CName"
     };
     autoHideDistance = new CFloat(cr2w)
     {
         Name = "autoHideDistance", Type = "CFloat"
     };
     spawnFrequency = new CFloat(cr2w)
     {
         Name = "spawnFrequency", Type = "CFloat"
     };
 }
Beispiel #15
0
 public IdHandle(CR2WFile cr2w, CVariable parent, string name) : base(cr2w, parent, name)
 {
     handlename = new CName(cr2w, this, "handlename");
     handle     = new CHandle <CBehaviorVariable>(cr2w, this, "handle");
 }