Exemplo n.º 1
0
        public DBSecurityGroup Unmarshall(UnmarshallerContext context)
        {
            DBSecurityGroup dBSecurityGroup = new DBSecurityGroup();
            int             originalDepth   = context.CurrentDepth;
            int             targetDepth     = originalDepth + 1;

            if (context.IsStartOfDocument)
            {
                targetDepth += 2;
            }

            if (context.IsStartOfDocument)
            {
                targetDepth++;
            }

            while (context.Read())
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("OwnerId", targetDepth))
                    {
                        dBSecurityGroup.OwnerId = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("DBSecurityGroupName", targetDepth))
                    {
                        dBSecurityGroup.DBSecurityGroupName = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("DBSecurityGroupDescription", targetDepth))
                    {
                        dBSecurityGroup.DBSecurityGroupDescription = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("EC2SecurityGroups/EC2SecurityGroup", targetDepth))
                    {
                        dBSecurityGroup.EC2SecurityGroups.Add(EC2SecurityGroupUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                    if (context.TestExpression("IPRanges/IPRange", targetDepth))
                    {
                        dBSecurityGroup.IPRanges.Add(IPRangeUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth < originalDepth)
                {
                    return(dBSecurityGroup);
                }
            }

            return(dBSecurityGroup);
        }
        public static IPRangeUnmarshaller GetInstance()
        {
            if (instance == null)
            {
                instance = new IPRangeUnmarshaller();
            }

            return(instance);
        }