TLSharp/TeleSharp.TL/TL/Messages/TLBotResults.cs

58 lines
1.7 KiB
C#
Raw Normal View History

2016-09-24 17:08:26 +03:30
using System.IO;
2017-04-13 13:38:01 +07:00
2016-09-24 17:08:26 +03:30
namespace TeleSharp.TL.Messages
{
2017-04-13 13:38:01 +07:00
[TLObject(627509670)]
2016-09-24 17:08:26 +03:30
public class TLBotResults : TLObject
{
2017-04-13 13:38:01 +07:00
public override int Constructor => 627509670;
2016-09-24 17:08:26 +03:30
2017-04-13 13:38:01 +07:00
public int flags { get; set; }
public bool gallery { get; set; }
public long query_id { get; set; }
public string next_offset { get; set; }
public TLInlineBotSwitchPM switch_pm { get; set; }
public TLVector<TLAbsBotInlineResult> results { get; set; }
2016-09-24 17:08:26 +03:30
2017-04-13 13:38:01 +07:00
public void ComputeFlags()
{
flags = 0;
flags = gallery ? flags | 1 : flags & ~1;
flags = next_offset != null ? flags | 2 : flags & ~2;
flags = switch_pm != null ? flags | 4 : flags & ~4;
}
2016-09-24 17:08:26 +03:30
public override void DeserializeBody(BinaryReader br)
{
flags = br.ReadInt32();
2017-04-13 13:38:01 +07:00
gallery = (flags & 1) != 0;
query_id = br.ReadInt64();
if ((flags & 2) != 0)
next_offset = StringUtil.Deserialize(br);
else
next_offset = null;
if ((flags & 4) != 0)
switch_pm = (TLInlineBotSwitchPM) ObjectUtils.DeserializeObject(br);
else
switch_pm = null;
results = ObjectUtils.DeserializeVector<TLAbsBotInlineResult>(br);
2016-09-24 17:08:26 +03:30
}
public override void SerializeBody(BinaryWriter bw)
{
2017-04-13 13:38:01 +07:00
bw.Write(Constructor);
2016-09-24 17:08:26 +03:30
ComputeFlags();
2017-04-13 13:38:01 +07:00
bw.Write(flags);
bw.Write(query_id);
if ((flags & 2) != 0)
StringUtil.Serialize(next_offset, bw);
if ((flags & 4) != 0)
ObjectUtils.SerializeObject(switch_pm, bw);
ObjectUtils.SerializeObject(results, bw);
2016-09-24 17:08:26 +03:30
}
}
2017-04-13 13:38:01 +07:00
}