protected internal override void Serialize(IntermediateWriter output, DateTime value, ContentSerializerAttribute format) { if (output == null) { throw new ArgumentNullException("output"); } output.Xml.WriteString(XmlConvert.ToString(value, XmlDateTimeSerializationMode.RoundtripKind)); }
protected internal override void Serialize(IntermediateWriter output, Type value, ContentSerializerAttribute format) { if (output == null) { throw new ArgumentNullException("output"); } output.WriteTypeName(value); }
protected internal override void Serialize(IntermediateWriter output, T value, ContentSerializerAttribute format) { if (output == null) { throw new ArgumentNullException("output"); } output.Xml.WriteString(value.PackedValue.ToString("X8", CultureInfo.InvariantCulture)); }
protected internal override void Serialize(IntermediateWriter output, sbyte value, ContentSerializerAttribute format) { if (output == null) { throw new ArgumentNullException("output"); } output.Xml.WriteString(XmlConvert.ToString(value)); }
protected internal override void Serialize(IntermediateWriter output, BoundingFrustum value, ContentSerializerAttribute format) { if (output == null) { throw new ArgumentNullException("output"); } output.WriteObject <Matrix>(value.Matrix, BoundingFrustumSerializer.matrixFormat); }
protected internal override void Serialize(IntermediateWriter output, Vector2 value, ContentSerializerAttribute format) { if (output == null) { throw new ArgumentNullException("output"); } MathTypeSerializer <Vector2> .WritePart(output, value.X); MathTypeSerializer <Vector2> .WriteLast(output, value.Y); }
public void Serialize(IntermediateWriter output, ContentSerializerAttribute format, object collection) { if (output == null) { throw new ArgumentNullException("output"); } if (format == null) { throw new ArgumentNullException("format"); } this.ValidateCollectionType(collection); IEnumerable enumerable = (IEnumerable)collection; if (this.contentSerializer is IXmlListItemSerializer) { ContentSerializerAttribute contentSerializerAttribute = new ContentSerializerAttribute(); contentSerializerAttribute.FlattenContent = true; bool flag = true; IEnumerator enumerator = enumerable.GetEnumerator(); try { while (enumerator.MoveNext()) { object current = enumerator.Current; if (flag) { flag = false; } else { output.Xml.WriteWhitespace(" "); } output.WriteRawObject <object>(current, contentSerializerAttribute, this.contentSerializer); } return; } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) { disposable.Dispose(); } } } ContentSerializerAttribute contentSerializerAttribute2 = new ContentSerializerAttribute(); contentSerializerAttribute2.ElementName = format.CollectionItemName; foreach (object current2 in enumerable) { output.WriteObject <object>(current2, contentSerializerAttribute2, this.contentSerializer); } }
protected internal override void Serialize(IntermediateWriter output, Rectangle value, ContentSerializerAttribute format) { if (output == null) { throw new ArgumentNullException("output"); } output.Xml.WriteString(XmlConvert.ToString(value.X)); output.Xml.WriteWhitespace(" "); output.Xml.WriteString(XmlConvert.ToString(value.Y)); output.Xml.WriteWhitespace(" "); output.Xml.WriteString(XmlConvert.ToString(value.Width)); output.Xml.WriteWhitespace(" "); output.Xml.WriteString(XmlConvert.ToString(value.Height)); }
protected internal override void Serialize(IntermediateWriter output, object value, ContentSerializerAttribute format) { if (output == null) { throw new ArgumentNullException("output"); } if (format == null) { throw new ArgumentNullException("format"); } foreach (DictionaryEntry dictionaryEntry in this.CastType(value)) { output.Xml.WriteStartElement(format.CollectionItemName); output.WriteObject <object>(dictionaryEntry.Key, this.keyFormat); output.WriteObject <object>(dictionaryEntry.Value, this.valueFormat); output.Xml.WriteEndElement(); } }
protected internal override void Serialize(IntermediateWriter output, object value, ContentSerializerAttribute format) { if (output == null) { throw new ArgumentNullException("output"); } if (format == null) { throw new ArgumentNullException("format"); } ContentSerializerAttribute contentSerializerAttribute = new ContentSerializerAttribute(); contentSerializerAttribute.ElementName = format.CollectionItemName; foreach (object current in this.CastType(value)) { output.WriteObject <object>(current, contentSerializerAttribute); } }
protected internal override void Serialize(IntermediateWriter output, object value, ContentSerializerAttribute format) { if (output == null) { throw new ArgumentNullException("output"); } if (value == null) { throw new ArgumentNullException("value"); } if (!base.IsTargetType(value)) { throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, Resources.WrongArgumentType, new object[] { base.TargetType, value.GetType() })); } output.Xml.WriteString(value.ToString()); }
protected internal override void Serialize(IntermediateWriter output, CurveKey value, ContentSerializerAttribute format) { if (output == null) { throw new ArgumentNullException("output"); } if (value == null) { throw new ArgumentNullException("value"); } MathTypeSerializer <CurveKey> .WritePart(output, value.Position); MathTypeSerializer <CurveKey> .WritePart(output, value.Value); MathTypeSerializer <CurveKey> .WritePart(output, value.TangentIn); MathTypeSerializer <CurveKey> .WritePart(output, value.TangentOut); output.Xml.WriteString(value.Continuity.ToString()); }
protected internal override void Serialize(IntermediateWriter output, Dictionary <Key, Value> value, ContentSerializerAttribute format) { if (output == null) { throw new ArgumentNullException("output"); } if (format == null) { throw new ArgumentNullException("format"); } if (value == null) { throw new ArgumentNullException("value"); } foreach (KeyValuePair <Key, Value> current in value) { output.Xml.WriteStartElement(format.CollectionItemName); output.WriteObject <Key>(current.Key, this.keyFormat, this.keySerializer); output.WriteObject <Value>(current.Value, this.valueFormat, this.valueSerializer); output.Xml.WriteEndElement(); } }
protected internal override void Serialize(IntermediateWriter output, Matrix value, ContentSerializerAttribute format) { if (output == null) { throw new ArgumentNullException("output"); } MathTypeSerializer <Matrix> .WritePart(output, value.M11); MathTypeSerializer <Matrix> .WritePart(output, value.M12); MathTypeSerializer <Matrix> .WritePart(output, value.M13); MathTypeSerializer <Matrix> .WritePart(output, value.M14); MathTypeSerializer <Matrix> .WritePart(output, value.M21); MathTypeSerializer <Matrix> .WritePart(output, value.M22); MathTypeSerializer <Matrix> .WritePart(output, value.M23); MathTypeSerializer <Matrix> .WritePart(output, value.M24); MathTypeSerializer <Matrix> .WritePart(output, value.M31); MathTypeSerializer <Matrix> .WritePart(output, value.M32); MathTypeSerializer <Matrix> .WritePart(output, value.M33); MathTypeSerializer <Matrix> .WritePart(output, value.M34); MathTypeSerializer <Matrix> .WritePart(output, value.M41); MathTypeSerializer <Matrix> .WritePart(output, value.M42); MathTypeSerializer <Matrix> .WritePart(output, value.M43); MathTypeSerializer <Matrix> .WriteLast(output, value.M44); }
/// <summary>Serializes an object into an intermediate XML file.</summary> /// <param name="output">The output XML stream.</param> /// <param name="value">The object to be serialized.</param> /// <param name="referenceRelocationPath">Final name of the output file, used to relative encode external reference filenames.</param> public static void Serialize <T>(XmlWriter output, T value, string referenceRelocationPath) { if (output == null) { throw new ArgumentNullException("output"); } if (value == null) { throw new ArgumentNullException("value"); } Uri baseUri = IntermediateSerializer.RelocationPathToUri(referenceRelocationPath); IntermediateWriter intermediateWriter = new IntermediateWriter(IntermediateSerializer.SingletonInstance, output, baseUri); output.WriteStartElement("XnaContent"); new XmlNamespaces(intermediateWriter).WriteNamespaces(value); ContentSerializerAttribute contentSerializerAttribute = new ContentSerializerAttribute(); contentSerializerAttribute.ElementName = "Asset"; intermediateWriter.WriteObject <object>(value, contentSerializerAttribute); intermediateWriter.WriteSharedResources(); intermediateWriter.WriteExternalReferences(); output.WriteEndElement(); }
protected internal override void Serialize(IntermediateWriter output, object value, ContentSerializerAttribute format) { if (output == null) { throw new ArgumentNullException("output"); } if (format == null) { throw new ArgumentNullException("format"); } if (value == null) { throw new ArgumentNullException("value"); } if (!base.IsTargetType(value)) { throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, Resources.WrongArgumentType, new object[] { base.TargetType, value.GetType() })); } format = this.ApplyCustomFormatting(format); if (this.baseSerializer != null) { this.baseSerializer.Serialize(output, value, format); } foreach (ReflectiveSerializerMemberHelper current in this.memberHelpers) { current.Serialize(output, value); } if (this.collectionHelper != null) { this.collectionHelper.Serialize(output, format, value); } }
protected internal override void Serialize(IntermediateWriter output, T[] value, ContentSerializerAttribute format) { this.arrayHelper.Serialize(output, format, value); }
protected internal override void Serialize(IntermediateWriter output, List <T> value, ContentSerializerAttribute format) { this.collectionHelper.Serialize(output, format, value); }
protected static void WriteLast(IntermediateWriter output, float value) { output.Xml.WriteString(XmlConvert.ToString(value)); }
protected static void WritePart(IntermediateWriter output, float value) { output.Xml.WriteString(XmlConvert.ToString(value)); output.Xml.WriteWhitespace(" "); }
/// <summary>Serializes an object to intermediate XML format.</summary> /// <param name="output">Specifies the intermediate XML location, and provides various serialization helpers.</param> /// <param name="value">The object to be serialized.</param> /// <param name="format">Specifies the content format for this object.</param> protected internal override void Serialize(IntermediateWriter output, object value, ContentSerializerAttribute format) { this.Serialize(output, ContentTypeSerializer <T> .CastType(value), format); }
/// <summary>Serializes an object to intermediate XML format.</summary> /// <param name="output">Specifies the intermediate XML location, and provides various serialization helpers.</param> /// <param name="value">The strongly typed object to be serialized.</param> /// <param name="format">Specifies the content format for this object.</param> protected internal abstract void Serialize(IntermediateWriter output, T value, ContentSerializerAttribute format);
protected internal override void Serialize(IntermediateWriter output, Color value, ContentSerializerAttribute format) { base.Serialize(output, ColorSerializer.SwapBgra(value), format); }
protected internal override void Serialize(IntermediateWriter output, T?value, ContentSerializerAttribute format) { output.WriteRawObject <T>(value.Value, this.underlyingFormat, this.underlyingTypeSerializer); }
public XmlNamespaces(IntermediateWriter writer) { this.writer = writer; }