コード例 #1
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context)
        {
            CancelResizeResponse response = new CancelResizeResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.IsStartElement)
                {
                    if (context.TestExpression("CancelResizeResult", 2))
                    {
                        UnmarshallResult(context, response);
                        continue;
                    }

                    if (context.TestExpression("ResponseMetadata", 2))
                    {
                        response.ResponseMetadata = ResponseMetadataUnmarshaller.Instance.Unmarshall(context);
                    }
                }
            }

            return(response);
        }
コード例 #2
0
        private static void UnmarshallResult(XmlUnmarshallerContext context, CancelResizeResponse response)
        {
            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("AvgResizeRateInMegaBytesPerSecond", targetDepth))
                    {
                        var unmarshaller = DoubleUnmarshaller.Instance;
                        response.AvgResizeRateInMegaBytesPerSecond = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("DataTransferProgressPercent", targetDepth))
                    {
                        var unmarshaller = DoubleUnmarshaller.Instance;
                        response.DataTransferProgressPercent = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("ElapsedTimeInSeconds", targetDepth))
                    {
                        var unmarshaller = LongUnmarshaller.Instance;
                        response.ElapsedTimeInSeconds = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("EstimatedTimeToCompletionInSeconds", targetDepth))
                    {
                        var unmarshaller = LongUnmarshaller.Instance;
                        response.EstimatedTimeToCompletionInSeconds = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("ImportTablesCompleted/member", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        var item         = unmarshaller.Unmarshall(context);
                        response.ImportTablesCompleted.Add(item);
                        continue;
                    }
                    if (context.TestExpression("ImportTablesInProgress/member", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        var item         = unmarshaller.Unmarshall(context);
                        response.ImportTablesInProgress.Add(item);
                        continue;
                    }
                    if (context.TestExpression("ImportTablesNotStarted/member", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        var item         = unmarshaller.Unmarshall(context);
                        response.ImportTablesNotStarted.Add(item);
                        continue;
                    }
                    if (context.TestExpression("Message", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.Message = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("ProgressInMegaBytes", targetDepth))
                    {
                        var unmarshaller = LongUnmarshaller.Instance;
                        response.ProgressInMegaBytes = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("ResizeType", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.ResizeType = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("Status", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.Status = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("TargetClusterType", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.TargetClusterType = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("TargetEncryptionType", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.TargetEncryptionType = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("TargetNodeType", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.TargetNodeType = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("TargetNumberOfNodes", targetDepth))
                    {
                        var unmarshaller = IntUnmarshaller.Instance;
                        response.TargetNumberOfNodes = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("TotalResizeDataInMegaBytes", targetDepth))
                    {
                        var unmarshaller = LongUnmarshaller.Instance;
                        response.TotalResizeDataInMegaBytes = unmarshaller.Unmarshall(context);
                        continue;
                    }
                }
            }

            return;
        }