Exemplo n.º 1
0
        public static ImportInstanceTaskDetailsUnmarshaller GetInstance()
        {
            if (instance == null)
            {
                instance = new ImportInstanceTaskDetailsUnmarshaller();
            }

            return(instance);
        }
        public ConversionTask Unmarshall(XmlUnmarshallerContext context)
        {
            ConversionTask conversionTask = new ConversionTask();
            int            originalDepth  = context.CurrentDepth;
            int            targetDepth    = originalDepth + 1;

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

            while (context.Read())
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("conversionTaskId", targetDepth))
                    {
                        conversionTask.ConversionTaskId = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("expirationTime", targetDepth))
                    {
                        conversionTask.ExpirationTime = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("importInstance", targetDepth))
                    {
                        conversionTask.ImportInstance = ImportInstanceTaskDetailsUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("importVolume", targetDepth))
                    {
                        conversionTask.ImportVolume = ImportVolumeTaskDetailsUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("state", targetDepth))
                    {
                        conversionTask.State = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("statusMessage", targetDepth))
                    {
                        conversionTask.StatusMessage = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("tagSet/item", targetDepth))
                    {
                        conversionTask.Tags.Add(TagUnmarshaller.GetInstance().Unmarshall(context));

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



            return(conversionTask);
        }