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

            return(instance);
        }
示例#2
0
        public DistributionList Unmarshall(XmlUnmarshallerContext context)
        {
            DistributionList distributionList = new DistributionList();
            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

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

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

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

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

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

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

                        continue;
                    }
                    if (context.TestExpression("Items/DistributionSummary", targetDepth))
                    {
                        distributionList.Items.Add(DistributionSummaryUnmarshaller.GetInstance().Unmarshall(context));

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



            return(distributionList);
        }