Exemple #1
0
 public static Mention FromRPCModel(this AFMention mention)
 {
     return(new Mention {
         UserId = mention.UserId, StartIndex = mention.StartIdx, EndIndex = mention.EndIdx, Type = mention.MentionType == 0 ? Mention.MentionType.App : Mention.MentionType.User
     });
 }
        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.String)
                        {
                            Id = iprot.ReadString();
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 2:
                        if (field.Type == TType.Map)
                        {
                            {
                                Content = new Dictionary <string, AFContent>();
                                TMap _map29 = iprot.ReadMapBegin();
                                for (int _i30 = 0; _i30 < _map29.Count; ++_i30)
                                {
                                    string    _key31;
                                    AFContent _val32;
                                    _key31 = iprot.ReadString();
                                    _val32 = new AFContent();
                                    _val32.Read(iprot);
                                    Content[_key31] = _val32;
                                }
                                iprot.ReadMapEnd();
                            }
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

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

                    case 4:
                        if (field.Type == TType.Struct)
                        {
                            Reactions = new AFUserReactions();
                            Reactions.Read(iprot);
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 6:
                        if (field.Type == TType.Map)
                        {
                            {
                                Properties = new Dictionary <string, string>();
                                TMap _map33 = iprot.ReadMapBegin();
                                for (int _i34 = 0; _i34 < _map33.Count; ++_i34)
                                {
                                    string _key35;
                                    string _val36;
                                    _key35             = iprot.ReadString();
                                    _val36             = iprot.ReadString();
                                    Properties[_key35] = _val36;
                                }
                                iprot.ReadMapEnd();
                            }
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 7:
                        if (field.Type == TType.Struct)
                        {
                            Author = new THCreator();
                            Author.Read(iprot);
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

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

                    case 9:
                        if (field.Type == TType.Bool)
                        {
                            IsAnnouncement = iprot.ReadBool();
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 10:
                        if (field.Type == TType.Map)
                        {
                            {
                                Mentions = new Dictionary <string, List <AFMention> >();
                                TMap _map37 = iprot.ReadMapBegin();
                                for (int _i38 = 0; _i38 < _map37.Count; ++_i38)
                                {
                                    string           _key39;
                                    List <AFMention> _val40;
                                    _key39 = iprot.ReadString();
                                    {
                                        _val40 = new List <AFMention>();
                                        TList _list41 = iprot.ReadListBegin();
                                        for (int _i42 = 0; _i42 < _list41.Count; ++_i42)
                                        {
                                            AFMention _elem43;
                                            _elem43 = new AFMention();
                                            _elem43.Read(iprot);
                                            _val40.Add(_elem43);
                                        }
                                        iprot.ReadListEnd();
                                    }
                                    Mentions[_key39] = _val40;
                                }
                                iprot.ReadMapEnd();
                            }
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 11:
                        if (field.Type == TType.Struct)
                        {
                            Source = new AFEntityReference();
                            Source.Read(iprot);
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

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

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

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