Example #1
0
        public CreateUserResult Unmarshall(UnmarshallerContext context)
        {
            CreateUserResult createUserResult = new CreateUserResult();
            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

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

            while (context.Read())
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("User", targetDepth))
                    {
                        createUserResult.User = UserUnmarshaller.GetInstance().Unmarshall(context);

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

            return(createUserResult);
        }
Example #2
0
        public static UserUnmarshaller GetInstance()
        {
            if (instance == null)
            {
                instance = new UserUnmarshaller();
            }

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

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

            while (context.Read())
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("Group", targetDepth))
                    {
                        getGroupResult.Group = GroupUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("Users/member", targetDepth))
                    {
                        getGroupResult.Users.Add(UserUnmarshaller.GetInstance().Unmarshall(context));

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

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

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

            return(getGroupResult);
        }