Exemplo n.º 1
0
        private void serializeFromISerializable(ISerializable data)
        {
            m_CustomData = new Dictionary <string, CustomTypedEntry>();

            var info = new SerializationInfo(data.GetType(), new FormatterConverter());
            StreamingContext streamingContext = new StreamingContext(StreamingContextStates.Persistence);

            data.GetObjectData(info, streamingContext);

            var senum = info.GetEnumerator();

            while (senum.MoveNext())
            {
                var value = new CustomTypedEntry();
                value.TypeIndex          = MetaType.GetExistingOrNewMetaTypeIndex(m_Document, senum.ObjectType);
                value.Data               = m_Document.NativeDataToPortableData(senum.Value);
                m_CustomData[senum.Name] = value;
            }
        }
Exemplo n.º 2
0
        private void serializeFromISerializable(ISerializable data)
        {
            m_CustomData = new Dictionary<string,CustomTypedEntry>();

                    var info = new SerializationInfo(data.GetType(), new FormatterConverter());
                    StreamingContext streamingContext = new StreamingContext(StreamingContextStates.Persistence);
                    data.GetObjectData(info, streamingContext);

                    var senum = info.GetEnumerator();
                    while(senum.MoveNext())
                    {
                        var value = new CustomTypedEntry();
                        value.TypeIndex = MetaType.GetExistingOrNewMetaTypeIndex( m_Document, senum.ObjectType );
                        value.Data = m_Document.NativeDataToPortableData( senum.Value );
                        m_CustomData[senum.Name] = value;
                    }
        }