コード例 #1
0
        public CreateGroupResult Unmarshall(UnmarshallerContext context)
        {
            CreateGroupResult createGroupResult = new CreateGroupResult();
            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))
                    {
                        createGroupResult.Group = GroupUnmarshaller.GetInstance().Unmarshall(context);

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

            return(createGroupResult);
        }
コード例 #2
0
        public static GroupUnmarshaller GetInstance()
        {
            if (instance == null)
            {
                instance = new GroupUnmarshaller();
            }

            return(instance);
        }
コード例 #3
0
        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);
        }