TLSharp/TeleSharp.TL/TL/TLInputMediaUploadedDocument.cs

78 lines
2.5 KiB
C#
Raw Normal View History

2016-09-24 15:38:26 +02:00
using System.IO;
namespace TeleSharp.TL
{
2017-11-09 10:21:33 +01:00
[TLObject(-476700163)]
2016-09-24 15:38:26 +02:00
public class TLInputMediaUploadedDocument : TLAbsInputMedia
{
public override int Constructor
{
get
{
2017-11-09 10:21:33 +01:00
return -476700163;
2016-09-24 15:38:26 +02:00
}
}
public int flags { get; set; }
public TLAbsInputFile file { get; set; }
2017-11-09 10:21:33 +01:00
public TLAbsInputFile thumb { get; set; }
public string mime_type { get; set; }
public TLVector<TLAbsDocumentAttribute> attributes { get; set; }
public string caption { get; set; }
public TLVector<TLAbsInputDocument> stickers { get; set; }
2017-11-09 10:21:33 +01:00
public int? ttl_seconds { get; set; }
2016-09-24 15:38:26 +02:00
public void ComputeFlags()
{
flags = 0;
2017-11-09 10:21:33 +01:00
flags = thumb != null ? (flags | 4) : (flags & ~4);
flags = stickers != null ? (flags | 1) : (flags & ~1);
2017-11-09 10:21:33 +01:00
flags = ttl_seconds != null ? (flags | 2) : (flags & ~2);
2016-10-13 19:33:16 +02:00
}
2016-09-24 15:38:26 +02:00
public override void DeserializeBody(BinaryReader br)
{
2016-10-13 19:33:16 +02:00
flags = br.ReadInt32();
file = (TLAbsInputFile)ObjectUtils.DeserializeObject(br);
2017-11-09 10:21:33 +01:00
if ((flags & 4) != 0)
thumb = (TLAbsInputFile)ObjectUtils.DeserializeObject(br);
else
thumb = null;
mime_type = StringUtil.Deserialize(br);
attributes = (TLVector<TLAbsDocumentAttribute>)ObjectUtils.DeserializeVector<TLAbsDocumentAttribute>(br);
caption = StringUtil.Deserialize(br);
if ((flags & 1) != 0)
stickers = (TLVector<TLAbsInputDocument>)ObjectUtils.DeserializeVector<TLAbsInputDocument>(br);
else
stickers = null;
2016-10-13 19:33:16 +02:00
2017-11-09 10:21:33 +01:00
if ((flags & 2) != 0)
ttl_seconds = br.ReadInt32();
else
ttl_seconds = null;
2016-09-24 15:38:26 +02:00
}
public override void SerializeBody(BinaryWriter bw)
{
bw.Write(Constructor);
2016-10-13 19:33:16 +02:00
ComputeFlags();
bw.Write(flags);
ObjectUtils.SerializeObject(file, bw);
2017-11-09 10:21:33 +01:00
if ((flags & 4) != 0)
ObjectUtils.SerializeObject(thumb, bw);
StringUtil.Serialize(mime_type, bw);
ObjectUtils.SerializeObject(attributes, bw);
StringUtil.Serialize(caption, bw);
if ((flags & 1) != 0)
ObjectUtils.SerializeObject(stickers, bw);
2017-11-09 10:21:33 +01:00
if ((flags & 2) != 0)
bw.Write(ttl_seconds.Value);
2016-09-24 15:38:26 +02:00
}
}
}