TLSharp/TeleSharp.TL/TL/TLMessageService.cs

88 lines
2.1 KiB
C#
Raw Normal View History

2016-09-24 15:38:26 +02:00
using System.IO;
2017-12-20 12:06:31 +01:00
2016-09-24 15:38:26 +02:00
namespace TeleSharp.TL
{
[TLObject(-1642487306)]
2016-09-24 15:38:26 +02:00
public class TLMessageService : TLAbsMessage
{
2017-12-20 12:06:31 +01:00
public TLAbsMessageAction Action { get; set; }
2016-09-24 15:38:26 +02:00
public override int Constructor
{
get
{
return -1642487306;
}
}
2017-12-20 12:06:31 +01:00
public int Date { get; set; }
public int Flags { get; set; }
2017-12-20 12:06:31 +01:00
public int? FromId { get; set; }
public int Id { get; set; }
public bool MediaUnread { get; set; }
2017-12-20 12:06:31 +01:00
public bool Mentioned { get; set; }
public bool Out { get; set; }
public bool Post { get; set; }
2017-12-20 12:06:31 +01:00
public int? ReplyToMsgId { get; set; }
2016-09-24 15:38:26 +02:00
2017-12-20 12:06:31 +01:00
public bool Silent { get; set; }
public TLAbsPeer ToId { get; set; }
2016-09-24 15:38:26 +02:00
public void ComputeFlags()
{
}
2016-09-24 15:38:26 +02:00
public override void DeserializeBody(BinaryReader br)
{
Flags = br.ReadInt32();
Out = (Flags & 2) != 0;
Mentioned = (Flags & 16) != 0;
MediaUnread = (Flags & 32) != 0;
Silent = (Flags & 8192) != 0;
Post = (Flags & 16384) != 0;
Id = br.ReadInt32();
if ((Flags & 256) != 0)
FromId = br.ReadInt32();
else
FromId = null;
2016-09-24 15:38:26 +02:00
ToId = (TLAbsPeer)ObjectUtils.DeserializeObject(br);
if ((Flags & 8) != 0)
ReplyToMsgId = br.ReadInt32();
else
ReplyToMsgId = null;
2016-09-24 15:38:26 +02:00
Date = br.ReadInt32();
Action = (TLAbsMessageAction)ObjectUtils.DeserializeObject(br);
2016-09-24 15:38:26 +02:00
}
public override void SerializeBody(BinaryWriter bw)
{
bw.Write(Constructor);
bw.Write(Flags);
2016-09-24 15:38:26 +02:00
bw.Write(Id);
if ((Flags & 256) != 0)
bw.Write(FromId.Value);
ObjectUtils.SerializeObject(ToId, bw);
if ((Flags & 8) != 0)
bw.Write(ReplyToMsgId.Value);
bw.Write(Date);
ObjectUtils.SerializeObject(Action, bw);
2016-09-24 15:38:26 +02:00
}
}
}