TLSharp/TeleSharp.TL/TL/Contacts/TLRequestGetTopPeers.cs

62 lines
1.8 KiB
C#
Raw Normal View History

2016-09-24 15:38:26 +02:00
using System.IO;
2017-04-13 08:38:01 +02:00
2016-09-24 15:38:26 +02:00
namespace TeleSharp.TL.Contacts
{
2017-04-13 08:38:01 +02:00
[TLObject(-728224331)]
2016-09-24 15:38:26 +02:00
public class TLRequestGetTopPeers : TLMethod
{
2017-04-13 08:38:01 +02:00
public override int Constructor => -728224331;
2016-09-24 15:38:26 +02:00
2017-04-13 08:38:01 +02:00
public int flags { get; set; }
public bool correspondents { get; set; }
public bool bots_pm { get; set; }
public bool bots_inline { get; set; }
public bool groups { get; set; }
public bool channels { get; set; }
public int offset { get; set; }
public int limit { get; set; }
public int hash { get; set; }
public TLAbsTopPeers Response { get; set; }
2016-09-24 15:38:26 +02:00
2017-04-13 08:38:01 +02:00
public void ComputeFlags()
{
flags = 0;
flags = correspondents ? flags | 1 : flags & ~1;
flags = bots_pm ? flags | 2 : flags & ~2;
flags = bots_inline ? flags | 4 : flags & ~4;
flags = groups ? flags | 1024 : flags & ~1024;
flags = channels ? flags | 32768 : flags & ~32768;
}
2016-09-24 15:38:26 +02:00
public override void DeserializeBody(BinaryReader br)
{
flags = br.ReadInt32();
2017-04-13 08:38:01 +02:00
correspondents = (flags & 1) != 0;
bots_pm = (flags & 2) != 0;
bots_inline = (flags & 4) != 0;
groups = (flags & 1024) != 0;
channels = (flags & 32768) != 0;
offset = br.ReadInt32();
limit = br.ReadInt32();
hash = br.ReadInt32();
2016-09-24 15:38:26 +02:00
}
public override void SerializeBody(BinaryWriter bw)
{
2017-04-13 08:38:01 +02:00
bw.Write(Constructor);
2016-09-24 15:38:26 +02:00
ComputeFlags();
2017-04-13 08:38:01 +02:00
bw.Write(flags);
2016-09-24 15:38:26 +02:00
2017-04-13 08:38:01 +02:00
bw.Write(offset);
bw.Write(limit);
bw.Write(hash);
2016-09-24 15:38:26 +02:00
}
2017-04-13 08:38:01 +02:00
public override void deserializeResponse(BinaryReader br)
{
Response = (TLAbsTopPeers) ObjectUtils.DeserializeObject(br);
}
2016-09-24 15:38:26 +02:00
}
2017-04-13 08:38:01 +02:00
}