コード例 #1
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.Struct)
                        {
                            Activity = new AFActivity();
                            Activity.Read(iprot);
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    default:
                        TProtocolUtil.Skip(iprot, field.Type);
                        break;
                    }
                    iprot.ReadFieldEnd();
                }
                iprot.ReadStructEnd();
            }
            finally
            {
                iprot.DecrementRecursionDepth();
            }
        }
コード例 #2
0
        public static Activity FromRPCModel(this AFActivity activity, THPublicUser user = null, AFEntityReference source = null)
        {
            var content = activity.Content.FirstValue(new AFContent());

            return(new Activity
            {
                Id = activity.Id,
                Type = activity.ContentType,
                Announcement = activity.IsAnnouncement,
                Button = content.Button.FromRPCModel(),
                Author = activity.Author.FromRPCModel(user),
                Properties = activity.Properties ?? new Dictionary <string, string>(),
                CreatedAt = activity.CreatedAt,
                ViewCount = activity.Reactions.ViewCount,
                CommentsCount = activity.Reactions.CommentCount,
                MediaAttachments = (content.Attachments ?? new List <AFAttachment>()).ConvertAll(FromRpc),
                Text = content.Text,
                ReactionsCount = activity.Reactions.ReactionCount,
                MyReactionsList = activity.Reactions.MyReactions ?? new List <string>(),
                Mentions = activity.Mentions.FirstValue(new List <AFMention>()).ConvertAll(FromRPCModel),
                Source = (source ?? activity.Source).FromRPCModel(),
                Status = activity.Status ?? ""
            });
        }
コード例 #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.Struct)
                        {
                            Activity = new AFActivity();
                            Activity.Read(iprot);
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

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

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

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

                    case 5:
                        if (field.Type == TType.I64)
                        {
                            DeletedAt = iprot.ReadI64();
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    default:
                        TProtocolUtil.Skip(iprot, field.Type);
                        break;
                    }
                    iprot.ReadFieldEnd();
                }
                iprot.ReadStructEnd();
            }
            finally
            {
                iprot.DecrementRecursionDepth();
            }
        }
コード例 #4
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)
                        {
                            {
                                Data = new List <AFActivity>();
                                TList _list71 = iprot.ReadListBegin();
                                for (int _i72 = 0; _i72 < _list71.Count; ++_i72)
                                {
                                    AFActivity _elem73;
                                    _elem73 = new AFActivity();
                                    _elem73.Read(iprot);
                                    Data.Add(_elem73);
                                }
                                iprot.ReadListEnd();
                            }
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 2:
                        if (field.Type == TType.List)
                        {
                            {
                                EntityDetails = new List <AFEntityReference>();
                                TList _list74 = iprot.ReadListBegin();
                                for (int _i75 = 0; _i75 < _list74.Count; ++_i75)
                                {
                                    AFEntityReference _elem76;
                                    _elem76 = new AFEntityReference();
                                    _elem76.Read(iprot);
                                    EntityDetails.Add(_elem76);
                                }
                                iprot.ReadListEnd();
                            }
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 3:
                        if (field.Type == TType.Map)
                        {
                            {
                                Authors = new Dictionary <string, THPublicUser>();
                                TMap _map77 = iprot.ReadMapBegin();
                                for (int _i78 = 0; _i78 < _map77.Count; ++_i78)
                                {
                                    string       _key79;
                                    THPublicUser _val80;
                                    _key79 = iprot.ReadString();
                                    _val80 = new THPublicUser();
                                    _val80.Read(iprot);
                                    Authors[_key79] = _val80;
                                }
                                iprot.ReadMapEnd();
                            }
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 4:
                        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();
            }
        }
コード例 #5
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)
                        {
                            {
                                Data = new List <AFActivity>();
                                TList _list105 = iprot.ReadListBegin();
                                for (int _i106 = 0; _i106 < _list105.Count; ++_i106)
                                {
                                    AFActivity _elem107;
                                    _elem107 = new AFActivity();
                                    _elem107.Read(iprot);
                                    Data.Add(_elem107);
                                }
                                iprot.ReadListEnd();
                            }
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 2:
                        if (field.Type == TType.List)
                        {
                            {
                                EntityDetails = new List <AFEntityReference>();
                                TList _list108 = iprot.ReadListBegin();
                                for (int _i109 = 0; _i109 < _list108.Count; ++_i109)
                                {
                                    AFEntityReference _elem110;
                                    _elem110 = new AFEntityReference();
                                    _elem110.Read(iprot);
                                    EntityDetails.Add(_elem110);
                                }
                                iprot.ReadListEnd();
                            }
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 3:
                        if (field.Type == TType.Map)
                        {
                            {
                                Authors = new Dictionary <string, THPublicUser>();
                                TMap _map111 = iprot.ReadMapBegin();
                                for (int _i112 = 0; _i112 < _map111.Count; ++_i112)
                                {
                                    string       _key113;
                                    THPublicUser _val114;
                                    _key113 = iprot.ReadString();
                                    _val114 = new THPublicUser();
                                    _val114.Read(iprot);
                                    Authors[_key113] = _val114;
                                }
                                iprot.ReadMapEnd();
                            }
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 4:
                        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();
            }
        }