Table of Contents

Class ScalarOrObjectSerializer

Namespace
Stride.Core.Assets.Serializers
Assembly
Stride.Core.Assets.dll

Serializer that works with scalar, but could still read older ObjectSerializer format.

public abstract class ScalarOrObjectSerializer : IYamlSerializableFactory, IYamlSerializable, IDataCustomVisitor
Inheritance
ScalarOrObjectSerializer
Implements
IYamlSerializableFactory
IYamlSerializable
IDataCustomVisitor
Derived

Constructors

ScalarOrObjectSerializer()

protected ScalarOrObjectSerializer()

Methods

CanVisit(Type)

Determines whether this instance can visit the specified object.

public abstract bool CanVisit(Type type)

Parameters

type Type

Returns

bool

true if this instance can visit the specified object; otherwise, false.

ConvertFrom(ref ObjectContext, Scalar)

public abstract object ConvertFrom(ref ObjectContext context, Scalar fromScalar)

Parameters

context ObjectContext
fromScalar Scalar

Returns

object

ConvertTo(ref ObjectContext)

public abstract string ConvertTo(ref ObjectContext objectContext)

Parameters

objectContext ObjectContext

Returns

string

ReadYaml(ref ObjectContext)

Reads this object's state from a YAML parser.

public object ReadYaml(ref ObjectContext objectContext)

Parameters

objectContext ObjectContext

Returns

object

A instance of the object deserialized from Yaml.

ShouldSerializeAsScalar(ref ObjectContext)

protected virtual bool ShouldSerializeAsScalar(ref ObjectContext objectContext)

Parameters

objectContext ObjectContext

Returns

bool

TryCreate(SerializerContext, ITypeDescriptor)

Try to create a Stride.Core.Yaml.Serialization.IYamlSerializable or return null if not supported for a particular .NET typeDescriptor.

public IYamlSerializable TryCreate(SerializerContext context, ITypeDescriptor typeDescriptor)

Parameters

context SerializerContext
typeDescriptor ITypeDescriptor

The typeDescriptor.

Returns

IYamlSerializable

If supported, return an instance of Stride.Core.Yaml.Serialization.IYamlSerializable else return null.

Visit(ref VisitorContext)

Visits the specified object.

public void Visit(ref VisitorContext context)

Parameters

context VisitorContext

The context.

WriteScalar(ref ObjectContext, ScalarEventInfo)

protected virtual void WriteScalar(ref ObjectContext objectContext, ScalarEventInfo scalar)

Parameters

objectContext ObjectContext
scalar ScalarEventInfo

WriteYaml(ref ObjectContext)

Writes the specified object context to a YAML emitter.

public void WriteYaml(ref ObjectContext objectContext)

Parameters

objectContext ObjectContext

The object context.