Пример #1
0
        public static JobUnmarshaller GetInstance()
        {
            if (instance == null)
            {
                instance = new JobUnmarshaller();
            }

            return(instance);
        }
Пример #2
0
        public ListJobsResult Unmarshall(UnmarshallerContext context)
        {
            ListJobsResult listJobsResult = new ListJobsResult();
            int            originalDepth  = context.CurrentDepth;
            int            targetDepth    = originalDepth + 1;

            if (context.IsStartOfDocument)
            {
                targetDepth += 2;
            }

            while (context.Read())
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("Jobs/member", targetDepth))
                    {
                        listJobsResult.Jobs.Add(JobUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                    if (context.TestExpression("IsTruncated", targetDepth))
                    {
                        listJobsResult.IsTruncated = BoolUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth < originalDepth)
                {
                    return(listJobsResult);
                }
            }

            return(listJobsResult);
        }