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
-
IYamlSerializableFactoryIYamlSerializableIDataCustomVisitor
- 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
ObjectContextfromScalar
Scalar
Returns
ConvertTo(ref ObjectContext)
public abstract string ConvertTo(ref ObjectContext objectContext)
Parameters
objectContext
ObjectContext
Returns
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
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
SerializerContexttypeDescriptor
ITypeDescriptorThe 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
VisitorContextThe context.
WriteScalar(ref ObjectContext, ScalarEventInfo)
protected virtual void WriteScalar(ref ObjectContext objectContext, ScalarEventInfo scalar)
Parameters
objectContext
ObjectContextscalar
ScalarEventInfo
WriteYaml(ref ObjectContext)
Writes the specified object context to a YAML emitter.
public void WriteYaml(ref ObjectContext objectContext)
Parameters
objectContext
ObjectContextThe object context.