TLSharp/TeleSharp.TL/TL/TLUpdateShortSentMessage.cs

63 lines
1.9 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
{
2017-04-13 08:38:01 +02:00
[TLObject(301019932)]
2016-09-24 15:38:26 +02:00
public class TLUpdateShortSentMessage : TLAbsUpdates
{
2017-04-13 08:38:01 +02:00
public override int Constructor => 301019932;
2016-09-24 15:38:26 +02:00
2017-04-13 08:38:01 +02:00
public int flags { get; set; }
public bool @out { get; set; }
public int id { get; set; }
public int pts { get; set; }
public int pts_count { get; set; }
public int date { get; set; }
public TLAbsMessageMedia media { get; set; }
public TLVector<TLAbsMessageEntity> entities { get; set; }
2016-09-24 15:38:26 +02:00
2017-04-13 08:38:01 +02:00
public void ComputeFlags()
{
flags = 0;
flags = @out ? flags | 2 : flags & ~2;
flags = media != null ? flags | 512 : flags & ~512;
flags = entities != null ? flags | 128 : flags & ~128;
}
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
@out = (flags & 2) != 0;
id = br.ReadInt32();
pts = br.ReadInt32();
pts_count = br.ReadInt32();
date = br.ReadInt32();
if ((flags & 512) != 0)
media = (TLAbsMessageMedia) ObjectUtils.DeserializeObject(br);
else
media = null;
if ((flags & 128) != 0)
entities = ObjectUtils.DeserializeVector<TLAbsMessageEntity>(br);
else
entities = null;
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);
bw.Write(id);
bw.Write(pts);
bw.Write(pts_count);
bw.Write(date);
if ((flags & 512) != 0)
ObjectUtils.SerializeObject(media, bw);
if ((flags & 128) != 0)
ObjectUtils.SerializeObject(entities, bw);
2016-09-24 15:38:26 +02:00
}
}
2017-04-13 08:38:01 +02:00
}