3 using System.Collections.Generic;
4 using System.Reflection;
5 using SiliconStudio.Core.Serialization;
6 using SiliconStudio.Core.Serialization.Converters;
7 using SiliconStudio.Core.Serialization.Serializers;
8 #if SILICONSTUDIO_PLATFORM_WINDOWS_RUNTIME
10 using SiliconStudio.Core.Collections;
13 namespace SiliconStudio.
Paradox.Effects.Data
16 public partial class ParameterCollectionData : SortedList<ParameterKey, object>
24 var indexOfKey = this.IndexOfKey(key);
36 private bool reuseReferences;
40 reuseReferences = serializerSelector.ReuseReferences;
49 obj =
new ParameterCollectionData();
60 int count = stream.ReadInt32();
61 for (
int i = 0; i <
count; ++i)
63 ParameterKey key = null;
65 bool matchingType =
false;
67 stream.SerializeExtended(ref key, mode);
68 stream.Serialize(ref matchingType);
70 var valueType = matchingType ? key.PropertyType : typeof(
object);
72 MemberReuseSerializer.SerializeExtended(stream, valueType, ref value, mode);
74 MemberNonSealedSerializer.SerializeExtended(stream, valueType, ref value, mode);
81 stream.Write(obj.Count);
82 foreach (var item
in obj)
88 var value = item.Key.ConvertValue(item.Value);
90 stream.SerializeExtended(ref key, mode);
91 bool matchingType = value.GetType().GetTypeInfo().IsAssignableFrom(key.PropertyType.GetTypeInfo());
92 stream.Serialize(ref matchingType);
94 var valueType = matchingType ? key.PropertyType : typeof(
object);
97 MemberReuseSerializer.SerializeExtended(stream, valueType, ref value, mode);
99 MemberNonSealedSerializer.SerializeExtended(stream, valueType, ref value, mode);
111 foreach (var parameter
in parameterCollection.InternalValues)
113 if (parameterCollection.IsValueOwner(parameter.Value))
114 parameterCollectionData.Add(parameter.Key, parameter.Value.Object);
121 foreach (var parameter
in parameterCollectionData)
123 var parameterValue = parameter.Value;
125 parameterValue = converterContext.ConvertFromData<
object>(parameterValue);
126 parameterCollection.SetObject(parameter.Key, parameterValue);
void Set(ParameterKey key, object value)
Key of an effect parameter.
ParameterCollectionData()
Base class for converters to/from a data type.
Data type for SiliconStudio.Paradox.Effects.ParameterCollection.
Base class for implementation of SerializationStream.
Adds initialization feature to a DataSerializer.
override void ConvertToData(ConverterContext converterContext, ref ParameterCollectionData parameterCollectionData, ParameterCollection parameterCollection)
Serializer context. It holds DataSerializer{T} objects and their factories.
Describes how to serialize and deserialize an object without knowing its type. Used as a common base ...
ArchiveMode
Enumerates the different mode of serialization (either serialization or deserialization).
override void ConvertFromData(ConverterContext converterContext, ParameterCollectionData parameterCollectionData, ref ParameterCollection parameterCollection)
A container to handle a hierarchical collection of effect variables.