示例#1
0
        public override void Deserialize(PackedStream_2 stream)
        {
            this.hasValue = true;
            this.Data     = new List <HeroVarId>();
            DeserializeList deserializeList = new DeserializeList(stream, 1);

            if (this.Type.Values == null)
            {
                this.Type.SetValuesType(deserializeList.listType);
            }
            for (uint index1 = 0U; index1 < deserializeList.Count; ++index1)
            {
                uint index2;
                bool b;
                int  variableId;
                deserializeList.GetFieldIndex(out index2, out b, out variableId);
                HeroAnyValue heroAnyValue = HeroAnyValue.Create(this.Type.Values);
                heroAnyValue.Deserialize(stream);
                this.Data.Add(new HeroVarId(variableId, heroAnyValue));
                if (variableId > this.nextId)
                {
                    this.nextId = variableId;
                }
            }
        }
示例#2
0
        public override void Deserialize(PackedStream2 stream)
        {
            hasValue = true;
            Data     = new List <HeroVarId>();
            var deserializeList = new DeserializeList(stream, 1);

            if (Type.Values == null)
            {
                Type.SetValuesType(deserializeList.ListType);
            }

            for (var index1 = 0U; index1 < deserializeList.Count; ++index1)
            {
                uint index2;
                bool b;
                int  variableId;
                deserializeList.GetFieldIndex(out index2, out b, out variableId);
                var heroAnyValue = Create(Type.Values);
                heroAnyValue.Deserialize(stream);
                Data.Add(new HeroVarId(variableId, heroAnyValue));

                if (variableId > NextId)
                {
                    NextId = variableId;
                }
            }
        }
示例#3
0
        public override void Deserialize(PackedStream_2 stream)
        {
            base.hasValue = true;
            this.Data     = new List <HeroVarId>();
            DeserializeList list = new DeserializeList(stream, 1);

            if (base.Type.Values == null)
            {
                base.Type.SetValuesType(list.listType);
            }
            for (uint i = 0; i < list.Count; i++)
            {
                uint num2;
                bool flag;
                int  num3;
                list.GetFieldIndex(out num2, out flag, out num3);
                HeroAnyValue value2 = HeroAnyValue.Create(base.Type.Values);
                value2.Deserialize(stream);
                this.Data.Add(new HeroVarId(num3, value2));
                if (num3 > this.nextId)
                {
                    this.nextId = num3;
                }
            }
        }
示例#4
0
        public static IDynamicMetaObjectProvider ParseDynamic(StringSegment value)
        {
            var index = VerifyAndGetStartIndex(value, typeof(ExpandoObject));

            var result = new ExpandoObject();

            if (JsonTypeSerializer.IsEmptyMap(value))
            {
                return(result);
            }

            var container = (IDictionary <string, object>)result;

            var tryToParsePrimitiveTypes = JsConfig.TryToParsePrimitiveTypeValues;

            var valueLength = value.Length;

            while (index < valueLength)
            {
                var keyValue = Serializer.EatMapKey(value, ref index);
                Serializer.EatMapKeySeperator(value, ref index);
                var elementValue = Serializer.EatValue(value, ref index);

                var mapKey = Serializer.UnescapeString(keyValue).Value;

                if (JsonUtils.IsJsObject(elementValue))
                {
                    container[mapKey] = ParseDynamic(elementValue);
                }
                else if (JsonUtils.IsJsArray(elementValue))
                {
                    container[mapKey] = DeserializeList <List <object>, TSerializer> .ParseStringSegment(elementValue);
                }
                else if (tryToParsePrimitiveTypes)
                {
                    container[mapKey] = DeserializeType <TSerializer> .ParsePrimitive(elementValue)
                                        ?? Serializer.UnescapeString(elementValue);
                }
                else
                {
                    container[mapKey] = Serializer.UnescapeString(elementValue);
                }

                Serializer.EatItemSeperatorOrMapEndChar(value, ref index);
            }

            return(result);
        }