public History Unmarshall(JsonUnmarshallerContext context) { if (context.CurrentTokenType == JsonToken.Null) { return(null); } History history = new History(); int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; while (context.Read()) { if (context.TestExpression("events", targetDepth)) { context.Read(); history.Events = new List <HistoryEvent>(); HistoryEventUnmarshaller unmarshaller = HistoryEventUnmarshaller.GetInstance(); while (context.Read()) { JsonToken token = context.CurrentTokenType; if (token == JsonToken.ArrayStart) { continue; } if (token == JsonToken.ArrayEnd) { break; } history.Events.Add(unmarshaller.Unmarshall(context)); } continue; } if (context.TestExpression("nextPageToken", targetDepth)) { context.Read(); history.NextPageToken = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.CurrentDepth <= originalDepth) { return(history); } } return(history); }
public History Unmarshall(JsonUnmarshallerContext context) { History history = new History(); history.Events = 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("Events", targetDepth)) { history.Events = new List <HistoryEvent>(); HistoryEventUnmarshaller unmarshaller = HistoryEventUnmarshaller.GetInstance(); while (context.Read()) { if ((context.IsArrayElement) && (context.CurrentDepth == targetDepth)) { history.Events.Add(unmarshaller.Unmarshall(context)); } else if (context.IsEndArray) { break; } } continue; } if (context.TestExpression("NextPageToken", targetDepth)) { history.NextPageToken = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } } else if (context.IsEndElement && context.CurrentDepth <= originalDepth) { return(history); } } return(history); }
public DecisionTask Unmarshall(JsonUnmarshallerContext context) { DecisionTask decisionTask = new DecisionTask(); decisionTask.Events = 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("TaskToken", targetDepth)) { decisionTask.TaskToken = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("StartedEventId", targetDepth)) { decisionTask.StartedEventId = LongUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("WorkflowExecution", targetDepth)) { decisionTask.WorkflowExecution = WorkflowExecutionUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("WorkflowType", targetDepth)) { decisionTask.WorkflowType = WorkflowTypeUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Events", targetDepth)) { decisionTask.Events = new List <HistoryEvent>(); HistoryEventUnmarshaller unmarshaller = HistoryEventUnmarshaller.GetInstance(); while (context.Read()) { if ((context.IsArrayElement) && (context.CurrentDepth == targetDepth)) { decisionTask.Events.Add(unmarshaller.Unmarshall(context)); } else if (context.IsEndArray) { break; } } continue; } if (context.TestExpression("NextPageToken", targetDepth)) { decisionTask.NextPageToken = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("PreviousStartedEventId", targetDepth)) { decisionTask.PreviousStartedEventId = LongUnmarshaller.GetInstance().Unmarshall(context); continue; } } else if (context.IsEndElement && context.CurrentDepth <= originalDepth) { return(decisionTask); } } return(decisionTask); }
public DecisionTask Unmarshall(JsonUnmarshallerContext context) { if (context.CurrentTokenType == JsonToken.Null) { return(null); } DecisionTask decisionTask = new DecisionTask(); int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; while (context.Read()) { if (context.TestExpression("taskToken", targetDepth)) { context.Read(); decisionTask.TaskToken = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("startedEventId", targetDepth)) { context.Read(); decisionTask.StartedEventId = LongUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("workflowExecution", targetDepth)) { context.Read(); decisionTask.WorkflowExecution = WorkflowExecutionUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("workflowType", targetDepth)) { context.Read(); decisionTask.WorkflowType = WorkflowTypeUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("events", targetDepth)) { context.Read(); decisionTask.Events = new List <HistoryEvent>(); HistoryEventUnmarshaller unmarshaller = HistoryEventUnmarshaller.GetInstance(); while (context.Read()) { JsonToken token = context.CurrentTokenType; if (token == JsonToken.ArrayStart) { continue; } if (token == JsonToken.ArrayEnd) { break; } decisionTask.Events.Add(unmarshaller.Unmarshall(context)); } continue; } if (context.TestExpression("nextPageToken", targetDepth)) { context.Read(); decisionTask.NextPageToken = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("previousStartedEventId", targetDepth)) { context.Read(); decisionTask.PreviousStartedEventId = LongUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.CurrentDepth <= originalDepth) { return(decisionTask); } } return(decisionTask); }