public static UserIdGroupPairUnmarshaller GetInstance() { if (instance == null) { instance = new UserIdGroupPairUnmarshaller(); } return(instance); }
public IpPermission Unmarshall(XmlUnmarshallerContext context) { IpPermission ipPermission = new IpPermission(); int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; if (context.IsStartOfDocument) { targetDepth += 1; } while (context.Read()) { if (context.IsStartElement || context.IsAttribute) { if (context.TestExpression("ipProtocol", targetDepth)) { ipPermission.IpProtocol = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("fromPort", targetDepth)) { ipPermission.FromPort = IntUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("toPort", targetDepth)) { ipPermission.ToPort = IntUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("groups/item", targetDepth)) { ipPermission.UserIdGroupPairs.Add(UserIdGroupPairUnmarshaller.GetInstance().Unmarshall(context)); continue; } if (context.TestExpression("ipRanges/item/cidrIp", targetDepth)) { ipPermission.IpRanges.Add(StringUnmarshaller.GetInstance().Unmarshall(context)); continue; } } else if (context.IsEndElement && context.CurrentDepth < originalDepth) { return(ipPermission); } } return(ipPermission); }