public static ForwardedValuesUnmarshaller GetInstance() { if (instance == null) { instance = new ForwardedValuesUnmarshaller(); } return(instance); }
public DefaultCacheBehavior Unmarshall(XmlUnmarshallerContext context) { DefaultCacheBehavior defaultCacheBehavior = new DefaultCacheBehavior(); int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; if (context.IsStartOfDocument) { targetDepth += 2; } while (context.Read()) { if (context.IsStartElement || context.IsAttribute) { if (context.TestExpression("TargetOriginId", targetDepth)) { defaultCacheBehavior.TargetOriginId = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("ForwardedValues", targetDepth)) { defaultCacheBehavior.ForwardedValues = ForwardedValuesUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("TrustedSigners", targetDepth)) { defaultCacheBehavior.TrustedSigners = TrustedSignersUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("ViewerProtocolPolicy", targetDepth)) { defaultCacheBehavior.ViewerProtocolPolicy = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("MinTTL", targetDepth)) { defaultCacheBehavior.MinTTL = LongUnmarshaller.GetInstance().Unmarshall(context); continue; } } else if (context.IsEndElement && context.CurrentDepth < originalDepth) { return(defaultCacheBehavior); } } return(defaultCacheBehavior); }
public CacheBehavior Unmarshall(XmlUnmarshallerContext context) { CacheBehavior cacheBehavior = new CacheBehavior(); int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; if (context.IsStartOfDocument) { targetDepth += 2; } while (context.Read()) { if (context.IsStartElement || context.IsAttribute) { if (context.TestExpression("PathPattern", targetDepth)) { cacheBehavior.PathPattern = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("TargetOriginId", targetDepth)) { cacheBehavior.TargetOriginId = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("ForwardedValues", targetDepth)) { cacheBehavior.ForwardedValues = ForwardedValuesUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("TrustedSigners", targetDepth)) { cacheBehavior.TrustedSigners = TrustedSignersUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("ViewerProtocolPolicy", targetDepth)) { cacheBehavior.ViewerProtocolPolicy = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("MinTTL", targetDepth)) { cacheBehavior.MinTTL = LongUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("AllowedMethods", targetDepth)) { cacheBehavior.AllowedMethods = AllowedMethodsUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("SmoothStreaming", targetDepth)) { cacheBehavior.SmoothStreaming = BoolUnmarshaller.GetInstance().Unmarshall(context); continue; } } else if (context.IsEndElement && context.CurrentDepth < originalDepth) { return(cacheBehavior); } } return(cacheBehavior); }