Esempio n. 1
0
        static private void DeserializeFields(BinaryReader reader, object o)
        {
            Type t = o.GetType( );

            if (t.IsArray)
            {
                BinarySerializer.InternalDeserializeInstance(reader, o, t);
            }
            else
            {
                BinarySerializer.InternalDeserializeFields(reader, o, t);
            }
        }
Esempio n. 2
0
        static private void InternalDeserializeFields(BinaryReader reader, object o, Type t)
        {
            // if this is not a root move up to the root
            // so that marshaling includes complete
            // inheritance chain
            if (t.BaseType != null)
            {
                BinarySerializer.InternalDeserializeFields(reader, o, t.BaseType);
            }

            // marshal individual fields
            foreach (FieldInfo info in t.GetFields(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly))
            {
                if (info.FieldType.IsSerializable)
                {
                    Type   fieldType = info.FieldType;
                    object obj2      = info.GetValue(o);
                    obj2 = BinarySerializer.InternalDeserializeInstance(reader, obj2, fieldType);
                    info.SetValue(o, obj2);
                }
            }
        }