Пример #1
0
        public DistributionSummary Unmarshall(XmlUnmarshallerContext context)
        {
            DistributionSummary distributionSummary = new DistributionSummary();
            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

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

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

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

                        continue;
                    }
                    if (context.TestExpression("LastModifiedTime", targetDepth))
                    {
                        distributionSummary.LastModifiedTime = DateTimeUnmarshaller.GetInstance().Unmarshall(context);

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

                        continue;
                    }
                    if (context.TestExpression("Aliases", targetDepth))
                    {
                        distributionSummary.Aliases = AliasesUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("Origins", targetDepth))
                    {
                        distributionSummary.Origins = OriginsUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("DefaultCacheBehavior", targetDepth))
                    {
                        distributionSummary.DefaultCacheBehavior = DefaultCacheBehaviorUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("CacheBehaviors", targetDepth))
                    {
                        distributionSummary.CacheBehaviors = CacheBehaviorsUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("CustomErrorResponses", targetDepth))
                    {
                        distributionSummary.CustomErrorResponses = CustomErrorResponsesUnmarshaller.GetInstance().Unmarshall(context);

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

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

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

                        continue;
                    }
                    if (context.TestExpression("ViewerCertificate", targetDepth))
                    {
                        distributionSummary.ViewerCertificate = ViewerCertificateUnmarshaller.GetInstance().Unmarshall(context);

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



            return(distributionSummary);
        }
Пример #2
0
        public DistributionConfig Unmarshall(XmlUnmarshallerContext context)
        {
            DistributionConfig distributionConfig = new DistributionConfig();
            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

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

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

                        continue;
                    }
                    if (context.TestExpression("Aliases", targetDepth))
                    {
                        distributionConfig.Aliases = AliasesUnmarshaller.GetInstance().Unmarshall(context);

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

                        continue;
                    }
                    if (context.TestExpression("Origins", targetDepth))
                    {
                        distributionConfig.Origins = OriginsUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("DefaultCacheBehavior", targetDepth))
                    {
                        distributionConfig.DefaultCacheBehavior = DefaultCacheBehaviorUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("CacheBehaviors", targetDepth))
                    {
                        distributionConfig.CacheBehaviors = CacheBehaviorsUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("CustomErrorResponses", targetDepth))
                    {
                        distributionConfig.CustomErrorResponses = CustomErrorResponsesUnmarshaller.GetInstance().Unmarshall(context);

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

                        continue;
                    }
                    if (context.TestExpression("Logging", targetDepth))
                    {
                        distributionConfig.Logging = LoggingConfigUnmarshaller.GetInstance().Unmarshall(context);

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

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

                        continue;
                    }
                    if (context.TestExpression("ViewerCertificate", targetDepth))
                    {
                        distributionConfig.ViewerCertificate = ViewerCertificateUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("Restrictions", targetDepth))
                    {
                        distributionConfig.Restrictions = RestrictionsUnmarshaller.GetInstance().Unmarshall(context);

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



            return(distributionConfig);
        }