public void ReadFromXML(string file)
        {
            XElement            Root             = XElement.Load(file);
            MaterialsShotsTable TableInformation = ReflectionHelpers.ConvertToPropertyFromXML <MaterialsShotsTable>(Root);

            this.Items = TableInformation.Items;
        }
Пример #2
0
        public void ReadFromFile(BinaryReader reader)
        {
            // NB: Only suitable for M3 for now.
            AIWeaponPtr      = reader.ReadUInt32();
            AnimParticlesPtr = reader.ReadUInt32();
            AttackParamsPtr  = reader.ReadUInt32();

            long currentPosition = reader.BaseStream.Position + 4;

            XBinCoreUtils.GotoPtrWithOffset(reader);
            CarColours = new CarColoursTable();
            CarColours.ReadFromFile(reader);

            reader.BaseStream.Seek(currentPosition, SeekOrigin.Begin);
            currentPosition = reader.BaseStream.Position + 4;
            XBinCoreUtils.GotoPtrWithOffset(reader);
            CarWindowTints = new CarWindowTintTable();
            CarWindowTints.ReadFromFile(reader);

            reader.BaseStream.Seek(currentPosition, SeekOrigin.Begin);
            CarInteriorColorsTableMPPtr = reader.ReadUInt32();
            CarGearboxesTableMPPtr      = reader.ReadUInt32();

            currentPosition = reader.BaseStream.Position + 4;
            XBinCoreUtils.GotoPtrWithOffset(reader);
            CarMtrStuff = new CarMtrStuffTable();
            CarMtrStuff.ReadFromFile(reader);

            reader.BaseStream.Seek(currentPosition, SeekOrigin.Begin);
            currentPosition = reader.BaseStream.Position + 4;
            XBinCoreUtils.GotoPtrWithOffset(reader);
            CarSkidmarks = new CarSkidmarksTable();
            CarSkidmarks.ReadFromFile(reader);

            reader.BaseStream.Seek(currentPosition, SeekOrigin.Begin);
            currentPosition = reader.BaseStream.Position + 4;
            XBinCoreUtils.GotoPtrWithOffset(reader);
            CarTuningItems = new CarTuningItemTable();
            CarTuningItems.ReadFromFile(reader);

            reader.BaseStream.Seek(currentPosition, SeekOrigin.Begin);
            CarTuningModificatorsTableMPPtr = reader.ReadUInt32();
            CombinableCharactersTableMPPtr  = reader.ReadUInt32();
            CrashObjectTablePtr             = reader.ReadUInt32();
            CubeMapsTablePtr          = reader.ReadUInt32();
            DamageMultiplierTablePtr  = reader.ReadUInt32();
            FamilyAlbumExtrasTablePtr = reader.ReadUInt32();
            FamilyAlbumTablePtr       = reader.ReadUInt32();
            currentPosition           = reader.BaseStream.Position;

            reader.BaseStream.Seek(currentPosition, SeekOrigin.Begin);
            currentPosition = reader.BaseStream.Position + 4;
            XBinCoreUtils.GotoPtrWithOffset(reader);
            HealthSystem = new HealthSystemTable();
            HealthSystem.ReadFromFile(reader);

            reader.BaseStream.Seek(currentPosition, SeekOrigin.Begin);
            currentPosition = reader.BaseStream.Position + 4;
            XBinCoreUtils.GotoPtrWithOffset(reader);
            HumanWeaponImpacts = new HumanWeaponImpactTable();
            HumanWeaponImpacts.ReadFromFile(reader);

            reader.BaseStream.Seek(currentPosition, SeekOrigin.Begin);
            currentPosition = reader.BaseStream.Position + 4;
            XBinCoreUtils.GotoPtrWithOffset(reader);
            HumanDamageZones = new HumanDamageZonesTable();
            HumanDamageZones.ReadFromFile(reader);

            reader.BaseStream.Seek(currentPosition, SeekOrigin.Begin);
            currentPosition = reader.BaseStream.Position + 4;
            XBinCoreUtils.GotoPtrWithOffset(reader);
            HumanMaterials = new HumanMaterialsTable();
            HumanMaterials.ReadFromFile(reader);

            reader.BaseStream.Seek(currentPosition, SeekOrigin.Begin);
            currentPosition = reader.BaseStream.Position + 4;
            XBinCoreUtils.GotoPtrWithOffset(reader);
            MaterialPhysics = new MaterialsPhysicsTable();
            MaterialPhysics.ReadFromFile(reader);

            reader.BaseStream.Seek(currentPosition, SeekOrigin.Begin);
            currentPosition = reader.BaseStream.Position + 4;
            XBinCoreUtils.GotoPtrWithOffset(reader);
            MaterialShots = new MaterialsShotsTable();
            MaterialShots.ReadFromFile(reader);

            // TODO: Everything in this function was always "temporary".
            // Maybe check the other table container files, see if they
            // are good enough. Otherwise I need to create a new solution
        }