TLSharp/TeleSharp.TL/TL/TLUserFull.cs

96 lines
3 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(253890367)]
2016-09-24 15:38:26 +02:00
public class TLUserFull : TLObject
{
public override int Constructor
{
get
{
return 253890367;
2016-09-24 15:38:26 +02:00
}
}
public int flags { get; set; }
public bool blocked { get; set; }
public bool phone_calls_available { get; set; }
public bool phone_calls_private { get; set; }
public TLAbsUser user { get; set; }
public string about { get; set; }
public Contacts.TLLink link { get; set; }
public TLAbsPhoto profile_photo { get; set; }
public TLAbsPeerNotifySettings notify_settings { get; set; }
public TLBotInfo bot_info { get; set; }
public int common_chats_count { get; set; }
2016-09-24 15:38:26 +02:00
public void ComputeFlags()
{
flags = 0;
flags = blocked ? (flags | 1) : (flags & ~1);
flags = phone_calls_available ? (flags | 16) : (flags & ~16);
flags = phone_calls_private ? (flags | 32) : (flags & ~32);
flags = about != null ? (flags | 2) : (flags & ~2);
flags = profile_photo != null ? (flags | 4) : (flags & ~4);
flags = bot_info != null ? (flags | 8) : (flags & ~8);
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();
blocked = (flags & 1) != 0;
phone_calls_available = (flags & 16) != 0;
phone_calls_private = (flags & 32) != 0;
user = (TLAbsUser)ObjectUtils.DeserializeObject(br);
if ((flags & 2) != 0)
about = StringUtil.Deserialize(br);
else
about = null;
2016-09-24 15:38:26 +02:00
link = (Contacts.TLLink)ObjectUtils.DeserializeObject(br);
if ((flags & 4) != 0)
profile_photo = (TLAbsPhoto)ObjectUtils.DeserializeObject(br);
else
profile_photo = null;
2016-09-24 15:38:26 +02:00
notify_settings = (TLAbsPeerNotifySettings)ObjectUtils.DeserializeObject(br);
if ((flags & 8) != 0)
bot_info = (TLBotInfo)ObjectUtils.DeserializeObject(br);
else
bot_info = null;
2016-09-24 15:38:26 +02:00
common_chats_count = br.ReadInt32();
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
ObjectUtils.SerializeObject(user, bw);
if ((flags & 2) != 0)
StringUtil.Serialize(about, bw);
ObjectUtils.SerializeObject(link, bw);
if ((flags & 4) != 0)
ObjectUtils.SerializeObject(profile_photo, bw);
ObjectUtils.SerializeObject(notify_settings, bw);
if ((flags & 8) != 0)
ObjectUtils.SerializeObject(bot_info, bw);
bw.Write(common_chats_count);
2016-09-24 15:38:26 +02:00
}
}
}