示例#1
0
        public TypeData(ushort typeID, IDynamicTypeSerializer serializer)
        {
            this.TypeID         = typeID;
            this.TypeSerializer = serializer;

            this.NeedsInstanceParameter = true;
        }
示例#2
0
		public TypeData(ushort typeID, IDynamicTypeSerializer serializer)
		{
			this.TypeID = typeID;
			this.TypeSerializer = serializer;

			this.NeedsInstanceParameter = true;
		}
        public TypeData(ushort typeId, IDynamicTypeSerializer serializer)
        {
            TypeId         = typeId;
            TypeSerializer = serializer;

            NeedsInstanceParameter = true;
        }
示例#4
0
        // Token: 0x060000CE RID: 206 RVA: 0x00006ABC File Offset: 0x00004CBC
        private Dictionary <Type, TypeData> GenerateTypeData(IEnumerable <Type> rootTypes)
        {
            Dictionary <Type, TypeData> dictionary = new Dictionary <Type, TypeData>();
            Stack <Type> stack = new Stack <Type>(PrimitivesSerializer.GetSupportedTypes().Concat(rootTypes));

            stack.Push(typeof(object));
            ushort num = 1;

            while (stack.Count > 0)
            {
                Type type = stack.Pop();
                if (!dictionary.ContainsKey(type) && !type.IsAbstract && !type.IsInterface)
                {
                    if (type.ContainsGenericParameters)
                    {
                        throw new NotSupportedException(string.Format("Type {0} contains generic parameters", type.FullName));
                    }
                    ITypeSerializer typeSerializer = this.m_userTypeSerializers.FirstOrDefault((ITypeSerializer h) => h.Handles(type));
                    if (typeSerializer == null)
                    {
                        typeSerializer = Serializer.s_typeSerializers.FirstOrDefault((ITypeSerializer h) => h.Handles(type));
                    }
                    if (typeSerializer == null)
                    {
                        throw new NotSupportedException(string.Format("No serializer for {0}", type.FullName));
                    }
                    foreach (Type item in typeSerializer.GetSubtypes(type))
                    {
                        stack.Push(item);
                    }
                    TypeData value;
                    if (typeSerializer is IStaticTypeSerializer)
                    {
                        IStaticTypeSerializer staticTypeSerializer = (IStaticTypeSerializer)typeSerializer;
                        MethodInfo            writer;
                        MethodInfo            reader;
                        staticTypeSerializer.GetStaticMethods(type, out writer, out reader);
                        ushort num2 = num;
                        num   = num2 + 1;
                        value = new TypeData(num2, writer, reader);
                    }
                    else
                    {
                        if (!(typeSerializer is IDynamicTypeSerializer))
                        {
                            throw new Exception();
                        }
                        IDynamicTypeSerializer serializer = (IDynamicTypeSerializer)typeSerializer;
                        ushort num3 = num;
                        num   = num3 + 1;
                        value = new TypeData(num3, serializer);
                    }
                    dictionary[type] = value;
                }
            }
            return(dictionary);
        }
示例#5
0
 public TypeData(ushort typeID, IDynamicTypeSerializer serializer)
 {
     this.TypeID = typeID;
     this.TypeSerializer = serializer;
 }
示例#6
0
 public TypeData(ushort typeID, IDynamicTypeSerializer serializer)
 {
     this.TypeID         = typeID;
     this.TypeSerializer = serializer;
 }