TLSharp/TeleSharp.TL/TL/TLUpdateShortSentMessage.cs

79 lines
2.1 KiB
C#
Raw Normal View History

2016-09-24 15:38:26 +02:00
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TeleSharp.TL;
namespace TeleSharp.TL
{
[TLObject(301019932)]
2016-09-24 15:38:26 +02:00
public class TLUpdateShortSentMessage : TLAbsUpdates
{
public override int Constructor
{
get
{
return 301019932;
}
}
public int Flags { get; set; }
public bool Out { get; set; }
public int Id { get; set; }
public int Pts { get; set; }
public int PtsCount { 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
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
}
2016-09-24 15:38:26 +02:00
public override void DeserializeBody(BinaryReader br)
{
Flags = br.ReadInt32();
Out = (Flags & 2) != 0;
Id = br.ReadInt32();
Pts = br.ReadInt32();
PtsCount = br.ReadInt32();
Date = br.ReadInt32();
if ((Flags & 512) != 0)
Media = (TLAbsMessageMedia)ObjectUtils.DeserializeObject(br);
else
Media = null;
2016-09-24 15:38:26 +02:00
if ((Flags & 128) != 0)
Entities = (TLVector<TLAbsMessageEntity>)ObjectUtils.DeserializeVector<TLAbsMessageEntity>(br);
else
Entities = null;
2016-09-24 15:38:26 +02:00
}
public override void SerializeBody(BinaryWriter bw)
{
bw.Write(Constructor);
2016-09-24 15:38:26 +02:00
ComputeFlags();
bw.Write(Flags);
2016-09-24 15:38:26 +02:00
bw.Write(Id);
bw.Write(Pts);
bw.Write(PtsCount);
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
}
}
}