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

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

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

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

                        continue;
                    }
                    if (context.TestExpression("StackName", targetDepth))
                    {
                        stack.StackName = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("Description", targetDepth))
                    {
                        stack.Description = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("Parameters/member", targetDepth))
                    {
                        stack.Parameters.Add(ParameterUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                    if (context.TestExpression("CreationTime", targetDepth))
                    {
                        stack.CreationTime = DateTimeUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("LastUpdatedTime", targetDepth))
                    {
                        stack.LastUpdatedTime = DateTimeUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("StackStatus", targetDepth))
                    {
                        stack.StackStatus = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("StackStatusReason", targetDepth))
                    {
                        stack.StackStatusReason = StringUnmarshaller.GetInstance().Unmarshall(context);

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

                        continue;
                    }
                    if (context.TestExpression("NotificationARNs/member", targetDepth))
                    {
                        stack.NotificationARNs.Add(StringUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                    if (context.TestExpression("TimeoutInMinutes", targetDepth))
                    {
                        stack.TimeoutInMinutes = IntUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("Capabilities/member", targetDepth))
                    {
                        stack.Capabilities.Add(StringUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                    if (context.TestExpression("Outputs/member", targetDepth))
                    {
                        stack.Outputs.Add(OutputUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                    if (context.TestExpression("Tags/member", targetDepth))
                    {
                        stack.Tags.Add(TagUnmarshaller.GetInstance().Unmarshall(context));

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



            return(stack);
        }