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(-1588737454)]
|
2016-09-24 15:38:26 +02:00
|
|
|
public class TLChannel : TLAbsChat
|
|
|
|
|
{
|
|
|
|
|
public override int Constructor
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return -1588737454;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-11-09 11:35:15 +01:00
|
|
|
public int Flags { get; set; }
|
|
|
|
|
public bool Creator { get; set; }
|
|
|
|
|
public bool Kicked { get; set; }
|
|
|
|
|
public bool Left { get; set; }
|
|
|
|
|
public bool Editor { get; set; }
|
|
|
|
|
public bool Moderator { get; set; }
|
|
|
|
|
public bool Broadcast { get; set; }
|
|
|
|
|
public bool Verified { get; set; }
|
|
|
|
|
public bool Megagroup { get; set; }
|
|
|
|
|
public bool Restricted { get; set; }
|
|
|
|
|
public bool Democracy { get; set; }
|
|
|
|
|
public bool Signatures { get; set; }
|
|
|
|
|
public bool Min { get; set; }
|
|
|
|
|
public int Id { get; set; }
|
|
|
|
|
public long? AccessHash { get; set; }
|
|
|
|
|
public string Title { get; set; }
|
|
|
|
|
public string Username { get; set; }
|
|
|
|
|
public TLAbsChatPhoto Photo { get; set; }
|
|
|
|
|
public int Date { get; set; }
|
|
|
|
|
public int Version { get; set; }
|
|
|
|
|
public string RestrictionReason { get; set; }
|
2017-07-20 04:07:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
public void ComputeFlags()
|
|
|
|
|
{
|
2017-11-09 11:35:15 +01:00
|
|
|
Flags = 0;
|
|
|
|
|
Flags = Creator ? (Flags | 1) : (Flags & ~1);
|
|
|
|
|
Flags = Kicked ? (Flags | 2) : (Flags & ~2);
|
|
|
|
|
Flags = Left ? (Flags | 4) : (Flags & ~4);
|
|
|
|
|
Flags = Editor ? (Flags | 8) : (Flags & ~8);
|
|
|
|
|
Flags = Moderator ? (Flags | 16) : (Flags & ~16);
|
|
|
|
|
Flags = Broadcast ? (Flags | 32) : (Flags & ~32);
|
|
|
|
|
Flags = Verified ? (Flags | 128) : (Flags & ~128);
|
|
|
|
|
Flags = Megagroup ? (Flags | 256) : (Flags & ~256);
|
|
|
|
|
Flags = Restricted ? (Flags | 512) : (Flags & ~512);
|
|
|
|
|
Flags = Democracy ? (Flags | 1024) : (Flags & ~1024);
|
|
|
|
|
Flags = Signatures ? (Flags | 2048) : (Flags & ~2048);
|
|
|
|
|
Flags = Min ? (Flags | 4096) : (Flags & ~4096);
|
|
|
|
|
Flags = AccessHash != null ? (Flags | 8192) : (Flags & ~8192);
|
|
|
|
|
Flags = Username != null ? (Flags | 64) : (Flags & ~64);
|
|
|
|
|
Flags = RestrictionReason != null ? (Flags | 512) : (Flags & ~512);
|
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();
|
|
|
|
|
Creator = (Flags & 1) != 0;
|
|
|
|
|
Kicked = (Flags & 2) != 0;
|
|
|
|
|
Left = (Flags & 4) != 0;
|
|
|
|
|
Editor = (Flags & 8) != 0;
|
|
|
|
|
Moderator = (Flags & 16) != 0;
|
|
|
|
|
Broadcast = (Flags & 32) != 0;
|
|
|
|
|
Verified = (Flags & 128) != 0;
|
|
|
|
|
Megagroup = (Flags & 256) != 0;
|
|
|
|
|
Restricted = (Flags & 512) != 0;
|
|
|
|
|
Democracy = (Flags & 1024) != 0;
|
|
|
|
|
Signatures = (Flags & 2048) != 0;
|
|
|
|
|
Min = (Flags & 4096) != 0;
|
|
|
|
|
Id = br.ReadInt32();
|
|
|
|
|
if ((Flags & 8192) != 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
|
|
|
Title = StringUtil.Deserialize(br);
|
|
|
|
|
if ((Flags & 64) != 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
|
|
|
Photo = (TLAbsChatPhoto)ObjectUtils.DeserializeObject(br);
|
|
|
|
|
Date = br.ReadInt32();
|
|
|
|
|
Version = br.ReadInt32();
|
|
|
|
|
if ((Flags & 512) != 0)
|
|
|
|
|
RestrictionReason = StringUtil.Deserialize(br);
|
2017-07-20 04:07:24 +02:00
|
|
|
else
|
2017-11-09 11:35:15 +01:00
|
|
|
RestrictionReason = 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 & 8192) != 0)
|
|
|
|
|
bw.Write(AccessHash.Value);
|
|
|
|
|
StringUtil.Serialize(Title, bw);
|
|
|
|
|
if ((Flags & 64) != 0)
|
|
|
|
|
StringUtil.Serialize(Username, bw);
|
|
|
|
|
ObjectUtils.SerializeObject(Photo, bw);
|
|
|
|
|
bw.Write(Date);
|
|
|
|
|
bw.Write(Version);
|
|
|
|
|
if ((Flags & 512) != 0)
|
|
|
|
|
StringUtil.Serialize(RestrictionReason, bw);
|
2016-09-24 15:38:26 +02:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|