public Record Unmarshall(JsonUnmarshallerContext context) { context.Read(); if (context.CurrentTokenType == JsonToken.Null) { return(null); } Record record = new Record(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("SequenceNumber", targetDepth)) { record.SequenceNumber = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Data", targetDepth)) { record.Data = MemoryStreamUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("PartitionKey", targetDepth)) { record.PartitionKey = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } } return(record); }
public VirtualMFADevice Unmarshall(XmlUnmarshallerContext context) { VirtualMFADevice virtualMFADevice = new VirtualMFADevice(); int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; if (context.IsStartOfDocument) { targetDepth += 2; } while (context.Read()) { if (context.IsStartElement || context.IsAttribute) { if (context.TestExpression("SerialNumber", targetDepth)) { virtualMFADevice.SerialNumber = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Base32StringSeed", targetDepth)) { virtualMFADevice.Base32StringSeed = MemoryStreamUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("QRCodePNG", targetDepth)) { virtualMFADevice.QRCodePNG = MemoryStreamUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("User", targetDepth)) { virtualMFADevice.User = UserUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("EnableDate", targetDepth)) { virtualMFADevice.EnableDate = DateTimeUnmarshaller.GetInstance().Unmarshall(context); continue; } } else if (context.IsEndElement && context.CurrentDepth < originalDepth) { return(virtualMFADevice); } } return(virtualMFADevice); }
public MessageAttributeValue Unmarshall(XmlUnmarshallerContext context) { MessageAttributeValue unmarshalledObject = new MessageAttributeValue(); int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; if (context.IsStartOfDocument) { targetDepth += 2; } while (context.ReadAtDepth(originalDepth)) { if (context.IsStartElement || context.IsAttribute) { if (context.TestExpression("BinaryListValues/BinaryListValue", targetDepth)) { var unmarshaller = MemoryStreamUnmarshaller.GetInstance(); var item = unmarshaller.Unmarshall(context); unmarshalledObject.BinaryListValues.Add(item); continue; } if (context.TestExpression("BinaryValue", targetDepth)) { var unmarshaller = MemoryStreamUnmarshaller.GetInstance(); unmarshalledObject.BinaryValue = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("DataType", targetDepth)) { var unmarshaller = StringUnmarshaller.GetInstance(); unmarshalledObject.DataType = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("StringListValues/StringListValue", targetDepth)) { var unmarshaller = StringUnmarshaller.GetInstance(); var item = unmarshaller.Unmarshall(context); unmarshalledObject.StringListValues.Add(item); continue; } if (context.TestExpression("StringValue", targetDepth)) { var unmarshaller = StringUnmarshaller.GetInstance(); unmarshalledObject.StringValue = unmarshaller.Unmarshall(context); continue; } } else if (context.IsEndElement && context.CurrentDepth < originalDepth) { return(unmarshalledObject); } } return(unmarshalledObject); }
public AttributeValue Unmarshall(JsonUnmarshallerContext context) { AttributeValue attributeValue = new AttributeValue(); attributeValue.SS = null; attributeValue.NS = null; attributeValue.BS = 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("S", targetDepth)) { attributeValue.S = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("N", targetDepth)) { attributeValue.N = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("B", targetDepth)) { attributeValue.B = MemoryStreamUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("SS", targetDepth)) { attributeValue.SS = new List <String>(); StringUnmarshaller unmarshaller = StringUnmarshaller.GetInstance(); while (context.Read()) { if ((context.IsArrayElement) && (context.CurrentDepth == targetDepth)) { attributeValue.SS.Add(unmarshaller.Unmarshall(context)); } else if (context.IsEndArray) { break; } } continue; } if (context.TestExpression("NS", targetDepth)) { attributeValue.NS = new List <String>(); StringUnmarshaller unmarshaller = StringUnmarshaller.GetInstance(); while (context.Read()) { if ((context.IsArrayElement) && (context.CurrentDepth == targetDepth)) { attributeValue.NS.Add(unmarshaller.Unmarshall(context)); } else if (context.IsEndArray) { break; } } continue; } if (context.TestExpression("BS", targetDepth)) { attributeValue.BS = new List <MemoryStream>(); MemoryStreamUnmarshaller unmarshaller = MemoryStreamUnmarshaller.GetInstance(); while (context.Read()) { if ((context.IsArrayElement) && (context.CurrentDepth == targetDepth)) { attributeValue.BS.Add(unmarshaller.Unmarshall(context)); } else if (context.IsEndArray) { break; } } continue; } } else if (context.IsEndElement && context.CurrentDepth <= originalDepth) { return(attributeValue); } } return(attributeValue); }
public AttributeValue Unmarshall(JsonUnmarshallerContext context) { if (context.CurrentTokenType == JsonToken.Null) { return(null); } AttributeValue attributeValue = new AttributeValue(); int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; while (context.Read()) { if (context.TestExpression("S", targetDepth)) { context.Read(); attributeValue.S = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("N", targetDepth)) { context.Read(); attributeValue.N = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("B", targetDepth)) { context.Read(); attributeValue.B = MemoryStreamUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("SS", targetDepth)) { context.Read(); attributeValue.SS = new List <String>(); if (context.CurrentTokenType == JsonToken.Null) { continue; } StringUnmarshaller unmarshaller = StringUnmarshaller.GetInstance(); while (context.Read()) { JsonToken token = context.CurrentTokenType; if (token == JsonToken.ArrayStart) { continue; } if (token == JsonToken.ArrayEnd) { break; } attributeValue.SS.Add(unmarshaller.Unmarshall(context)); } continue; } if (context.TestExpression("NS", targetDepth)) { context.Read(); attributeValue.NS = new List <String>(); if (context.CurrentTokenType == JsonToken.Null) { continue; } StringUnmarshaller unmarshaller = StringUnmarshaller.GetInstance(); while (context.Read()) { JsonToken token = context.CurrentTokenType; if (token == JsonToken.ArrayStart) { continue; } if (token == JsonToken.ArrayEnd) { break; } attributeValue.NS.Add(unmarshaller.Unmarshall(context)); } continue; } if (context.TestExpression("BS", targetDepth)) { context.Read(); attributeValue.BS = new List <MemoryStream>(); if (context.CurrentTokenType == JsonToken.Null) { continue; } MemoryStreamUnmarshaller unmarshaller = MemoryStreamUnmarshaller.GetInstance(); while (context.Read()) { JsonToken token = context.CurrentTokenType; if (token == JsonToken.ArrayStart) { continue; } if (token == JsonToken.ArrayEnd) { break; } attributeValue.BS.Add(unmarshaller.Unmarshall(context)); } continue; } if (context.CurrentDepth <= originalDepth) { return(attributeValue); } } return(attributeValue); }
public AttributeValue Unmarshall(JsonUnmarshallerContext context) { context.Read(); if (context.CurrentTokenType == JsonToken.Null) { return(null); } AttributeValue attributeValue = new AttributeValue(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("S", targetDepth)) { attributeValue.S = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("N", targetDepth)) { attributeValue.N = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("B", targetDepth)) { attributeValue.B = MemoryStreamUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("SS", targetDepth)) { var unmarshaller = new ListUnmarshaller <String, StringUnmarshaller>( StringUnmarshaller.GetInstance()); attributeValue.SS = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("NS", targetDepth)) { var unmarshaller = new ListUnmarshaller <String, StringUnmarshaller>( StringUnmarshaller.GetInstance()); attributeValue.NS = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("BS", targetDepth)) { var unmarshaller = new ListUnmarshaller <MemoryStream, MemoryStreamUnmarshaller>( MemoryStreamUnmarshaller.GetInstance()); attributeValue.BS = unmarshaller.Unmarshall(context); continue; } } return(attributeValue); }