Version 3.3.1.2

WeakBaseFormatter class

Namespace: Sirenix.Serialization
Assembly: Sirenix.Serialization
public abstract class WeakBaseFormatter : IFormatter
Provides common functionality for serializing and deserializing weakly typed values of a given type, and provides automatic support for the following common serialization conventions:

System.Runtime.Serialization.IObjectReference, , System.Runtime.Serialization.OnSerializingAttribute, System.Runtime.Serialization.OnSerializedAttribute, System.Runtime.Serialization.OnDeserializingAttribute and System.Runtime.Serialization.OnDeserializedAttribute.

Inheritance
  • System.Object
  • WeakBaseFormatter
See Also
  • Sirenix.Serialization.IFormatter

Constructors

WeakBaseFormatter(Type)
public WeakBaseFormatter(Type serializedType)
Parameters
System.Type serializedType

Fields

ImplementsIDeserializationCallback
protected readonly bool ImplementsIDeserializationCallback
ImplementsIObjectReference
protected readonly bool ImplementsIObjectReference
ImplementsISerializationCallbackReceiver
protected readonly bool ImplementsISerializationCallbackReceiver
IsValueType
protected readonly bool IsValueType
OnDeserializedCallbacks
protected readonly WeakBaseFormatter.SerializationCallback[] OnDeserializedCallbacks
OnDeserializingCallbacks
protected readonly WeakBaseFormatter.SerializationCallback[] OnDeserializingCallbacks
OnSerializedCallbacks
protected readonly WeakBaseFormatter.SerializationCallback[] OnSerializedCallbacks
OnSerializingCallbacks
protected readonly WeakBaseFormatter.SerializationCallback[] OnSerializingCallbacks
SerializedType
protected readonly Type SerializedType

Methods

Deserialize(IDataReader)
Deserializes a value using a specified Sirenix.Serialization.IDataReader.
public object Deserialize(IDataReader reader)
Parameters
Sirenix.Serialization.IDataReader reader

The reader to use.

Returns
System.Object

The deserialized value.

DeserializeImplementation(ref Object, IDataReader)
Provides the actual implementation for deserializing a value of type .
protected abstract void DeserializeImplementation(ref object value, IDataReader reader)
Parameters
System.Object value

The uninitialized value to serialize into. This value will have been created earlier using GetUninitializedObject().

Sirenix.Serialization.IDataReader reader

The reader to deserialize with.

GetUninitializedObject()
protected virtual object GetUninitializedObject()
Returns
System.Object

InvokeOnDeserializingCallbacks(Object, DeserializationContext)
Invokes all methods on the object with the [OnDeserializing] attribute.

WARNING: This method will not be called automatically if you override GetUninitializedObject and return null! You will have to call it manually after having created the object instance during deserialization.

protected void InvokeOnDeserializingCallbacks(object value, DeserializationContext context)
Parameters
System.Object value

The value to invoke the callbacks on.

DeserializationContext context

The deserialization context.

RegisterReferenceID(Object, IDataReader)
Registers the given object reference in the deserialization context.

NOTE that this method only does anything if is not a value type.

protected void RegisterReferenceID(object value, IDataReader reader)
Parameters
System.Object value

The value to register.

Sirenix.Serialization.IDataReader reader

The reader which is currently being used.

Serialize(Object, IDataWriter)
Serializes a value using a specified Sirenix.Serialization.IDataWriter.
public void Serialize(object value, IDataWriter writer)
Parameters
System.Object value

The value to serialize.

Sirenix.Serialization.IDataWriter writer

The writer to use.

SerializeImplementation(ref Object, IDataWriter)
Provides the actual implementation for serializing a value of type .
protected abstract void SerializeImplementation(ref object value, IDataWriter writer)
Parameters
System.Object value

The value to serialize.

Sirenix.Serialization.IDataWriter writer

The writer to serialize with.