public static OptionSettingUnmarshaller GetInstance() 
        {
            if (instance == null) 
               instance = new OptionSettingUnmarshaller();

            return instance;
        }
예제 #2
0
        public Option Unmarshall(XmlUnmarshallerContext context)
        {
            Option option        = new Option();
            int    originalDepth = context.CurrentDepth;
            int    targetDepth   = originalDepth + 1;

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

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

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

                        continue;
                    }
                    if (context.TestExpression("Persistent", targetDepth))
                    {
                        option.Persistent = BoolUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("Port", targetDepth))
                    {
                        option.Port = IntUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("OptionSettings/OptionSetting", targetDepth))
                    {
                        option.OptionSettings.Add(OptionSettingUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                    if (context.TestExpression("DBSecurityGroupMemberships/DBSecurityGroup", targetDepth))
                    {
                        option.DBSecurityGroupMemberships.Add(DBSecurityGroupMembershipUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                    if (context.TestExpression("VpcSecurityGroupMemberships/VpcSecurityGroupMembership", targetDepth))
                    {
                        option.VpcSecurityGroupMemberships.Add(VpcSecurityGroupMembershipUnmarshaller.GetInstance().Unmarshall(context));

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



            return(option);
        }