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(98092748)]
|
2016-09-24 15:38:26 +02:00
|
|
|
public class TLDcOption : TLObject
|
|
|
|
|
{
|
|
|
|
|
public override int Constructor
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return 98092748;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-11-09 11:35:15 +01:00
|
|
|
public int Flags { get; set; }
|
|
|
|
|
public bool Ipv6 { get; set; }
|
|
|
|
|
public bool MediaOnly { get; set; }
|
|
|
|
|
public bool TcpoOnly { get; set; }
|
|
|
|
|
public bool Cdn { get; set; }
|
|
|
|
|
public int Id { get; set; }
|
|
|
|
|
public string IpAddress { get; set; }
|
|
|
|
|
public int Port { get; set; }
|
2016-09-24 15:38:26 +02:00
|
|
|
|
|
|
|
|
|
2017-07-20 04:07:24 +02:00
|
|
|
public void ComputeFlags()
|
|
|
|
|
{
|
2017-11-09 11:35:15 +01:00
|
|
|
Flags = 0;
|
|
|
|
|
Flags = Ipv6 ? (Flags | 1) : (Flags & ~1);
|
|
|
|
|
Flags = MediaOnly ? (Flags | 2) : (Flags & ~2);
|
|
|
|
|
Flags = TcpoOnly ? (Flags | 4) : (Flags & ~4);
|
|
|
|
|
Flags = Cdn ? (Flags | 8) : (Flags & ~8);
|
2016-09-24 15:38:26 +02:00
|
|
|
|
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();
|
|
|
|
|
Ipv6 = (Flags & 1) != 0;
|
|
|
|
|
MediaOnly = (Flags & 2) != 0;
|
|
|
|
|
TcpoOnly = (Flags & 4) != 0;
|
|
|
|
|
Cdn = (Flags & 8) != 0;
|
|
|
|
|
Id = br.ReadInt32();
|
|
|
|
|
IpAddress = StringUtil.Deserialize(br);
|
|
|
|
|
Port = br.ReadInt32();
|
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);
|
2017-07-20 04:07:24 +02:00
|
|
|
|
2016-09-24 15:38:26 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-11-09 11:35:15 +01:00
|
|
|
bw.Write(Id);
|
|
|
|
|
StringUtil.Serialize(IpAddress, bw);
|
|
|
|
|
bw.Write(Port);
|
2016-09-24 15:38:26 +02:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|