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
|
|
|
|
|
{
|
2017-07-20 04:07:24 +02:00
|
|
|
[TLObject(773059779)]
|
2016-09-24 15:38:26 +02:00
|
|
|
public class TLUser : TLAbsUser
|
|
|
|
|
{
|
|
|
|
|
public override int Constructor
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2017-07-20 04:07:24 +02:00
|
|
|
return 773059779;
|
2016-09-24 15:38:26 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-11-09 11:35:15 +01:00
|
|
|
public int Flags { get; set; }
|
|
|
|
|
public bool Self { get; set; }
|
|
|
|
|
public bool Contact { get; set; }
|
|
|
|
|
public bool MutualContact { get; set; }
|
|
|
|
|
public bool Deleted { get; set; }
|
|
|
|
|
public bool Bot { get; set; }
|
|
|
|
|
public bool BotChatHistory { get; set; }
|
|
|
|
|
public bool BotNochats { get; set; }
|
|
|
|
|
public bool Verified { get; set; }
|
|
|
|
|
public bool Restricted { get; set; }
|
|
|
|
|
public bool Min { get; set; }
|
|
|
|
|
public bool BotInlineGeo { get; set; }
|
|
|
|
|
public int Id { get; set; }
|
|
|
|
|
public long? AccessHash { get; set; }
|
|
|
|
|
public string FirstName { get; set; }
|
|
|
|
|
public string LastName { get; set; }
|
|
|
|
|
public string Username { get; set; }
|
|
|
|
|
public string Phone { get; set; }
|
|
|
|
|
public TLAbsUserProfilePhoto Photo { get; set; }
|
|
|
|
|
public TLAbsUserStatus Status { get; set; }
|
|
|
|
|
public int? BotInfoVersion { get; set; }
|
|
|
|
|
public string RestrictionReason { get; set; }
|
|
|
|
|
public string BotInlinePlaceholder { get; set; }
|
|
|
|
|
public string LangCode { get; set; }
|
2017-07-20 04:07:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
public void ComputeFlags()
|
|
|
|
|
{
|
2017-11-09 11:35:15 +01:00
|
|
|
Flags = 0;
|
|
|
|
|
Flags = Self ? (Flags | 1024) : (Flags & ~1024);
|
|
|
|
|
Flags = Contact ? (Flags | 2048) : (Flags & ~2048);
|
|
|
|
|
Flags = MutualContact ? (Flags | 4096) : (Flags & ~4096);
|
|
|
|
|
Flags = Deleted ? (Flags | 8192) : (Flags & ~8192);
|
|
|
|
|
Flags = Bot ? (Flags | 16384) : (Flags & ~16384);
|
|
|
|
|
Flags = BotChatHistory ? (Flags | 32768) : (Flags & ~32768);
|
|
|
|
|
Flags = BotNochats ? (Flags | 65536) : (Flags & ~65536);
|
|
|
|
|
Flags = Verified ? (Flags | 131072) : (Flags & ~131072);
|
|
|
|
|
Flags = Restricted ? (Flags | 262144) : (Flags & ~262144);
|
|
|
|
|
Flags = Min ? (Flags | 1048576) : (Flags & ~1048576);
|
|
|
|
|
Flags = BotInlineGeo ? (Flags | 2097152) : (Flags & ~2097152);
|
|
|
|
|
Flags = AccessHash != null ? (Flags | 1) : (Flags & ~1);
|
|
|
|
|
Flags = FirstName != null ? (Flags | 2) : (Flags & ~2);
|
|
|
|
|
Flags = LastName != null ? (Flags | 4) : (Flags & ~4);
|
|
|
|
|
Flags = Username != null ? (Flags | 8) : (Flags & ~8);
|
|
|
|
|
Flags = Phone != null ? (Flags | 16) : (Flags & ~16);
|
|
|
|
|
Flags = Photo != null ? (Flags | 32) : (Flags & ~32);
|
|
|
|
|
Flags = Status != null ? (Flags | 64) : (Flags & ~64);
|
|
|
|
|
Flags = BotInfoVersion != null ? (Flags | 16384) : (Flags & ~16384);
|
|
|
|
|
Flags = RestrictionReason != null ? (Flags | 262144) : (Flags & ~262144);
|
|
|
|
|
Flags = BotInlinePlaceholder != null ? (Flags | 524288) : (Flags & ~524288);
|
|
|
|
|
Flags = LangCode != null ? (Flags | 4194304) : (Flags & ~4194304);
|
2017-07-20 04:07:24 +02:00
|
|
|
|
|
|
|
|
}
|
2016-09-24 15:38:26 +02:00
|
|
|
|
|
|
|
|
public override void DeserializeBody(BinaryReader br)
|
|
|
|
|
{
|
2017-11-09 11:35:15 +01:00
|
|
|
Flags = br.ReadInt32();
|
|
|
|
|
Self = (Flags & 1024) != 0;
|
|
|
|
|
Contact = (Flags & 2048) != 0;
|
|
|
|
|
MutualContact = (Flags & 4096) != 0;
|
|
|
|
|
Deleted = (Flags & 8192) != 0;
|
|
|
|
|
Bot = (Flags & 16384) != 0;
|
|
|
|
|
BotChatHistory = (Flags & 32768) != 0;
|
|
|
|
|
BotNochats = (Flags & 65536) != 0;
|
|
|
|
|
Verified = (Flags & 131072) != 0;
|
|
|
|
|
Restricted = (Flags & 262144) != 0;
|
|
|
|
|
Min = (Flags & 1048576) != 0;
|
|
|
|
|
BotInlineGeo = (Flags & 2097152) != 0;
|
|
|
|
|
Id = br.ReadInt32();
|
|
|
|
|
if ((Flags & 1) != 0)
|
|
|
|
|
AccessHash = br.ReadInt64();
|
2017-07-20 04:07:24 +02:00
|
|
|
else
|
2017-11-09 11:35:15 +01:00
|
|
|
AccessHash = null;
|
2017-07-20 04:07:24 +02:00
|
|
|
|
2017-11-09 11:35:15 +01:00
|
|
|
if ((Flags & 2) != 0)
|
|
|
|
|
FirstName = StringUtil.Deserialize(br);
|
2017-07-20 04:07:24 +02:00
|
|
|
else
|
2017-11-09 11:35:15 +01:00
|
|
|
FirstName = null;
|
2017-07-20 04:07:24 +02:00
|
|
|
|
2017-11-09 11:35:15 +01:00
|
|
|
if ((Flags & 4) != 0)
|
|
|
|
|
LastName = StringUtil.Deserialize(br);
|
2017-07-20 04:07:24 +02:00
|
|
|
else
|
2017-11-09 11:35:15 +01:00
|
|
|
LastName = null;
|
2017-07-20 04:07:24 +02:00
|
|
|
|
2017-11-09 11:35:15 +01:00
|
|
|
if ((Flags & 8) != 0)
|
|
|
|
|
Username = StringUtil.Deserialize(br);
|
2017-07-20 04:07:24 +02:00
|
|
|
else
|
2017-11-09 11:35:15 +01:00
|
|
|
Username = null;
|
2017-07-20 04:07:24 +02:00
|
|
|
|
2017-11-09 11:35:15 +01:00
|
|
|
if ((Flags & 16) != 0)
|
|
|
|
|
Phone = StringUtil.Deserialize(br);
|
2017-07-20 04:07:24 +02:00
|
|
|
else
|
2017-11-09 11:35:15 +01:00
|
|
|
Phone = null;
|
2017-07-20 04:07:24 +02:00
|
|
|
|
2017-11-09 11:35:15 +01:00
|
|
|
if ((Flags & 32) != 0)
|
|
|
|
|
Photo = (TLAbsUserProfilePhoto)ObjectUtils.DeserializeObject(br);
|
2017-07-20 04:07:24 +02:00
|
|
|
else
|
2017-11-09 11:35:15 +01:00
|
|
|
Photo = null;
|
2017-07-20 04:07:24 +02:00
|
|
|
|
2017-11-09 11:35:15 +01:00
|
|
|
if ((Flags & 64) != 0)
|
|
|
|
|
Status = (TLAbsUserStatus)ObjectUtils.DeserializeObject(br);
|
2017-07-20 04:07:24 +02:00
|
|
|
else
|
2017-11-09 11:35:15 +01:00
|
|
|
Status = null;
|
2017-07-20 04:07:24 +02:00
|
|
|
|
2017-11-09 11:35:15 +01:00
|
|
|
if ((Flags & 16384) != 0)
|
|
|
|
|
BotInfoVersion = br.ReadInt32();
|
2017-07-20 04:07:24 +02:00
|
|
|
else
|
2017-11-09 11:35:15 +01:00
|
|
|
BotInfoVersion = null;
|
2017-07-20 04:07:24 +02:00
|
|
|
|
2017-11-09 11:35:15 +01:00
|
|
|
if ((Flags & 262144) != 0)
|
|
|
|
|
RestrictionReason = StringUtil.Deserialize(br);
|
2017-07-20 04:07:24 +02:00
|
|
|
else
|
2017-11-09 11:35:15 +01:00
|
|
|
RestrictionReason = null;
|
2017-07-20 04:07:24 +02:00
|
|
|
|
2017-11-09 11:35:15 +01:00
|
|
|
if ((Flags & 524288) != 0)
|
|
|
|
|
BotInlinePlaceholder = StringUtil.Deserialize(br);
|
2017-07-20 04:07:24 +02:00
|
|
|
else
|
2017-11-09 11:35:15 +01:00
|
|
|
BotInlinePlaceholder = null;
|
2017-07-20 04:07:24 +02:00
|
|
|
|
2017-11-09 11:35:15 +01:00
|
|
|
if ((Flags & 4194304) != 0)
|
|
|
|
|
LangCode = StringUtil.Deserialize(br);
|
2017-07-20 04:07:24 +02:00
|
|
|
else
|
2017-11-09 11:35:15 +01:00
|
|
|
LangCode = null;
|
2016-09-24 15:38:26 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void SerializeBody(BinaryWriter bw)
|
|
|
|
|
{
|
2017-07-20 04:07:24 +02:00
|
|
|
bw.Write(Constructor);
|
2016-09-24 15:38:26 +02:00
|
|
|
ComputeFlags();
|
2017-11-09 11:35:15 +01:00
|
|
|
bw.Write(Flags);
|
2016-09-24 15:38:26 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-11-09 11:35:15 +01:00
|
|
|
bw.Write(Id);
|
|
|
|
|
if ((Flags & 1) != 0)
|
|
|
|
|
bw.Write(AccessHash.Value);
|
|
|
|
|
if ((Flags & 2) != 0)
|
|
|
|
|
StringUtil.Serialize(FirstName, bw);
|
|
|
|
|
if ((Flags & 4) != 0)
|
|
|
|
|
StringUtil.Serialize(LastName, bw);
|
|
|
|
|
if ((Flags & 8) != 0)
|
|
|
|
|
StringUtil.Serialize(Username, bw);
|
|
|
|
|
if ((Flags & 16) != 0)
|
|
|
|
|
StringUtil.Serialize(Phone, bw);
|
|
|
|
|
if ((Flags & 32) != 0)
|
|
|
|
|
ObjectUtils.SerializeObject(Photo, bw);
|
|
|
|
|
if ((Flags & 64) != 0)
|
|
|
|
|
ObjectUtils.SerializeObject(Status, bw);
|
|
|
|
|
if ((Flags & 16384) != 0)
|
|
|
|
|
bw.Write(BotInfoVersion.Value);
|
|
|
|
|
if ((Flags & 262144) != 0)
|
|
|
|
|
StringUtil.Serialize(RestrictionReason, bw);
|
|
|
|
|
if ((Flags & 524288) != 0)
|
|
|
|
|
StringUtil.Serialize(BotInlinePlaceholder, bw);
|
|
|
|
|
if ((Flags & 4194304) != 0)
|
|
|
|
|
StringUtil.Serialize(LangCode, bw);
|
2016-09-24 15:38:26 +02:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|