public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { ListPartsResponse response = new ListPartsResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("MultipartUploadId", targetDepth)) { response.MultipartUploadId = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("VaultARN", targetDepth)) { response.VaultARN = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("ArchiveDescription", targetDepth)) { response.ArchiveDescription = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("PartSizeInBytes", targetDepth)) { response.PartSizeInBytes = LongUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("CreationDate", targetDepth)) { response.CreationDate = DateTimeUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Parts", targetDepth)) { var unmarshaller = new ListUnmarshaller <PartListElement, PartListElementUnmarshaller>( PartListElementUnmarshaller.GetInstance()); response.Parts = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("Marker", targetDepth)) { response.Marker = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } } return(response); }
private static void UnmarshallResult(JsonUnmarshallerContext context, ListPartsResponse response) { int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; while (context.Read()) { if (context.TestExpression("MultipartUploadId", targetDepth)) { context.Read(); response.MultipartUploadId = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("VaultARN", targetDepth)) { context.Read(); response.VaultARN = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("ArchiveDescription", targetDepth)) { context.Read(); response.ArchiveDescription = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("PartSizeInBytes", targetDepth)) { context.Read(); response.PartSizeInBytes = LongUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("CreationDate", targetDepth)) { context.Read(); response.CreationDate = DateTimeUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Parts", targetDepth)) { context.Read(); if (context.CurrentTokenType == JsonToken.Null) { response.Parts = null; continue; } response.Parts = new List <PartListElement>(); PartListElementUnmarshaller unmarshaller = PartListElementUnmarshaller.GetInstance(); while (context.Read()) { JsonToken token = context.CurrentTokenType; if (token == JsonToken.ArrayStart) { continue; } if (token == JsonToken.ArrayEnd) { break; } response.Parts.Add(unmarshaller.Unmarshall(context)); } continue; } if (context.TestExpression("Marker", targetDepth)) { context.Read(); response.Marker = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.CurrentDepth <= originalDepth) { return; } } return; }
public ListPartsResult Unmarshall(JsonUnmarshallerContext context) { ListPartsResult listPartsResult = new ListPartsResult(); listPartsResult.Parts = null; int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; while (context.Read()) { if ((context.IsKey) && (context.CurrentDepth == targetDepth)) { context.Read(); context.Read(); if (context.TestExpression("MultipartUploadId", targetDepth)) { listPartsResult.MultipartUploadId = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("VaultARN", targetDepth)) { listPartsResult.VaultARN = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("ArchiveDescription", targetDepth)) { listPartsResult.ArchiveDescription = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("PartSizeInBytes", targetDepth)) { listPartsResult.PartSizeInBytes = LongUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("CreationDate", targetDepth)) { listPartsResult.CreationDate = DateTimeUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Parts", targetDepth)) { listPartsResult.Parts = new List <PartListElement>(); PartListElementUnmarshaller unmarshaller = PartListElementUnmarshaller.GetInstance(); while (context.Read()) { if ((context.IsArrayElement) && (context.CurrentDepth == targetDepth)) { listPartsResult.Parts.Add(unmarshaller.Unmarshall(context)); } else if (context.IsEndArray) { break; } } continue; } if (context.TestExpression("Marker", targetDepth)) { listPartsResult.Marker = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } } else if (context.IsEndElement && context.CurrentDepth <= originalDepth) { return(listPartsResult); } } return(listPartsResult); }