示例#1
0
        /// <summary>
        /// Deserializes byte array into an instance by loading data from the file provided.
        /// </summary>
        public void Deserialize(BinaryReader br)
        {
            this.UnlockType = br.ReadEnum <UnlockableType>();

            switch (this.UnlockType)
            {
            case UnlockableType.Upgrade:
                this.PartIndex    = br.ReadInt32();
                this.UpgradeLevel = br.ReadInt32();
                break;

            case UnlockableType.Track:
                this.TrackID     = br.ReadUInt16();
                this.IsInReverse = br.ReadEnum <eBoolean>();
                break;

            default:
                this.UnlockName = br.ReadNullTermUTF8();
                break;
            }
        }
示例#2
0
        /// <summary>
        /// Reads data using <see cref="BinaryReader"/> provided.
        /// </summary>
        /// <param name="br"><see cref="BinaryReader"/> to read data with.</param>
        public void Read(BinaryReader br)
        {
            this.UnlockType = br.ReadEnum <UnlockableType>();

            switch (this.UnlockType)
            {
            case UnlockableType.Upgrade:
                this.PartIndex    = br.ReadInt32();
                this.UpgradeLevel = br.ReadInt32();
                break;

            case UnlockableType.Track:
                this.TrackID     = (ushort)br.ReadInt32();
                this.IsInReverse = (eBoolean)br.ReadInt32();
                break;

            default:
                this.UnlockName         = br.ReadUInt32().BinString(LookupReturn.EMPTY);
                br.BaseStream.Position += 4;
                break;
            }
        }
示例#3
0
 /// <summary>
 /// Reads data using <see cref="BinaryReader"/> provided.
 /// </summary>
 /// <param name="br"><see cref="BinaryReader"/> to read data with.</param>
 public void Read(BinaryReader br)
 {
     this.TrackID            = br.ReadUInt16();
     this.InReverseDirection = (eBoolean)(br.ReadByte() % 2);
     this.NumberOfLaps       = br.ReadByte();
 }
示例#4
0
        /// <summary>
        /// Disassembles byte array into <see cref="CPStruct"/> using <see cref="BinaryReader"/>
        /// provided.
        /// </summary>
        /// <param name="br"><see cref="BinaryReader"/> to read with.</param>
        /// <param name="str_reader"><see cref="BinaryReader"/> to read strings with.</param>
        public override void Disassemble(BinaryReader br, BinaryReader str_reader)
        {
            const uint negative = 0xFFFFFFFF;

            this.Templated = br.ReadInt16() == 0 ? eBoolean.False : eBoolean.True;

            if (this.Templated == eBoolean.True)
            {
                // Read concatenator
                long position = br.ReadUInt16();

                if (position != 0xFFFF)
                {
                    str_reader.BaseStream.Position = position << 2;
                    this.Concatenator       = str_reader.ReadNullTermUTF8();
                    this.ConcatenatorExists = eBoolean.True;
                }

                // Read geometry lod A, if valid
                position = br.ReadUInt32();

                if (position != negative)
                {
                    str_reader.BaseStream.Position = position << 2;
                    this.GeometryLodA       = str_reader.ReadNullTermUTF8();
                    this.GeometryLodAExists = eBoolean.True;
                }

                // Read geometry lod B, if valid
                position = br.ReadUInt32();

                if (position != negative)
                {
                    str_reader.BaseStream.Position = position << 2;
                    this.GeometryLodB       = str_reader.ReadNullTermUTF8();
                    this.GeometryLodBExists = eBoolean.True;
                }

                // Read geometry lod C, if valid
                position = br.ReadUInt32();

                if (position != negative)
                {
                    str_reader.BaseStream.Position = position << 2;
                    this.GeometryLodC       = str_reader.ReadNullTermUTF8();
                    this.GeometryLodCExists = eBoolean.True;
                }

                // Read geometry lod D, if valid
                position = br.ReadUInt32();

                if (position != negative)
                {
                    str_reader.BaseStream.Position = position << 2;
                    this.GeometryLodD       = str_reader.ReadNullTermUTF8();
                    this.GeometryLodDExists = eBoolean.True;
                }

                // Read geometry lod E, if valid
                position = br.ReadUInt32();

                if (position != negative)
                {
                    str_reader.BaseStream.Position = position << 2;
                    this.GeometryLodE       = str_reader.ReadNullTermUTF8();
                    this.GeometryLodEExists = eBoolean.True;
                }
            }
            else
            {
                uint key = br.ReadUInt16();                 // skip concatenator

                // Read geometry lod A, if valid
                key = br.ReadUInt32();

                if (key != negative)
                {
                    this.GeometryLodA       = key.BinString(LookupReturn.EMPTY);
                    this.GeometryLodAExists = eBoolean.True;
                }

                // Read geometry lod B, if valid
                key = br.ReadUInt32();

                if (key != negative)
                {
                    this.GeometryLodB       = key.BinString(LookupReturn.EMPTY);
                    this.GeometryLodBExists = eBoolean.True;
                }

                // Read geometry lod C, if valid
                key = br.ReadUInt32();

                if (key != negative)
                {
                    this.GeometryLodC       = key.BinString(LookupReturn.EMPTY);
                    this.GeometryLodCExists = eBoolean.True;
                }

                // Read geometry lod D, if valid
                key = br.ReadUInt32();

                if (key != negative)
                {
                    this.GeometryLodD       = key.BinString(LookupReturn.EMPTY);
                    this.GeometryLodDExists = eBoolean.True;
                }

                // Read geometry lod E, if valid
                key = br.ReadUInt32();

                if (key != negative)
                {
                    this.GeometryLodE       = key.BinString(LookupReturn.EMPTY);
                    this.GeometryLodEExists = eBoolean.True;
                }
            }
        }
示例#5
0
 /// <summary>
 /// Reads data using <see cref="BinaryReader"/> provided.
 /// </summary>
 /// <param name="br"><see cref="BinaryReader"/> to read data with.</param>
 public void Read(BinaryReader br)
 {
     this.WT_REMOVE_REAR_SEATS         = br.ReadEnum <eBoolean>();
     this.WT_REMOVE_INTERIOR_PANELS    = br.ReadEnum <eBoolean>();
     this.WT_LIGHTWEIGHT_WINDOWS       = br.ReadEnum <eBoolean>();
     this.WT_LIGHTWEIGHT_SEATS         = br.ReadEnum <eBoolean>();
     this.WT_LIGHTWEIGHT_DOORS         = br.ReadEnum <eBoolean>();
     this.WT_FOAM_FILLED_INTERIOR      = br.ReadEnum <eBoolean>();
     this.TR_SHORT_THROW_SHIFT_KIT     = br.ReadEnum <eBoolean>();
     this.TR_LIGHT_FLYWHEEL            = br.ReadEnum <eBoolean>();
     this.TR_DIFFERENTIAL              = br.ReadEnum <eBoolean>();
     this.TR_LIMITED_SLIP_DIFFERENTIAL = br.ReadEnum <eBoolean>();
     this.TR_HIGH_PERFORMANCE_CLUTCH   = br.ReadEnum <eBoolean>();
     this.TR_6_SPEED_TRANSMISSION      = br.ReadEnum <eBoolean>();
     this.NO_DRY_SHOT_OF_NITROUS       = br.ReadEnum <eBoolean>();
     this.NO_WET_SHOT_OF_NITROUS       = br.ReadEnum <eBoolean>();
     this.NO_DIRECT_PORT_NITROUS_OXIDE = br.ReadEnum <eBoolean>();
     this.EN_MUFFLER = br.ReadEnum <eBoolean>();
     this.EN_COLD_AIR_INTAKE_SYSTEM         = br.ReadEnum <eBoolean>();
     this.EN_REPLACE_HEADERS                = br.ReadEnum <eBoolean>();
     this.EN_MILD_CAMSHAFT_AND_CAM_GEARS    = br.ReadEnum <eBoolean>();
     this.EN_CAT_BACK_EXHAUST_SYSTEM        = br.ReadEnum <eBoolean>();
     this.EN_HIGH_FLOW_INTAKE_MANIFOLD      = br.ReadEnum <eBoolean>();
     this.EN_LARGER_DIAMETER_DOWNPIPE       = br.ReadEnum <eBoolean>();
     this.EN_RACING_CAMSHAFT_AND_GEARS      = br.ReadEnum <eBoolean>();
     this.EN_PORT_AND_POLISH_HEADS          = br.ReadEnum <eBoolean>();
     this.EN_BLUEPRINT_THE_BLOCK            = br.ReadEnum <eBoolean>();
     this.EN_HIGH_FLOW_HEADERS              = br.ReadEnum <eBoolean>();
     this.TU_STAGE_1_TURBO_KIT              = br.ReadEnum <eBoolean>();
     this.TU_STAGE_2_TURBO_KIT              = br.ReadEnum <eBoolean>();
     this.TU_STAGE_3_TURBO_KIT              = br.ReadEnum <eBoolean>();
     this.SU_SPORT_SPRINGS_AND_SHOCKS       = br.ReadEnum <eBoolean>();
     this.SU_STRUT_TOWER_BAR                = br.ReadEnum <eBoolean>();
     this.SU_PERFORMANCE_SPRINGS_AND_SHOCKS = br.ReadEnum <eBoolean>();
     this.SU_FRONT_AND_REAR_SWAY_BARS       = br.ReadEnum <eBoolean>();
     this.PERF_UNUSED_1 = br.ReadEnum <eBoolean>();
     this.PERF_UNUSED_2 = br.ReadEnum <eBoolean>();
     this.SU_COIL_OVER_SUSPENSION_SYSTEM = br.ReadEnum <eBoolean>();
     this.SU_CAMBER_KIT = br.ReadEnum <eBoolean>();
     this.SU_LARGE_DIAMETER_SWAY_BARS         = br.ReadEnum <eBoolean>();
     this.BR_STREET_COMPOUND_BRAKE_PADS       = br.ReadEnum <eBoolean>();
     this.BR_STEEL_BRAIDED_BRAKE_LINES        = br.ReadEnum <eBoolean>();
     this.BR_CROSS_DRILLED_ROTORS             = br.ReadEnum <eBoolean>();
     this.BR_LARGE_DIAMETER_ROTORS            = br.ReadEnum <eBoolean>();
     this.BR_RACE_COMPOUND_BRAKE_PADS         = br.ReadEnum <eBoolean>();
     this.BR_CROSS_DRILLED_AND_SLOTTED_ROTORS = br.ReadEnum <eBoolean>();
     this.BR_6_PISTON_RACING_CALIPERS         = br.ReadEnum <eBoolean>();
     this.EC_REMOVE_SPEED_LIMITER             = br.ReadEnum <eBoolean>();
     this.EC_PERFORMANCE_CHIP        = br.ReadEnum <eBoolean>();
     this.EC_HIGH_FLOW_FUEL_PUMP     = br.ReadEnum <eBoolean>();
     this.EC_FUEL_PRESSURE_REGULATOR = br.ReadEnum <eBoolean>();
     this.EC_FUEL_RAIL                 = br.ReadEnum <eBoolean>();
     this.EC_FUEL_FILTER               = br.ReadEnum <eBoolean>();
     this.EC_ENGINE_MANAGEMENT_UNIT    = br.ReadEnum <eBoolean>();
     this.EC_FUEL_INJECTORS            = br.ReadEnum <eBoolean>();
     this.TI_STREET_PERFORMANCE_TIRES  = br.ReadEnum <eBoolean>();
     this.TI_PRO_PERFORMANCE_TIRES     = br.ReadEnum <eBoolean>();
     this.TI_EXTREME_PERFORMANCE_TIRES = br.ReadEnum <eBoolean>();
     this.AE_FRONT_BUMPER_L1           = br.ReadEnum <eBoolean>();
     this.AE_FRONT_BUMPER_L2           = br.ReadEnum <eBoolean>();
     this.AE_FRONT_BUMPER_L3           = br.ReadEnum <eBoolean>();
     this.AE_SIDESKIRTS_L1             = br.ReadEnum <eBoolean>();
     this.AE_SIDESKIRTS_L2             = br.ReadEnum <eBoolean>();
     this.AE_SIDESKIRTS_L3             = br.ReadEnum <eBoolean>();
     this.AE_REAR_BUMPER_L1            = br.ReadEnum <eBoolean>();
     this.AE_REAR_BUMPER_L2            = br.ReadEnum <eBoolean>();
     this.AE_REAR_BUMPER_L3            = br.ReadEnum <eBoolean>();
     this.AE_SPOILER_L1                = br.ReadEnum <eBoolean>();
     this.AE_SPOILER_L2                = br.ReadEnum <eBoolean>();
     this.AE_SPOILER_L3                = br.ReadEnum <eBoolean>();
 }