public void Parse(ChunkData data)
        {
            int numObjects1 = EndianessSwitchableBitConverter.ToInt32(data[1].Data, 0);

            // Missions
            short listOffset = 100;

            for (int i = 0; i < numObjects1; i++)
            {
                SavedMissionInfo o = new SavedMissionInfo();
                o.Parse(data, ref listOffset);
                _objects.Add(o);
            }

            // Challenges...
            listOffset = 2402;
            int numChallenges = EndianessSwitchableBitConverter.ToInt32(data[listOffset++].Data, 0);

            for (int i = 0; i < numChallenges; i++)
            {
                SavedChallengeInfo o = new SavedChallengeInfo();
                o.Parse(data, ref listOffset);
                _challenges.Add(o);
            }
            // end
        }
Example #2
0
 public void Parse(ChunkData data, ref short listOffset)
 {
     Index             = EndianessSwitchableBitConverter.ToUInt32(data[listOffset++].Data, 0);
     Count             = EndianessSwitchableBitConverter.ToInt32(data[listOffset++].Data, 0);
     HasBeenDiscovered = data[listOffset++].Data[0];
     Unknown4          = data[listOffset++].Data[0];
 }
Example #3
0
            public void Parse(ChunkData data, ref int listOffset)
            {
                ObjectReference obj = new ObjectReference();

                obj.Parse(data.DataEntries[listOffset++].Data);
                Object = obj;

                Unknown1 = data.DataEntries[listOffset++].Data[0];
                Unknown2 = EndianessSwitchableBitConverter.ToInt32(data.DataEntries[listOffset++].Data, 0);
            }
        public void Parse(ChunkData data)
        {
            short listOffset = 0;
            int   count      = EndianessSwitchableBitConverter.ToInt32(data[listOffset++].Data, 0);

            _objects.Clear();
            for (int i = 0; i < count; i++)
            {
                SavedObject1 o = new SavedObject1();
                o.Parse(data, ref listOffset);
                _objects.Add(o);
            }
        }
Example #5
0
        public void Parse(ChunkData data)
        {
            int savedCount1 = EndianessSwitchableBitConverter.ToInt32(data.DataEntries[0].Data, 0);
            int savedCount2 = EndianessSwitchableBitConverter.ToInt32(data.DataEntries[1].Data, 0);
            int savedCount3 = EndianessSwitchableBitConverter.ToInt32(data.DataEntries[2].Data, 0);
            int savedCount4 = EndianessSwitchableBitConverter.ToInt32(data.DataEntries[3].Data, 0);

            int expectedEntryCount = 3 * savedCount1 + 5 * savedCount2 + 5 * savedCount3 + 3 * savedCount4 + 4;

            /*
             * if (data.DataEntries.Count != expectedEntryCount)
             * {
             *  Debugger.Break();
             * }
             */

            _objects1.Clear();
            _objects2.Clear();
            _objects3.Clear();
            _objects4.Clear();

            int listOffset = 4;

            for (int i = 0; i < savedCount1; i++)
            {
                SavedObject1 o = new SavedObject1();
                o.Parse(data, ref listOffset);
                _objects1.Add(o);
            }

            for (int i = 0; i < savedCount2; i++)
            {
                SavedObject2 o = new SavedObject2();
                o.Parse(data, ref listOffset);
                _objects2.Add(o);
            }

            for (int i = 0; i < savedCount3; i++)
            {
                SavedObject3 o = new SavedObject3();
                o.Parse(data, ref listOffset);
                _objects3.Add(o);
            }

            for (int i = 0; i < savedCount4; i++)
            {
                SavedObject4 o = new SavedObject4();
                o.Parse(data, ref listOffset);
                _objects4.Add(o);
            }
        }
        public void Parse(ChunkData data)
        {
            int count = EndianessSwitchableBitConverter.ToInt32(data[0].Data, 0);

            _objects.Clear();
            for (int i = 0; i < count; i++)
            {
                SavedObject1 so = new SavedObject1();
                so.Parse(data[1].Data, i * 8);
                _objects.Add(so);
            }

            count = EndianessSwitchableBitConverter.ToInt32(data[2].Data, 0);
            _objects2.Clear();
            for (int i = 0; i < count; i++)
            {
                SavedObject1 so = new SavedObject1();
                so.Parse(data[3].Data, i * 8);
                _objects2.Add(so);
            }

            count = EndianessSwitchableBitConverter.ToInt32(data[4].Data, 0);
            _objects3.Clear();
            for (int i = 0; i < count; i++)
            {
                SavedObject1 so = new SavedObject1();
                so.Parse(data[5].Data, i * 8);
                _objects3.Add(so);
            }

            count = EndianessSwitchableBitConverter.ToInt32(data[6].Data, 0);
            _vehicles.Clear();
            for (int i = 0; i < count; i++)
            {
                PdaDbEntryVehicle so = new PdaDbEntryVehicle();
                so.Parse(data[7].Data, i * 4);
                _vehicles.Add(so);
            }

            count = EndianessSwitchableBitConverter.ToInt32(data[8].Data, 0);
            _objects5.Clear();
            for (int i = 0; i < count; i++)
            {
                SavedObject1 so = new SavedObject1();
                so.Parse(data[9].Data, i * 8);
                _objects5.Add(so);
            }
        }
            public void Parse(ChunkData data, ref short listOffset)
            {
                Hash  = EndianessSwitchableBitConverter.ToUInt32(data[listOffset++].Data, 0);
                Flags = (MissionFlag)data[listOffset++].Data[0];
                int count = EndianessSwitchableBitConverter.ToInt32(data[listOffset++].Data, 0);

                if (count > 0)
                {
                    for (int i = 0; i < count; i++)
                    {
                        SavedMissionObjectiveInfo o = new SavedMissionObjectiveInfo();
                        o.Parse(data, ref listOffset);
                        _missionObjectives.Add(o);
                    }
                }
            }
Example #8
0
        public void Parse(ChunkData data)
        {
            Capacity  = EndianessSwitchableBitConverter.ToInt32(data[0].Data, 0);
            UsedCount = EndianessSwitchableBitConverter.ToInt32(data[1].Data, 0);

            _objects.Clear();
            for (int i = 0; i < Capacity * 8; i += 8)
            {
                ObjectReference obj = new ObjectReference();
                obj.Parse(data[9].Data, i);
                _objects.Add(obj);
            }

            Bits        = new BitArray(data[10].Data);
            Bits.Length = Capacity;
        }
        public void Parse(ChunkData data)
        {
            if (data.DataEntries.Count < 7)
            {
                System.Diagnostics.Debugger.Break();
            }

            NumWeaponParts  = EndianessSwitchableBitConverter.ToInt32(data.DataEntries[0].Data, 0);
            NumArmorParts   = EndianessSwitchableBitConverter.ToInt32(data.DataEntries[1].Data, 0);
            NumVehicleParts = EndianessSwitchableBitConverter.ToInt32(data.DataEntries[2].Data, 0);
            Money           = EndianessSwitchableBitConverter.ToInt32(data.DataEntries[3].Data, 0);
            Chaos           = EndianessSwitchableBitConverter.ToInt32(data.DataEntries[4].Data, 0);
            short numWeapons  = EndianessSwitchableBitConverter.ToInt16(data.DataEntries[5].Data, 0);
            short numVehicles = EndianessSwitchableBitConverter.ToInt16(data.DataEntries[6].Data, 0);

            int expectedEntryCount = (numVehicles + numWeapons) * 4;

            if (expectedEntryCount != data.DataEntries.Count - 7)
            {
                System.Diagnostics.Debugger.Break();
            }

            weapons.Clear();
            int listOffset = 7;

            for (int i = 0; i < numWeapons; i++)
            {
                SavedObject1 so = new SavedObject1();
                so.Parse(data, ref listOffset);
                weapons.Add(so);
            }

            vehicles.Clear();
            for (int i = 0; i < numVehicles; i++)
            {
                SavedObject1 so = new SavedObject1();
                so.Parse(data, ref listOffset);
                vehicles.Add(so);
            }
        }
Example #10
0
        public void Parse(ChunkData data)
        {
            int savedCount1 = EndianessSwitchableBitConverter.ToInt32(data.DataEntries[0].Data, 0);

            int expectedEntryCount = savedCount1 + 1;

            /*
             * if (data.DataEntries.Count != expectedEntryCount)
             * {
             *  Debugger.Break();
             * }
             */

            _objects.Clear();
            int listOffset = 1;

            for (int i = 0; i < savedCount1; i++)
            {
                ObjectReference obj = new ObjectReference();
                obj.Parse(data.DataEntries[listOffset++].Data);
                _objects.Add(obj);
            }
        }
 public void Parse(ChunkData data)
 {
     Unknown1 = data[0].Data[0];
     Unknown2 = data[1].Data[0];
     Unknown3 = EndianessSwitchableBitConverter.ToInt32(data[2].Data, 0);
 }
Example #12
0
 public void Parse(ChunkData data)
 {
     MaxLevel = EndianessSwitchableBitConverter.ToInt32(data[0].Data, 0);
 }
Example #13
0
            public StatisticEntry(short index, string name, ChunkData data, ValueType type)
            {
                ChunkDataEntry ce = data[index];

                if (ce == null)
                {
                    throw new ArgumentOutOfRangeException("index");
                }

                Index = index;
                Name  = name;
                Type  = type;

                switch (type)
                {
                case ValueType.Bool:
                {
                    if (ce.Length != 1 + 6)
                    {
                        throw new Exception("not a Bool");
                    }
                    Value = data[index].Data[0] != 0;
                    break;
                }

                case ValueType.Float:
                {
                    if (ce.Length != 4 + 6)
                    {
                        throw new Exception("not a Float");
                    }
                    Value = EndianessSwitchableBitConverter.ToSingle(data[index].Data, 0);
                    break;
                }

                case ValueType.Int:
                {
                    if (ce.Length != 4 + 6)
                    {
                        throw new Exception("not an Int");
                    }
                    Value = EndianessSwitchableBitConverter.ToInt32(data[index].Data, 0);
                    break;
                }

                case ValueType.TimeSpan:
                {
                    if (ce.Length != 8 + 6)
                    {
                        throw new Exception("not a TimeSpan");
                    }
                    Value = TimeSpan.FromSeconds(EndianessSwitchableBitConverter.ToInt64(data[index].Data, 0));
                    break;
                }

                case ValueType.HashedStringList:
                {
                    try
                    {
                        int count = EndianessSwitchableBitConverter.ToInt32(data[index++].Data, 0);
                        List <HashedString> val = new List <HashedString>();
                        for (int i = 0; i < count; i++)
                        {
                            val.Add(new HashedString(data[index++].Data));
                        }
                        Value = val;
                    }
                    catch {
                        throw new Exception("not a list of hashed strings");
                    }
                    break;
                }

                default:
                {
                    throw new NotSupportedException("StatisticEntry: unsupported type");
                }
                }
            }