예제 #1
0
        public static EC2SecurityGroupUnmarshaller GetInstance()
        {
            if (instance == null)
               instance = new EC2SecurityGroupUnmarshaller();

            return instance;
        }
        public DBSecurityGroup Unmarshall(XmlUnmarshallerContext 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("VpcId", targetDepth))
                    {
                        dBSecurityGroup.VpcId = 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);
        }