Exemplo n.º 1
0
 protected fsResult CheckKey(fsData data, string key, out fsData subitem)
 {
     return(CheckKey(data.AsDictionary, key, out subitem));
 }
Exemplo n.º 2
0
 /// <summary>
 /// Serialize the actual object into the given data storage.
 /// </summary>
 /// <param name="instance">
 /// The object instance to serialize. This will never be null.
 /// </param>
 /// <param name="serialized">The serialized state.</param>
 /// <param name="storageType">
 /// The field/property type that is storing this instance.
 /// </param>
 /// <returns>If serialization was successful.</returns>
 public abstract fsResult TrySerialize(object instance, out fsData serialized, Type storageType);
Exemplo n.º 3
0
 protected fsResult FailExpectedType(fsData data, params fsDataType[] types)
 {
     return(fsResult.Fail(GetType().Name + " expected one of " +
                          string.Join(", ", types.Select(t => t.ToString()).ToArray()) +
                          " but got " + data.Type + " in " + data));
 }
Exemplo n.º 4
0
 /// <summary>
 /// Deserialize data into the object instance.
 /// </summary>
 /// <param name="data">Serialization data to deserialize from.</param>
 /// <param name="instance">
 /// The object instance to deserialize into.
 /// </param>
 /// <param name="storageType">
 /// The field/property type that is storing the instance.
 /// </param>
 /// <returns>
 /// True if serialization was successful, false otherwise.
 /// </returns>
 public abstract fsResult TryDeserialize(fsData data, ref object instance, Type storageType);
Exemplo n.º 5
0
 public override object CreateInstance(fsData data, Type storageType)
 {
     return new Bounds();
 }
Exemplo n.º 6
0
 public override object CreateInstance(fsData data, Type storageType)
 {
     return new GUIStyleState();
 }
Exemplo n.º 7
0
        public override void OnBeforeDeserializeAfterInstanceCreation(Type storageType, object instance, ref fsData data)
        {
            if (instance is fsISerializationCallbacks == false)
            {
                throw new InvalidCastException("Please ensure the converter for " + storageType + " actually returns an instance of it, not an instance of " + instance.GetType());
            }

            ((fsISerializationCallbacks)instance).OnBeforeDeserialize(storageType, ref data);
        }