コード例 #1
0
        public static VpnStaticRouteUnmarshaller GetInstance()
        {
            if (instance == null)
            {
                instance = new VpnStaticRouteUnmarshaller();
            }

            return(instance);
        }
コード例 #2
0
        public VpnConnection Unmarshall(XmlUnmarshallerContext context)
        {
            VpnConnection vpnConnection = new VpnConnection();
            int           originalDepth = context.CurrentDepth;
            int           targetDepth   = originalDepth + 1;

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

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

                        continue;
                    }
                    if (context.TestExpression("state", targetDepth))
                    {
                        vpnConnection.State = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("customerGatewayConfiguration", targetDepth))
                    {
                        vpnConnection.CustomerGatewayConfiguration = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("type", targetDepth))
                    {
                        vpnConnection.Type = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("customerGatewayId", targetDepth))
                    {
                        vpnConnection.CustomerGatewayId = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("vpnGatewayId", targetDepth))
                    {
                        vpnConnection.VpnGatewayId = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("tagSet/item", targetDepth))
                    {
                        vpnConnection.Tags.Add(TagUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                    if (context.TestExpression("vgwTelemetry/item", targetDepth))
                    {
                        vpnConnection.VgwTelemetry.Add(VgwTelemetryUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                    if (context.TestExpression("options", targetDepth))
                    {
                        vpnConnection.Options = VpnConnectionOptionsUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("routes/item", targetDepth))
                    {
                        vpnConnection.Routes.Add(VpnStaticRouteUnmarshaller.GetInstance().Unmarshall(context));

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



            return(vpnConnection);
        }