Пример #1
0
        public static CookiePreferenceUnmarshaller GetInstance()
        {
            if (instance == null)
            {
                instance = new CookiePreferenceUnmarshaller();
            }

            return(instance);
        }
        public ForwardedValues Unmarshall(XmlUnmarshallerContext context)
        {
            ForwardedValues forwardedValues = new ForwardedValues();
            int             originalDepth   = context.CurrentDepth;
            int             targetDepth     = originalDepth + 1;

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

            while (context.Read())
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("QueryString", targetDepth))
                    {
                        forwardedValues.QueryString = BoolUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("Cookies", targetDepth))
                    {
                        forwardedValues.Cookies = CookiePreferenceUnmarshaller.GetInstance().Unmarshall(context);

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



            return(forwardedValues);
        }