Esempio n. 1
0
        public static Group FromRPCModel(this SGGroup rpcGroup)
        {
            var group = new Group();

            group.Id             = rpcGroup.Id;
            group.AvatarUrl      = rpcGroup.AvatarUrl;
            group.CreatedAt      = rpcGroup.CreatedAt;
            group.Description    = new LocalizableText(rpcGroup.GroupDescription).LocalizedValue();
            group.FollowersCount = rpcGroup.FollowersCount;
            group.IsFollowedByMe = rpcGroup.IsFollower;
            group.MembersCount   = rpcGroup.MembersCount;
            group.Membership     = rpcGroup.Membership.FromRPCModel();
            group.Settings       = rpcGroup.Settings.FromRPC();
            group.Title          = new LocalizableText(rpcGroup.Title).LocalizedValue();
            group.UpdatedAt      = rpcGroup.UpdatedAt;
            return(group);
        }
        public void Read(TProtocol iprot)
        {
            iprot.IncrementRecursionDepth();
            try
            {
                TField field;
                iprot.ReadStructBegin();
                while (true)
                {
                    field = iprot.ReadFieldBegin();
                    if (field.Type == TType.Stop)
                    {
                        break;
                    }
                    switch (field.ID)
                    {
                    case 1:
                        if (field.Type == TType.Struct)
                        {
                            Group = new SGGroup();
                            Group.Read(iprot);
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    default:
                        TProtocolUtil.Skip(iprot, field.Type);
                        break;
                    }
                    iprot.ReadFieldEnd();
                }
                iprot.ReadStructEnd();
            }
            finally
            {
                iprot.DecrementRecursionDepth();
            }
        }
Esempio n. 3
0
        public void Read(TProtocol iprot)
        {
            iprot.IncrementRecursionDepth();
            try
            {
                TField field;
                iprot.ReadStructBegin();
                while (true)
                {
                    field = iprot.ReadFieldBegin();
                    if (field.Type == TType.Stop)
                    {
                        break;
                    }
                    switch (field.ID)
                    {
                    case 1:
                        if (field.Type == TType.List)
                        {
                            {
                                Groups = new List <SGGroup>();
                                TList _list127 = iprot.ReadListBegin();
                                for (int _i128 = 0; _i128 < _list127.Count; ++_i128)
                                {
                                    SGGroup _elem129;
                                    _elem129 = new SGGroup();
                                    _elem129.Read(iprot);
                                    Groups.Add(_elem129);
                                }
                                iprot.ReadListEnd();
                            }
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 2:
                        if (field.Type == TType.I32)
                        {
                            TotalNumber = iprot.ReadI32();
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 3:
                        if (field.Type == TType.String)
                        {
                            NextCursor = iprot.ReadString();
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    default:
                        TProtocolUtil.Skip(iprot, field.Type);
                        break;
                    }
                    iprot.ReadFieldEnd();
                }
                iprot.ReadStructEnd();
            }
            finally
            {
                iprot.DecrementRecursionDepth();
            }
        }