示例#1
0
        public static SolutionStackDescriptionUnmarshaller GetInstance()
        {
            if (instance == null)
            {
                instance = new SolutionStackDescriptionUnmarshaller();
            }

            return(instance);
        }
        public ListAvailableSolutionStacksResult Unmarshall(UnmarshallerContext context)
        {
            ListAvailableSolutionStacksResult listAvailableSolutionStacksResult = new ListAvailableSolutionStacksResult();
            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

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

            while (context.Read())
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("SolutionStacks/member", targetDepth))
                    {
                        listAvailableSolutionStacksResult.SolutionStacks.Add(StringUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                    if (context.TestExpression("SolutionStackDetails/member", targetDepth))
                    {
                        listAvailableSolutionStacksResult.SolutionStackDetails.Add(SolutionStackDescriptionUnmarshaller.GetInstance().Unmarshall(context));

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

            return(listAvailableSolutionStacksResult);
        }