object SerializeCell(IDesignerSerializationManager manager, CodeExpression target, Cell cell)
        {
            object codeObject = null;
            ExpressionContext context = null;
            ExpressionContext context2 = manager.Context[typeof(ExpressionContext)] as ExpressionContext;
            if (context2 != null)
            {
                CodeMethodInvokeExpression codeIndexer = new CodeMethodInvokeExpression(target, "GetAt", new CodePrimitiveExpression(cell.Column.Index));
                context = new ExpressionContext(codeIndexer, typeof(RowCollection), context2.PresetValue, cell);
                manager.Context.Push(context);
            }
            try
            {
                CodeDomSerializer rowSerialzier = (CodeDomSerializer)manager.GetSerializer(cell.GetType(), typeof(CodeDomSerializer));

                //codeObject = rowSerialzier.Serialize(manager, row);
                codeObject = rowSerialzier.SerializeAbsolute(manager, cell);
            }
            finally
            {
                if (context != null)
                {
                    manager.Context.Pop();
                }
            }

            return codeObject;
        }
 private void SerializeContentProperty(IDesignerSerializationManager manager, object value, PropertyDescriptor property, bool isExtender, CodeStatementCollection statements)
 {
     bool flag;
     object presetValue = this.GetPropertyValue(manager, property, value, out flag);
     CodeDomSerializer serializer = null;
     if (presetValue == null)
     {
         string name = manager.GetName(value);
         if (name == null)
         {
             name = value.GetType().FullName;
         }
         manager.ReportError(System.Design.SR.GetString("SerializerNullNestedProperty", new object[] { name, property.Name }));
     }
     else
     {
         serializer = (CodeDomSerializer) manager.GetSerializer(presetValue.GetType(), typeof(CodeDomSerializer));
         if (serializer != null)
         {
             CodeExpression targetObject = base.SerializeToExpression(manager, value);
             if (targetObject != null)
             {
                 CodeExpression expression = null;
                 if (isExtender)
                 {
                     ExtenderProvidedPropertyAttribute attribute = (ExtenderProvidedPropertyAttribute) property.Attributes[typeof(ExtenderProvidedPropertyAttribute)];
                     CodeExpression expression3 = base.SerializeToExpression(manager, attribute.Provider);
                     CodeExpression expression4 = base.SerializeToExpression(manager, value);
                     if ((expression3 != null) && (expression4 != null))
                     {
                         CodeMethodReferenceExpression expression5 = new CodeMethodReferenceExpression(expression3, "Get" + property.Name);
                         CodeMethodInvokeExpression expression6 = new CodeMethodInvokeExpression {
                             Method = expression5
                         };
                         expression6.Parameters.Add(expression4);
                         expression = expression6;
                     }
                 }
                 else
                 {
                     expression = new CodePropertyReferenceExpression(targetObject, property.Name);
                 }
                 if (expression != null)
                 {
                     ExpressionContext context = new ExpressionContext(expression, property.PropertyType, value, presetValue);
                     manager.Context.Push(context);
                     object obj3 = null;
                     try
                     {
                         SerializeAbsoluteContext context2 = (SerializeAbsoluteContext) manager.Context[typeof(SerializeAbsoluteContext)];
                         if (base.IsSerialized(manager, presetValue, context2 != null))
                         {
                             obj3 = base.GetExpression(manager, presetValue);
                         }
                         else
                         {
                             obj3 = serializer.Serialize(manager, presetValue);
                         }
                     }
                     finally
                     {
                         manager.Context.Pop();
                     }
                     CodeStatementCollection statements2 = obj3 as CodeStatementCollection;
                     if (statements2 == null)
                     {
                         CodeStatement statement2 = obj3 as CodeStatement;
                         if (statement2 != null)
                         {
                             statements.Add(statement2);
                         }
                     }
                     else
                     {
                         foreach (CodeStatement statement in statements2)
                         {
                             statements.Add(statement);
                         }
                     }
                 }
             }
         }
         else
         {
             manager.ReportError(System.Design.SR.GetString("SerializerNoSerializerForComponent", new object[] { property.PropertyType.FullName }));
         }
     }
 }
        object SerializeRow(IDesignerSerializationManager manager, CodeExpression target, Row row)
        {
            object codeObject = null;
            ExpressionContext context = null;
            ExpressionContext context2 = manager.Context[typeof(ExpressionContext)] as ExpressionContext;
            CodeMethodInvokeExpression codeIndexer = new CodeMethodInvokeExpression(target, "GetAt", new CodePrimitiveExpression(row.Index));
            if (context2 != null)
            {
                //CodeIndexerExpression codeIndexer = new CodeIndexerExpression(target, new CodePrimitiveExpression(row.Index));
                context = new ExpressionContext(codeIndexer, typeof(RowCollection), context2.PresetValue, row);
                manager.Context.Push(context);
            }
            try
            {
                CodeDomSerializer rowSerialzier = (CodeDomSerializer)manager.GetSerializer(row.GetType(), typeof(CodeDomSerializer));

                //codeObject = rowSerialzier.Serialize(manager, row);
                codeObject = rowSerialzier.SerializeAbsolute(manager, row);
            }
            finally
            {
                foreach (Cell item in row.Cells)
                {
                    object cellCodeObject = SerializeCell(manager, codeIndexer, item);

                    if(cellCodeObject is CodeStatementCollection && codeObject is CodeStatementCollection)
                    {
                        (codeObject as CodeStatementCollection).AddRange(cellCodeObject as CodeStatementCollection);
                    }
                }

                if (context != null)
                {
                    manager.Context.Pop();
                }
            }

            return codeObject;
        }
 private void SerializeExtenderProperty(IDesignerSerializationManager manager, object value, PropertyDescriptor property, CodeStatementCollection statements)
 {
     AttributeCollection attributes = property.Attributes;
     using (CodeDomSerializerBase.TraceScope("PropertyMemberCodeDomSerializer::SerializeExtenderProperty"))
     {
         ExtenderProvidedPropertyAttribute attribute = (ExtenderProvidedPropertyAttribute) attributes[typeof(ExtenderProvidedPropertyAttribute)];
         CodeExpression targetObject = base.SerializeToExpression(manager, attribute.Provider);
         CodeExpression expression2 = base.SerializeToExpression(manager, value);
         if ((targetObject != null) && (expression2 != null))
         {
             bool flag;
             CodeMethodReferenceExpression expression = new CodeMethodReferenceExpression(targetObject, "Set" + property.Name);
             object obj2 = this.GetPropertyValue(manager, property, value, out flag);
             CodeExpression expression4 = null;
             if (flag)
             {
                 ExpressionContext context = null;
                 if (obj2 != value)
                 {
                     context = new ExpressionContext(expression, property.PropertyType, value);
                     manager.Context.Push(context);
                 }
                 try
                 {
                     expression4 = base.SerializeToExpression(manager, obj2);
                 }
                 finally
                 {
                     if (context != null)
                     {
                         manager.Context.Pop();
                     }
                 }
             }
             if (expression4 != null)
             {
                 CodeMethodInvokeExpression expression5 = new CodeMethodInvokeExpression {
                     Method = expression
                 };
                 expression5.Parameters.Add(expression2);
                 expression5.Parameters.Add(expression4);
                 statements.Add(expression5);
             }
         }
     }
 }
 private void SerializeNormalProperty(IDesignerSerializationManager manager, object value, PropertyDescriptor property, CodeStatementCollection statements)
 {
     using (CodeDomSerializerBase.TraceScope("CodeDomSerializer::SerializeProperty"))
     {
         CodeExpression targetObject = base.SerializeToExpression(manager, value);
         if (targetObject != null)
         {
             CodeExpression expression = new CodePropertyReferenceExpression(targetObject, property.Name);
             CodeExpression right = null;
             MemberRelationshipService service = manager.GetService(typeof(MemberRelationshipService)) as MemberRelationshipService;
             if (service != null)
             {
                 MemberRelationship relationship = service[value, property];
                 if (relationship != MemberRelationship.Empty)
                 {
                     CodeExpression expression4 = base.SerializeToExpression(manager, relationship.Owner);
                     if (expression4 != null)
                     {
                         right = new CodePropertyReferenceExpression(expression4, relationship.Member.Name);
                     }
                 }
             }
             if (right == null)
             {
                 bool flag;
                 object obj2 = this.GetPropertyValue(manager, property, value, out flag);
                 if (flag)
                 {
                     ExpressionContext context = null;
                     if (obj2 != value)
                     {
                         context = new ExpressionContext(expression, property.PropertyType, value);
                         manager.Context.Push(context);
                     }
                     try
                     {
                         right = base.SerializeToExpression(manager, obj2);
                     }
                     finally
                     {
                         if (context != null)
                         {
                             manager.Context.Pop();
                         }
                     }
                 }
             }
             if (right != null)
             {
                 CodeAssignStatement statement = new CodeAssignStatement(expression, right);
                 statements.Add(statement);
             }
         }
     }
 }
 public string SetValue(IDesignerSerializationManager manager, ExpressionContext tree, object value, bool forceInvariant, bool shouldSerializeInvariant, bool ensureInvariant, bool applyingCachedResources)
 {
     string name = null;
     bool flag = false;
     if (tree != null)
     {
         string propertyName;
         if (tree.Owner == this.RootComponent)
         {
             name = "$this";
         }
         else
         {
             name = manager.GetName(tree.Owner);
             if (name == null)
             {
                 IReferenceService service = (IReferenceService) manager.GetService(typeof(IReferenceService));
                 if (service != null)
                 {
                     name = service.GetName(tree.Owner);
                 }
             }
         }
         CodeExpression expression = tree.Expression;
         if (expression is CodePropertyReferenceExpression)
         {
             propertyName = ((CodePropertyReferenceExpression) expression).PropertyName;
         }
         else if (expression is CodeFieldReferenceExpression)
         {
             propertyName = ((CodeFieldReferenceExpression) expression).FieldName;
         }
         else if (expression is CodeMethodReferenceExpression)
         {
             propertyName = ((CodeMethodReferenceExpression) expression).MethodName;
             if (propertyName.StartsWith("Set"))
             {
                 propertyName = propertyName.Substring(3);
             }
         }
         else
         {
             propertyName = null;
         }
         if (name == null)
         {
             name = "resource";
         }
         if (propertyName != null)
         {
             name = name + "." + propertyName;
         }
     }
     else
     {
         name = "resource";
         flag = true;
     }
     string key = name;
     int num = 1;
     do
     {
         if (flag)
         {
             key = name + num.ToString(CultureInfo.InvariantCulture);
             num++;
         }
         else
         {
             flag = true;
         }
     }
     while (this.nameTable.ContainsKey(key));
     this.SetValue(manager, key, value, forceInvariant, shouldSerializeInvariant, ensureInvariant, applyingCachedResources);
     this.nameTable[key] = key;
     return key;
 }
        public override object Serialize(IDesignerSerializationManager manager, object value)
        {
            if (manager == null)
                throw new ArgumentNullException("manager");

            object result = null;
            if (value == null)
                return result;

            CodeStatementCollection statements = null;
            ExpressionContext cxt = manager.Context[typeof(ExpressionContext)] as ExpressionContext;

            if (value.GetType().GetConstructor(new Type[0]) != null)
            {
                if (value is ICollection)
                {
                    ExpressionContext varExct = null;
                    if (cxt != null)
                    {
                        if (cxt.PresetValue != value)
                        {
                            try
                            {
                                statements = new CodeStatementCollection();
                                CodeVariableReferenceExpression varExpression = AddVariableExpression(manager, statements, value);
                                varExct = new ExpressionContext(varExpression, value.GetType(), cxt.Owner, value);
                                manager.Context.Push(varExct);
                                result = this.originalSerializer.Serialize(manager, value);
                                if (result is CodeStatementCollection)
                                    statements.AddRange(result as CodeStatementCollection);
                                else if (result is CodeStatement)
                                    statements.Add(result as CodeStatement);
                                else if (result is CodeExpression)
                                    // If the returned result is an expression, it mostly likely means the collection
                                    // can not be serialized using statements, instead it has been serialized as resources.
                                    // In this case, we just over-write the variable init expression with the "GetObject"
                                    // expression for resource objects.
                                    statements.Add(new CodeAssignStatement(varExpression, result as CodeExpression));

                                result = statements;
                            }
                            finally
                            {
                                if (varExct != null)
                                    manager.Context.Pop();
                            }
                        }
                        else
                        {
                            result = this.originalSerializer.Serialize(manager, value);
                        }
                    }
                }
                else
                {
                    statements = new CodeStatementCollection();
                    CodeVariableReferenceExpression varExpression = AddVariableExpression(manager, statements, value);
                    SerializeProperties(manager, statements, value, new Attribute[] { DesignOnlyAttribute.No });
                    SerializeEvents(manager, statements, value, new Attribute[] { DesignOnlyAttribute.No });
                    result = statements;
                }
            }
            else if (cxt != null)
            {
                result = this.originalSerializer.Serialize(manager, value);
            }

            return result;
        }
 private CodeExpression SerializeInstanceDescriptor(IDesignerSerializationManager manager, object value, InstanceDescriptor descriptor)
 {
     CodeExpression expression = null;
     using (TraceScope("CodeDomSerializerBase::SerializeInstanceDescriptor"))
     {
         CodeExpression[] parameters = new CodeExpression[descriptor.Arguments.Count];
         object[] array = new object[parameters.Length];
         ParameterInfo[] infoArray = null;
         if (parameters.Length > 0)
         {
             descriptor.Arguments.CopyTo(array, 0);
             MethodBase memberInfo = descriptor.MemberInfo as MethodBase;
             if (memberInfo != null)
             {
                 infoArray = memberInfo.GetParameters();
             }
         }
         bool flag = true;
         for (int i = 0; i < parameters.Length; i++)
         {
             object obj2 = array[i];
             CodeExpression expression2 = null;
             ExpressionContext context = null;
             ExpressionContext context2 = manager.Context[typeof(ExpressionContext)] as ExpressionContext;
             if (context2 != null)
             {
                 context = new ExpressionContext(context2.Expression, infoArray[i].ParameterType, context2.Owner);
                 manager.Context.Push(context);
             }
             try
             {
                 expression2 = this.SerializeToExpression(manager, obj2);
             }
             finally
             {
                 if (context != null)
                 {
                     manager.Context.Pop();
                 }
             }
             if (expression2 != null)
             {
                 if ((obj2 != null) && !infoArray[i].ParameterType.IsAssignableFrom(obj2.GetType()))
                 {
                     expression2 = new CodeCastExpression(infoArray[i].ParameterType, expression2);
                 }
                 parameters[i] = expression2;
             }
             else
             {
                 flag = false;
                 break;
             }
         }
         if (!flag)
         {
             return expression;
         }
         Type declaringType = descriptor.MemberInfo.DeclaringType;
         CodeTypeReference createType = new CodeTypeReference(declaringType);
         if (descriptor.MemberInfo is ConstructorInfo)
         {
             expression = new CodeObjectCreateExpression(createType, parameters);
         }
         else if (descriptor.MemberInfo is MethodInfo)
         {
             CodeTypeReferenceExpression targetObject = new CodeTypeReferenceExpression(createType);
             CodeMethodReferenceExpression method = new CodeMethodReferenceExpression(targetObject, descriptor.MemberInfo.Name);
             expression = new CodeMethodInvokeExpression(method, parameters);
             declaringType = ((MethodInfo) descriptor.MemberInfo).ReturnType;
         }
         else if (descriptor.MemberInfo is PropertyInfo)
         {
             CodeTypeReferenceExpression expression5 = new CodeTypeReferenceExpression(createType);
             CodePropertyReferenceExpression expression6 = new CodePropertyReferenceExpression(expression5, descriptor.MemberInfo.Name);
             expression = expression6;
             declaringType = ((PropertyInfo) descriptor.MemberInfo).PropertyType;
         }
         else if (descriptor.MemberInfo is FieldInfo)
         {
             CodeTypeReferenceExpression expression7 = new CodeTypeReferenceExpression(createType);
             expression = new CodeFieldReferenceExpression(expression7, descriptor.MemberInfo.Name);
             declaringType = ((FieldInfo) descriptor.MemberInfo).FieldType;
         }
         Type type = value.GetType();
         while (!type.IsPublic)
         {
             type = type.BaseType;
         }
         if (!type.IsAssignableFrom(declaringType))
         {
             expression = new CodeCastExpression(type, expression);
         }
     }
     return expression;
 }
 protected void SerializePropertiesToResources(IDesignerSerializationManager manager, CodeStatementCollection statements, object value, Attribute[] filter)
 {
     using (TraceScope("ComponentCodeDomSerializerBase::SerializePropertiesToResources"))
     {
         PropertyDescriptorCollection descriptors = GetPropertiesHelper(manager, value, filter);
         manager.Context.Push(statements);
         try
         {
             CodeExpression targetObject = this.SerializeToExpression(manager, value);
             if (targetObject != null)
             {
                 CodePropertyReferenceExpression expression = new CodePropertyReferenceExpression(targetObject, string.Empty);
                 foreach (PropertyDescriptor descriptor in descriptors)
                 {
                     ExpressionContext context = new ExpressionContext(expression, descriptor.PropertyType, value);
                     manager.Context.Push(context);
                     try
                     {
                         if (descriptor.Attributes.Contains(DesignerSerializationVisibilityAttribute.Visible))
                         {
                             string name;
                             expression.PropertyName = descriptor.Name;
                             if (targetObject is CodeThisReferenceExpression)
                             {
                                 name = "$this";
                             }
                             else
                             {
                                 name = manager.GetName(value);
                             }
                             name = string.Format(CultureInfo.CurrentCulture, "{0}.{1}", new object[] { name, descriptor.Name });
                             ResourceCodeDomSerializer.Default.SerializeMetadata(manager, name, descriptor.GetValue(value), descriptor.ShouldSerializeValue(value));
                         }
                     }
                     finally
                     {
                         manager.Context.Pop();
                     }
                 }
             }
         }
         finally
         {
             manager.Context.Pop();
         }
     }
 }
 private object SerializeViaAddRange(IDesignerSerializationManager manager, CodeExpression targetExpression, Type targetType, Type elementType, ICollection valuesToSerialize)
 {
     CodeStatementCollection statements = new CodeStatementCollection();
     using (CodeDomSerializerBase.TraceScope("CollectionCodeDomSerializer::SerializeViaAddRange"))
     {
         if (valuesToSerialize.Count <= 0)
         {
             return statements;
         }
         ArrayList list = new ArrayList(valuesToSerialize.Count);
         ExpressionContext context = manager.Context[typeof(ExpressionContext)] as ExpressionContext;
         foreach (object obj2 in valuesToSerialize)
         {
             bool flag = !(obj2 is IComponent);
             if (!flag)
             {
                 InheritanceAttribute attribute = (InheritanceAttribute) TypeDescriptor.GetAttributes(obj2)[typeof(InheritanceAttribute)];
                 if (attribute != null)
                 {
                     if (attribute.InheritanceLevel == InheritanceLevel.InheritedReadOnly)
                     {
                         flag = false;
                     }
                     else
                     {
                         flag = true;
                     }
                 }
                 else
                 {
                     flag = true;
                 }
             }
             if (flag)
             {
                 CodeExpression expression = null;
                 ExpressionContext context2 = null;
                 if (context != null)
                 {
                     context2 = new ExpressionContext(context.Expression, elementType, context.Owner);
                     manager.Context.Push(context2);
                 }
                 try
                 {
                     expression = base.SerializeToExpression(manager, obj2);
                 }
                 finally
                 {
                     if (context2 != null)
                     {
                         manager.Context.Pop();
                     }
                 }
                 if (expression != null)
                 {
                     if ((obj2 != null) && !elementType.IsAssignableFrom(obj2.GetType()))
                     {
                         expression = new CodeCastExpression(elementType, expression);
                     }
                     list.Add(expression);
                 }
             }
         }
         if (list.Count <= 0)
         {
             return statements;
         }
         CodeTypeReference reference = new CodeTypeReference(elementType);
         CodeArrayCreateExpression expression2 = new CodeArrayCreateExpression {
             CreateType = reference
         };
         foreach (CodeExpression expression3 in list)
         {
             expression2.Initializers.Add(expression3);
         }
         CodeMethodReferenceExpression expression4 = new CodeMethodReferenceExpression(targetExpression, "AddRange");
         CodeMethodInvokeExpression expression5 = new CodeMethodInvokeExpression {
             Method = expression4
         };
         expression5.Parameters.Add(expression2);
         statements.Add(new CodeExpressionStatement(expression5));
     }
     return statements;
 }
 private CodeArrayCreateExpression SerializeArray(IDesignerSerializationManager manager, Type targetType, ICollection array, ICollection valuesToSerialize)
 {
     CodeArrayCreateExpression expression = null;
     using (CodeDomSerializerBase.TraceScope("CollectionCodeDomSerializer::SerializeArray"))
     {
         if (((Array) array).Rank != 1)
         {
             manager.ReportError(System.Design.SR.GetString("SerializerInvalidArrayRank", new object[] { ((Array) array).Rank.ToString(CultureInfo.InvariantCulture) }));
             return expression;
         }
         Type elementType = targetType.GetElementType();
         CodeTypeReference reference = new CodeTypeReference(elementType);
         CodeArrayCreateExpression expression2 = new CodeArrayCreateExpression {
             CreateType = reference
         };
         bool flag = true;
         foreach (object obj2 in valuesToSerialize)
         {
             if ((obj2 is IComponent) && TypeDescriptor.GetAttributes(obj2).Contains(InheritanceAttribute.InheritedReadOnly))
             {
                 flag = false;
                 break;
             }
             CodeExpression expression3 = null;
             ExpressionContext context = null;
             ExpressionContext context2 = manager.Context[typeof(ExpressionContext)] as ExpressionContext;
             if (context2 != null)
             {
                 context = new ExpressionContext(context2.Expression, elementType, context2.Owner);
                 manager.Context.Push(context);
             }
             try
             {
                 expression3 = base.SerializeToExpression(manager, obj2);
             }
             finally
             {
                 if (context != null)
                 {
                     manager.Context.Pop();
                 }
             }
             if (expression3 != null)
             {
                 if ((obj2 != null) && (obj2.GetType() != elementType))
                 {
                     expression3 = new CodeCastExpression(elementType, expression3);
                 }
                 expression2.Initializers.Add(expression3);
             }
             else
             {
                 flag = false;
                 break;
             }
         }
         if (flag)
         {
             expression = expression2;
         }
     }
     return expression;
 }
Пример #12
0
        private void SerializeContentProperty(IDesignerSerializationManager manager, object value, PropertyDescriptor property, bool isExtender, CodeStatementCollection statements)
        {
            bool              flag;
            object            presetValue = this.GetPropertyValue(manager, property, value, out flag);
            CodeDomSerializer serializer  = null;

            if (presetValue == null)
            {
                string name = manager.GetName(value);
                if (name == null)
                {
                    name = value.GetType().FullName;
                }
                manager.ReportError(System.Design.SR.GetString("SerializerNullNestedProperty", new object[] { name, property.Name }));
            }
            else
            {
                serializer = (CodeDomSerializer)manager.GetSerializer(presetValue.GetType(), typeof(CodeDomSerializer));
                if (serializer != null)
                {
                    CodeExpression targetObject = base.SerializeToExpression(manager, value);
                    if (targetObject != null)
                    {
                        CodeExpression expression = null;
                        if (isExtender)
                        {
                            ExtenderProvidedPropertyAttribute attribute = (ExtenderProvidedPropertyAttribute)property.Attributes[typeof(ExtenderProvidedPropertyAttribute)];
                            CodeExpression expression3 = base.SerializeToExpression(manager, attribute.Provider);
                            CodeExpression expression4 = base.SerializeToExpression(manager, value);
                            if ((expression3 != null) && (expression4 != null))
                            {
                                CodeMethodReferenceExpression expression5 = new CodeMethodReferenceExpression(expression3, "Get" + property.Name);
                                CodeMethodInvokeExpression    expression6 = new CodeMethodInvokeExpression {
                                    Method = expression5
                                };
                                expression6.Parameters.Add(expression4);
                                expression = expression6;
                            }
                        }
                        else
                        {
                            expression = new CodePropertyReferenceExpression(targetObject, property.Name);
                        }
                        if (expression != null)
                        {
                            ExpressionContext context = new ExpressionContext(expression, property.PropertyType, value, presetValue);
                            manager.Context.Push(context);
                            object obj3 = null;
                            try
                            {
                                SerializeAbsoluteContext context2 = (SerializeAbsoluteContext)manager.Context[typeof(SerializeAbsoluteContext)];
                                if (base.IsSerialized(manager, presetValue, context2 != null))
                                {
                                    obj3 = base.GetExpression(manager, presetValue);
                                }
                                else
                                {
                                    obj3 = serializer.Serialize(manager, presetValue);
                                }
                            }
                            finally
                            {
                                manager.Context.Pop();
                            }
                            CodeStatementCollection statements2 = obj3 as CodeStatementCollection;
                            if (statements2 == null)
                            {
                                CodeStatement statement2 = obj3 as CodeStatement;
                                if (statement2 != null)
                                {
                                    statements.Add(statement2);
                                }
                            }
                            else
                            {
                                foreach (CodeStatement statement in statements2)
                                {
                                    statements.Add(statement);
                                }
                            }
                        }
                    }
                }
                else
                {
                    manager.ReportError(System.Design.SR.GetString("SerializerNoSerializerForComponent", new object[] { property.PropertyType.FullName }));
                }
            }
        }