Class ContentTypeWriter
- Assembly
- MonoGame.Framework.Content.Pipeline.dll
Provides methods and properties for compiling a specific managed type into a binary format.
public abstract class ContentTypeWriter
- Inheritance
-
ContentTypeWriter
- Derived
- Inherited Members
Constructors
ContentTypeWriter(Type)
Initializes a new instance of the ContentTypeWriter class.
protected ContentTypeWriter(Type targetType)
Parameters
targetType
Type
Fields
_typeVersion
protected int _typeVersion
Field Value
Properties
CanDeserializeIntoExistingObject
Determines if deserialization into an existing object is possible.
public virtual bool CanDeserializeIntoExistingObject { get; }
Property Value
- bool
true if the object can be deserialized into; false otherwise.
TargetType
Gets the type handled by this compiler component.
public Type TargetType { get; }
Property Value
- Type
The type handled by this compiler component.
TypeVersion
Gets a format version number for this type.
public virtual int TypeVersion { get; }
Property Value
- int
A format version number for this type.
Methods
GetRuntimeReader(TargetPlatform)
Gets the assembly qualified name of the runtime loader for this type.
public abstract string GetRuntimeReader(TargetPlatform targetPlatform)
Parameters
targetPlatform
TargetPlatformName of the platform.
Returns
- string
Name of the runtime loader.
GetRuntimeType(TargetPlatform)
Gets the assembly qualified name of the runtime target type. The runtime target type often matches the design time type, but may differ.
public virtual string GetRuntimeType(TargetPlatform targetPlatform)
Parameters
targetPlatform
TargetPlatformThe target platform.
Returns
- string
The qualified name.
Initialize(ContentCompiler)
Retrieves and caches nested type writers and allows for reflection over the target data type. Called by the framework at creation time.
protected virtual void Initialize(ContentCompiler compiler)
Parameters
compiler
ContentCompilerThe content compiler.
ShouldCompressContent(TargetPlatform, object)
Indicates whether a given type of content should be compressed.
protected virtual bool ShouldCompressContent(TargetPlatform targetPlatform, object value)
Parameters
targetPlatform
TargetPlatformThe target platform of the content build.
value
objectThe object about to be serialized, or null if a collection of objects is to be serialized.
Returns
- bool
true if the content of the requested type should be compressed; false otherwise.
Remarks
This base class implementation of this method always returns true. It should be overridden to return false if there would be little or no useful reduction in size of the content type's data from a general-purpose lossless compression algorithm. The implementations for Song Class and SoundEffect Class data return false because data for these content types is already in compressed form.
Write(ContentWriter, object)
Compiles an object into binary format.
protected abstract void Write(ContentWriter output, object value)
Parameters
output
ContentWriterThe content writer serializing the value.
value
objectThe resultant object.