Ejemplo n.º 1
0
        public static StreamingLoggingConfigUnmarshaller GetInstance()
        {
            if (instance == null)
            {
                instance = new StreamingLoggingConfigUnmarshaller();
            }

            return(instance);
        }
        public StreamingDistributionConfig Unmarshall(XmlUnmarshallerContext context)
        {
            StreamingDistributionConfig streamingDistributionConfig = new StreamingDistributionConfig();
            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))
                    {
                        streamingDistributionConfig.CallerReference = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("S3Origin", targetDepth))
                    {
                        streamingDistributionConfig.S3Origin = S3OriginUnmarshaller.GetInstance().Unmarshall(context);

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

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

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

                        continue;
                    }
                    if (context.TestExpression("TrustedSigners", targetDepth))
                    {
                        streamingDistributionConfig.TrustedSigners = TrustedSignersUnmarshaller.GetInstance().Unmarshall(context);

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

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

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



            return(streamingDistributionConfig);
        }