TLSharp/TeleSharp.TL/TL/TLChannelFull.cs
2017-11-09 01:37:23 -08:00

150 lines
5.4 KiB
C#

using System.IO;
namespace TeleSharp.TL
{
[TLObject(401891279)]
public class TLChannelFull : TLAbsChatFull
{
public override int Constructor
{
get
{
return 401891279;
}
}
public int flags { get; set; }
public bool can_view_participants { get; set; }
public bool can_set_username { get; set; }
public bool can_set_stickers { get; set; }
public int id { get; set; }
public string about { get; set; }
public int? participants_count { get; set; }
public int? admins_count { get; set; }
public int? kicked_count { get; set; }
public int? banned_count { get; set; }
public int read_inbox_max_id { get; set; }
public int read_outbox_max_id { get; set; }
public int unread_count { get; set; }
public TLAbsPhoto chat_photo { get; set; }
public TLAbsPeerNotifySettings notify_settings { get; set; }
public TLAbsExportedChatInvite exported_invite { get; set; }
public TLVector<TLBotInfo> bot_info { get; set; }
public int? migrated_from_chat_id { get; set; }
public int? migrated_from_max_id { get; set; }
public int? pinned_msg_id { get; set; }
public TLStickerSet stickerset { get; set; }
public void ComputeFlags()
{
flags = 0;
flags = can_view_participants ? (flags | 8) : (flags & ~8);
flags = can_set_username ? (flags | 64) : (flags & ~64);
flags = can_set_stickers ? (flags | 128) : (flags & ~128);
flags = participants_count != null ? (flags | 1) : (flags & ~1);
flags = admins_count != null ? (flags | 2) : (flags & ~2);
flags = kicked_count != null ? (flags | 4) : (flags & ~4);
flags = banned_count != null ? (flags | 4) : (flags & ~4);
flags = migrated_from_chat_id != null ? (flags | 16) : (flags & ~16);
flags = migrated_from_max_id != null ? (flags | 16) : (flags & ~16);
flags = pinned_msg_id != null ? (flags | 32) : (flags & ~32);
flags = stickerset != null ? (flags | 256) : (flags & ~256);
}
public override void DeserializeBody(BinaryReader br)
{
flags = br.ReadInt32();
can_view_participants = (flags & 8) != 0;
can_set_username = (flags & 64) != 0;
can_set_stickers = (flags & 128) != 0;
id = br.ReadInt32();
about = StringUtil.Deserialize(br);
if ((flags & 1) != 0)
participants_count = br.ReadInt32();
else
participants_count = null;
if ((flags & 2) != 0)
admins_count = br.ReadInt32();
else
admins_count = null;
if ((flags & 4) != 0)
kicked_count = br.ReadInt32();
else
kicked_count = null;
if ((flags & 4) != 0)
banned_count = br.ReadInt32();
else
banned_count = null;
read_inbox_max_id = br.ReadInt32();
read_outbox_max_id = br.ReadInt32();
unread_count = br.ReadInt32();
chat_photo = (TLAbsPhoto)ObjectUtils.DeserializeObject(br);
notify_settings = (TLAbsPeerNotifySettings)ObjectUtils.DeserializeObject(br);
exported_invite = (TLAbsExportedChatInvite)ObjectUtils.DeserializeObject(br);
bot_info = (TLVector<TLBotInfo>)ObjectUtils.DeserializeVector<TLBotInfo>(br);
if ((flags & 16) != 0)
migrated_from_chat_id = br.ReadInt32();
else
migrated_from_chat_id = null;
if ((flags & 16) != 0)
migrated_from_max_id = br.ReadInt32();
else
migrated_from_max_id = null;
if ((flags & 32) != 0)
pinned_msg_id = br.ReadInt32();
else
pinned_msg_id = null;
if ((flags & 256) != 0)
stickerset = (TLStickerSet)ObjectUtils.DeserializeObject(br);
else
stickerset = null;
}
public override void SerializeBody(BinaryWriter bw)
{
bw.Write(Constructor);
ComputeFlags();
bw.Write(flags);
bw.Write(id);
StringUtil.Serialize(about, bw);
if ((flags & 1) != 0)
bw.Write(participants_count.Value);
if ((flags & 2) != 0)
bw.Write(admins_count.Value);
if ((flags & 4) != 0)
bw.Write(kicked_count.Value);
if ((flags & 4) != 0)
bw.Write(banned_count.Value);
bw.Write(read_inbox_max_id);
bw.Write(read_outbox_max_id);
bw.Write(unread_count);
ObjectUtils.SerializeObject(chat_photo, bw);
ObjectUtils.SerializeObject(notify_settings, bw);
ObjectUtils.SerializeObject(exported_invite, bw);
ObjectUtils.SerializeObject(bot_info, bw);
if ((flags & 16) != 0)
bw.Write(migrated_from_chat_id.Value);
if ((flags & 16) != 0)
bw.Write(migrated_from_max_id.Value);
if ((flags & 32) != 0)
bw.Write(pinned_msg_id.Value);
if ((flags & 256) != 0)
ObjectUtils.SerializeObject(stickerset, bw);
}
}
}