コード例 #1
0
ファイル: List.cs プロジェクト: exodus444/swtoremu2
        public override object ReadData(GomBinaryReader reader)
        {
            GomType itemType = GomTypeLoader.Load(reader, false);

            if ((ContainedType != null) && (itemType.TypeId == ContainedType.TypeId))
            {
                itemType = ContainedType;
            }

            int len  = (int)reader.ReadNumber();
            int len2 = (int)reader.ReadNumber();

            if (len != len2)
            {
                throw new InvalidOperationException("List length values aren't the same?!");
            }

            List <object> result = new List <object>(len);

            for (var i = 0; i < len; i++)
            {
                var idx = reader.ReadNumber();
                var val = itemType.ReadItem(reader);
                result.Add(val);
            }

            return(result);
        }
コード例 #2
0
ファイル: Map.cs プロジェクト: exodus444/swtoremu2
        public override object ReadData(GomBinaryReader reader)
        {
            GomType keyType = GomTypeLoader.Load(reader, false);

            if ((KeyType != null) && (keyType.TypeId == KeyType.TypeId))
            {
                keyType = KeyType;
            }

            GomType valType = GomTypeLoader.Load(reader, false);

            if ((ValueType != null) && (valType.TypeId == ValueType.TypeId))
            {
                valType = ValueType;
            }

            int len  = (int)reader.ReadNumber();
            int len2 = (int)reader.ReadNumber();

            if (len != len2)
            {
                throw new InvalidOperationException("Map length values aren't the same?!");
            }

            Dictionary <object, object> result = new Dictionary <object, object>(len);

            for (var i = 0; i < len; i++)
            {
                var key = keyType.ReadItem(reader);
                var val = valType.ReadItem(reader);
                result.Add(key, val);
            }

            return(result);
        }