ContentWriter

class ContentWriter : System.IO.BinaryWriter, System.IDisposable

Provides an implementation for many of the ContentCompiler methods including compilation, state tracking for shared resources and creation of the header type manifest.

readonly TargetPlatform TargetPlatform

Gets the content build target platform.

readonly GraphicsProfile TargetProfile

Gets or sets the target graphics profile.

public void Flush()

All content has been written, so now finalize the header, footer and anything else that needs finalizing.

ContentTypeWriter GetTypeWriter(System.Type type)

Gets a ContentTypeWriter for the given type.

Parameters:
  • type (System.Type) – The type of the object to write.
Returns:

The ContentTypeWriter for the type.

public void WriteExternalReference<T>(ExternalReference<T> reference)

Writes the name of an external file to the output binary.

Type Parameters:
 
  • T – The type of reference.
Parameters:
  • reference (Microsoft.Xna.Framework.Content.Pipeline.ExternalReference<T>) – External reference to a data file for the content item.
public void WriteObject<T>(Microsoft.Xna.Framework.Content.Pipeline.Serialization.Compiler.T value)
Type Parameters:
 
  • T
Parameters:
  • value (Microsoft.Xna.Framework.Content.Pipeline.Serialization.Compiler.T) –
public void WriteObject<T>(Microsoft.Xna.Framework.Content.Pipeline.Serialization.Compiler.T value, ContentTypeWriter typeWriter)
Type Parameters:
 
  • T
Parameters:
  • value (Microsoft.Xna.Framework.Content.Pipeline.Serialization.Compiler.T) –
  • typeWriter (Microsoft.Xna.Framework.Content.Pipeline.Serialization.Compiler.ContentTypeWriter) –
public void WriteRawObject<T>(Microsoft.Xna.Framework.Content.Pipeline.Serialization.Compiler.T value)
Type Parameters:
 
  • T
Parameters:
  • value (Microsoft.Xna.Framework.Content.Pipeline.Serialization.Compiler.T) –
public void WriteRawObject<T>(Microsoft.Xna.Framework.Content.Pipeline.Serialization.Compiler.T value, ContentTypeWriter typeWriter)
Type Parameters:
 
  • T
Parameters:
  • value (Microsoft.Xna.Framework.Content.Pipeline.Serialization.Compiler.T) –
  • typeWriter (Microsoft.Xna.Framework.Content.Pipeline.Serialization.Compiler.ContentTypeWriter) –
public void WriteSharedResource<T>(Microsoft.Xna.Framework.Content.Pipeline.Serialization.Compiler.T value)
Type Parameters:
 
  • T
Parameters:
  • value (Microsoft.Xna.Framework.Content.Pipeline.Serialization.Compiler.T) –
public void Write(Color value)

Writes a Color value.

Parameters:
  • value (Microsoft.Xna.Framework.Color) – Value of a color using Red, Green, Blue, and Alpha values to write.
public void Write(Matrix value)

Writes a Matrix value.

Parameters:
  • value (Microsoft.Xna.Framework.Matrix) – Value to write.
public void Write(Quaternion value)

Writes a Matrix value.

Parameters:
  • value (Microsoft.Xna.Framework.Quaternion) – Value to write.
public void Write(Vector2 value)

Writes a Vector2 value.

Parameters:
  • value (Microsoft.Xna.Framework.Vector2) – Value to write.
public void Write(Vector3 value)

Writes a Vector3 value.

Parameters:
  • value (Microsoft.Xna.Framework.Vector3) – Value to write.
public void Write(Vector4 value)

Writes a Vector4 value.

Parameters:
  • value (Microsoft.Xna.Framework.Vector4) – Value to write.
void Write(BoundingSphere value)

Writes a BoundingSphere value.

Parameters:
  • value (Microsoft.Xna.Framework.BoundingSphere) – Value to write.
void Write(Rectangle value)

Writes a Rectangle value.

Parameters:
  • value (Microsoft.Xna.Framework.Rectangle) – Value to write.
bool CanDeserializeIntoExistingObject(System.Type type)

Helper for checking if a type can be deserialized into an existing object.

Parameters:
  • type (System.Type) – The type to check.
Returns:

True if the type can be deserialized into an existing object.