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

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

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

            while (context.Read())
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("ruleNumber", targetDepth))
                    {
                        networkAclEntry.RuleNumber = IntUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("protocol", targetDepth))
                    {
                        networkAclEntry.Protocol = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("ruleAction", targetDepth))
                    {
                        networkAclEntry.RuleAction = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("egress", targetDepth))
                    {
                        networkAclEntry.Egress = BoolUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("cidrBlock", targetDepth))
                    {
                        networkAclEntry.CidrBlock = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("icmpTypeCode", targetDepth))
                    {
                        networkAclEntry.IcmpTypeCode = IcmpTypeCodeUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("portRange", targetDepth))
                    {
                        networkAclEntry.PortRange = PortRangeUnmarshaller.GetInstance().Unmarshall(context);

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



            return(networkAclEntry);
        }