Esempio n. 1
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 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);
            }
        }