Ejemplo n.º 1
0
        public void Deserialize(IntermediateReader input, ContentSerializerAttribute format, object collection)
        {
            if (input == null)
            {
                throw new ArgumentNullException("input");
            }
            if (format == null)
            {
                throw new ArgumentNullException("format");
            }
            this.ValidateCollectionType(collection);
            IXmlListItemSerializer xmlListItemSerializer = this.contentSerializer as IXmlListItemSerializer;

            if (xmlListItemSerializer != null)
            {
                XmlListReader xmlListReader = new XmlListReader(input);
                while (!xmlListReader.AtEnd)
                {
                    this.addToCollection(collection, xmlListItemSerializer.Deserialize(xmlListReader));
                }
                return;
            }
            ContentSerializerAttribute contentSerializerAttribute = new ContentSerializerAttribute();

            contentSerializerAttribute.ElementName = format.CollectionItemName;
            while (input.MoveToElement(format.CollectionItemName))
            {
                this.addToCollection(collection, input.ReadObject <object>(contentSerializerAttribute, this.contentSerializer));
            }
        }
Ejemplo n.º 2
0
 protected internal override Matrix Deserialize(XmlListReader input)
 {
     if (input == null)
     {
         throw new ArgumentNullException("input");
     }
     return(new Matrix
     {
         M11 = MathTypeSerializer <Matrix> .ReadSingle(input),
         M12 = MathTypeSerializer <Matrix> .ReadSingle(input),
         M13 = MathTypeSerializer <Matrix> .ReadSingle(input),
         M14 = MathTypeSerializer <Matrix> .ReadSingle(input),
         M21 = MathTypeSerializer <Matrix> .ReadSingle(input),
         M22 = MathTypeSerializer <Matrix> .ReadSingle(input),
         M23 = MathTypeSerializer <Matrix> .ReadSingle(input),
         M24 = MathTypeSerializer <Matrix> .ReadSingle(input),
         M31 = MathTypeSerializer <Matrix> .ReadSingle(input),
         M32 = MathTypeSerializer <Matrix> .ReadSingle(input),
         M33 = MathTypeSerializer <Matrix> .ReadSingle(input),
         M34 = MathTypeSerializer <Matrix> .ReadSingle(input),
         M41 = MathTypeSerializer <Matrix> .ReadSingle(input),
         M42 = MathTypeSerializer <Matrix> .ReadSingle(input),
         M43 = MathTypeSerializer <Matrix> .ReadSingle(input),
         M44 = MathTypeSerializer <Matrix> .ReadSingle(input)
     });
 }
Ejemplo n.º 3
0
 protected internal override sbyte Deserialize(XmlListReader input)
 {
     if (input == null)
     {
         throw new ArgumentNullException("input");
     }
     return(XmlConvert.ToSByte(input.ReadString()));
 }
Ejemplo n.º 4
0
        protected internal override T Deserialize(XmlListReader input)
        {
            if (input == null)
            {
                throw new ArgumentNullException("input");
            }
            T result = default(T);

            result.PackedValue = uint.Parse(input.ReadString(), NumberStyles.HexNumber, CultureInfo.InvariantCulture);
            return(result);
        }
Ejemplo n.º 5
0
 protected internal override Vector2 Deserialize(XmlListReader input)
 {
     if (input == null)
     {
         throw new ArgumentNullException("input");
     }
     return(new Vector2
     {
         X = MathTypeSerializer <Vector2> .ReadSingle(input),
         Y = MathTypeSerializer <Vector2> .ReadSingle(input)
     });
 }
Ejemplo n.º 6
0
 protected internal override Point Deserialize(XmlListReader input)
 {
     if (input == null)
     {
         throw new ArgumentNullException("input");
     }
     return(new Point
     {
         X = XmlConvert.ToInt32(input.ReadString()),
         Y = XmlConvert.ToInt32(input.ReadString())
     });
 }
Ejemplo n.º 7
0
 protected internal override Quaternion Deserialize(XmlListReader input)
 {
     if (input == null)
     {
         throw new ArgumentNullException("input");
     }
     return(new Quaternion
     {
         X = MathTypeSerializer <Quaternion> .ReadSingle(input),
         Y = MathTypeSerializer <Quaternion> .ReadSingle(input),
         Z = MathTypeSerializer <Quaternion> .ReadSingle(input),
         W = MathTypeSerializer <Quaternion> .ReadSingle(input)
     });
 }
Ejemplo n.º 8
0
 protected internal override Rectangle Deserialize(XmlListReader input)
 {
     if (input == null)
     {
         throw new ArgumentNullException("input");
     }
     return(new Rectangle
     {
         X = XmlConvert.ToInt32(input.ReadString()),
         Y = XmlConvert.ToInt32(input.ReadString()),
         Width = XmlConvert.ToInt32(input.ReadString()),
         Height = XmlConvert.ToInt32(input.ReadString())
     });
 }
        protected internal override T Deserialize(IntermediateReader input, ContentSerializerAttribute format, T existingInstance)
        {
            if (input == null)
            {
                throw new ArgumentNullException("input");
            }
            XmlListReader xmlListReader = new XmlListReader(input);
            T             result        = this.Deserialize(xmlListReader);

            if (!xmlListReader.AtEnd)
            {
                throw input.CreateInvalidContentException(Resources.TooManyEntriesInXmlList, new object[0]);
            }
            return(result);
        }
Ejemplo n.º 10
0
        protected internal override Plane Deserialize(XmlListReader input)
        {
            if (input == null)
            {
                throw new ArgumentNullException("input");
            }
            Plane result = default(Plane);

            result.Normal.X = MathTypeSerializer <Plane> .ReadSingle(input);

            result.Normal.Y = MathTypeSerializer <Plane> .ReadSingle(input);

            result.Normal.Z = MathTypeSerializer <Plane> .ReadSingle(input);

            result.D = MathTypeSerializer <Plane> .ReadSingle(input);

            return(result);
        }
Ejemplo n.º 11
0
        protected internal override CurveKey Deserialize(XmlListReader input)
        {
            if (input == null)
            {
                throw new ArgumentNullException("input");
            }
            float position = MathTypeSerializer <CurveKey> .ReadSingle(input);

            float value = MathTypeSerializer <CurveKey> .ReadSingle(input);

            float tangentIn = MathTypeSerializer <CurveKey> .ReadSingle(input);

            float tangentOut = MathTypeSerializer <CurveKey> .ReadSingle(input);

            CurveContinuity continuity = (CurveContinuity)Enum.Parse(typeof(CurveContinuity), input.ReadString());

            return(new CurveKey(position, value, tangentIn, tangentOut, continuity));
        }
Ejemplo n.º 12
0
 protected internal override Color Deserialize(XmlListReader input)
 {
     return(ColorSerializer.SwapBgra(base.Deserialize(input)));
 }
 object IXmlListItemSerializer.Deserialize(XmlListReader list)
 {
     return(this.Deserialize(list));
 }
 protected internal abstract T Deserialize(XmlListReader input);
Ejemplo n.º 15
0
 protected static float ReadSingle(XmlListReader input)
 {
     return(XmlConvert.ToSingle(input.ReadString()));
 }