mirror of
https://github.com/sochix/TLSharp.git
synced 2025-12-06 08:02:00 +01:00
Merge pull request #216 from aarani/develop
Redesigned TLSharp With Layer 53
This commit is contained in:
commit
edea686c57
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -64,7 +64,6 @@ artifacts/
|
|||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*.log
|
||||
*.vspscc
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -39,7 +39,7 @@ namespace TLSharp.Core.Network
|
|||
return confirmed ? _session.Sequence++ * 2 + 1 : _session.Sequence * 2;
|
||||
}
|
||||
|
||||
public async Task Send(MTProtoRequest request)
|
||||
public async Task Send(TeleSharp.TL.TLMethod request)
|
||||
{
|
||||
// TODO: refactor
|
||||
if (needConfirmation.Any())
|
||||
|
|
@ -48,7 +48,7 @@ namespace TLSharp.Core.Network
|
|||
using (var memory = new MemoryStream())
|
||||
using (var writer = new BinaryWriter(memory))
|
||||
{
|
||||
ackRequest.OnSend(writer);
|
||||
ackRequest.SerializeBody(writer);
|
||||
await Send(memory.ToArray(), ackRequest);
|
||||
needConfirmation.Clear();
|
||||
}
|
||||
|
|
@ -58,14 +58,14 @@ namespace TLSharp.Core.Network
|
|||
using (var memory = new MemoryStream())
|
||||
using (var writer = new BinaryWriter(memory))
|
||||
{
|
||||
request.OnSend(writer);
|
||||
request.SerializeBody(writer);
|
||||
await Send(memory.ToArray(), request);
|
||||
}
|
||||
|
||||
_session.Save();
|
||||
}
|
||||
|
||||
public async Task Send(byte[] packet, MTProtoRequest request)
|
||||
public async Task Send(byte[] packet, TeleSharp.TL.TLMethod request)
|
||||
{
|
||||
request.MessageId = _session.GetNewMessageId();
|
||||
|
||||
|
|
@ -132,7 +132,7 @@ namespace TLSharp.Core.Network
|
|||
return new Tuple<byte[], ulong, int>(message, remoteMessageId, remoteSequence);
|
||||
}
|
||||
|
||||
public async Task<byte[]> Receive(MTProtoRequest request)
|
||||
public async Task<byte[]> Receive(TeleSharp.TL.TLMethod request)
|
||||
{
|
||||
while (!request.ConfirmReceived)
|
||||
{
|
||||
|
|
@ -148,7 +148,7 @@ namespace TLSharp.Core.Network
|
|||
return null;
|
||||
}
|
||||
|
||||
private bool processMessage(ulong messageId, int sequence, BinaryReader messageReader, MTProtoRequest request)
|
||||
private bool processMessage(ulong messageId, int sequence, BinaryReader messageReader, TeleSharp.TL.TLMethod request)
|
||||
{
|
||||
// TODO: check salt
|
||||
// TODO: check sessionid
|
||||
|
|
@ -225,7 +225,7 @@ namespace TLSharp.Core.Network
|
|||
*/
|
||||
}
|
||||
|
||||
private bool HandleGzipPacked(ulong messageId, int sequence, BinaryReader messageReader, MTProtoRequest request)
|
||||
private bool HandleGzipPacked(ulong messageId, int sequence, BinaryReader messageReader, TeleSharp.TL.TLMethod request)
|
||||
{
|
||||
uint code = messageReader.ReadUInt32();
|
||||
byte[] packedData = GZipStream.UncompressBuffer(Serializers.Bytes.read(messageReader));
|
||||
|
|
@ -238,7 +238,7 @@ namespace TLSharp.Core.Network
|
|||
return true;
|
||||
}
|
||||
|
||||
private bool HandleRpcResult(ulong messageId, int sequence, BinaryReader messageReader, MTProtoRequest request)
|
||||
private bool HandleRpcResult(ulong messageId, int sequence, BinaryReader messageReader, TeleSharp.TL.TLMethod request)
|
||||
{
|
||||
uint code = messageReader.ReadUInt32();
|
||||
ulong requestId = messageReader.ReadUInt64();
|
||||
|
|
@ -305,7 +305,7 @@ namespace TLSharp.Core.Network
|
|||
}
|
||||
using (var compressedReader = new BinaryReader(ms))
|
||||
{
|
||||
request.OnResponse(compressedReader);
|
||||
request.deserializeResponse(compressedReader);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -317,8 +317,7 @@ namespace TLSharp.Core.Network
|
|||
else
|
||||
{
|
||||
messageReader.BaseStream.Position -= 4;
|
||||
|
||||
request.OnResponse(messageReader);
|
||||
request.deserializeResponse(messageReader);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
@ -382,7 +381,7 @@ namespace TLSharp.Core.Network
|
|||
return true;
|
||||
}
|
||||
|
||||
private bool HandleBadServerSalt(ulong messageId, int sequence, BinaryReader messageReader, MTProtoRequest request)
|
||||
private bool HandleBadServerSalt(ulong messageId, int sequence, BinaryReader messageReader, TeleSharp.TL.TLMethod request)
|
||||
{
|
||||
uint code = messageReader.ReadUInt32();
|
||||
ulong badMsgId = messageReader.ReadUInt64();
|
||||
|
|
@ -453,7 +452,7 @@ namespace TLSharp.Core.Network
|
|||
return false;
|
||||
}
|
||||
|
||||
private bool HandleContainer(ulong messageId, int sequence, BinaryReader messageReader, MTProtoRequest request)
|
||||
private bool HandleContainer(ulong messageId, int sequence, BinaryReader messageReader, TeleSharp.TL.TLMethod request)
|
||||
{
|
||||
uint code = messageReader.ReadUInt32();
|
||||
int size = messageReader.ReadInt32();
|
||||
|
|
|
|||
|
|
@ -1,18 +1,20 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using TeleSharp.TL;
|
||||
|
||||
namespace TLSharp.Core.Requests
|
||||
{
|
||||
public class AckRequest : MTProtoRequest
|
||||
public class AckRequest : TeleSharp.TL.TLMethod
|
||||
{
|
||||
private readonly List<ulong> _msgs;
|
||||
|
||||
public AckRequest(List<ulong> msgs)
|
||||
{
|
||||
_msgs = msgs;
|
||||
}
|
||||
|
||||
public override void OnSend(BinaryWriter writer)
|
||||
public override void SerializeBody(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(0x62d6b459); // msgs_ack
|
||||
writer.Write(0x1cb5c415); // Vector
|
||||
|
|
@ -23,17 +25,25 @@ namespace TLSharp.Core.Requests
|
|||
}
|
||||
}
|
||||
|
||||
public override void OnResponse(BinaryReader reader)
|
||||
public override void DeserializeBody(BinaryReader reader)
|
||||
{
|
||||
//throw new NotImplementedException();
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override void OnException(Exception exception)
|
||||
public override void deserializeResponse(BinaryReader stream)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override bool Confirmed => false;
|
||||
public override bool Responded { get; }
|
||||
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return 0x62d6b459;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,45 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using TLSharp.Core.MTProto;
|
||||
|
||||
namespace TLSharp.Core.Requests
|
||||
{
|
||||
class AddChatUserRequest : MTProtoRequest
|
||||
{
|
||||
private int _chatID;
|
||||
|
||||
private InputUserContactConstructor _user;
|
||||
private string _title;
|
||||
|
||||
|
||||
public Messages_statedMessageConstructor message;
|
||||
public AddChatUserRequest(int chatID, InputUserContactConstructor user)
|
||||
{
|
||||
_chatID = chatID;
|
||||
_user = user;
|
||||
}
|
||||
|
||||
public override void OnSend(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(0x2ee9ee9e);
|
||||
writer.Write(_chatID);
|
||||
_user.Write(writer);
|
||||
writer.Write(1);
|
||||
}
|
||||
|
||||
public override void OnResponse(BinaryReader reader)
|
||||
{
|
||||
message = TL.Parse<Messages_statedMessageConstructor>(reader);
|
||||
}
|
||||
|
||||
public override void OnException(Exception exception)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override bool Confirmed { get { return true; } }
|
||||
private readonly bool responded;
|
||||
public override bool Responded { get { return responded; } }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using TLSharp.Core.MTProto;
|
||||
|
||||
namespace TLSharp.Core.Requests
|
||||
{
|
||||
public class AuthCheckPhoneRequest : MTProtoRequest
|
||||
{
|
||||
private string _phoneNumber;
|
||||
public bool _phoneRegistered;
|
||||
private bool _phoneInvited;
|
||||
|
||||
public AuthCheckPhoneRequest(string phoneNumber)
|
||||
{
|
||||
_phoneNumber = phoneNumber;
|
||||
}
|
||||
|
||||
public override void OnSend(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(0x6fe51dfb);
|
||||
Serializers.String.write(writer, _phoneNumber);
|
||||
}
|
||||
|
||||
public override void OnResponse(BinaryReader reader)
|
||||
{
|
||||
var dataCode = reader.ReadUInt32(); // #e300cc3b
|
||||
this._phoneRegistered = reader.ReadUInt32() == 0x997275b5;
|
||||
this._phoneInvited = reader.ReadUInt32() == 0x997275b5;
|
||||
}
|
||||
|
||||
public override void OnException(Exception exception)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override bool Confirmed => true;
|
||||
public override bool Responded { get; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,46 +1,40 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using TLSharp.Core.MTProto;
|
||||
|
||||
using TeleSharp.TL;
|
||||
namespace TLSharp.Core.Requests
|
||||
{
|
||||
public class AuthSendCodeRequest : MTProtoRequest
|
||||
{
|
||||
private readonly string _phoneNumber;
|
||||
private readonly int _smsType;
|
||||
private readonly int _apiId;
|
||||
private readonly string _apiHash;
|
||||
private readonly string _langCode;
|
||||
|
||||
public bool _phoneRegistered;
|
||||
public string _phoneCodeHash;
|
||||
|
||||
public SendCodeArgs args=new SendCodeArgs();
|
||||
public AuthSendCodeRequest(string phoneNumber, int smsType, int apiId, string apiHash, string langCode)
|
||||
{
|
||||
_phoneNumber = phoneNumber;
|
||||
_smsType = smsType;
|
||||
_apiId = apiId;
|
||||
_apiHash = apiHash;
|
||||
_langCode = langCode;
|
||||
|
||||
args.phone_number = phoneNumber;
|
||||
args.api_id = apiId;
|
||||
args.api_hash = apiHash;
|
||||
args.allow_flashcall = false;
|
||||
args.current_number = true;
|
||||
}
|
||||
|
||||
public override void OnSend(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(0x768d5f4d);
|
||||
Serializers.String.write(writer, _phoneNumber);
|
||||
writer.Write(_smsType);
|
||||
writer.Write(_apiId);
|
||||
Serializers.String.write(writer, _apiHash);
|
||||
Serializers.String.write(writer, _langCode);
|
||||
writer.Write(0x86AEF0EC);
|
||||
writer.Write(0);
|
||||
Serializers.String.write(writer, args.phone_number);
|
||||
writer.Write(args.api_id.Value);
|
||||
Serializers.String.write(writer, args.api_hash);
|
||||
}
|
||||
|
||||
public override void OnResponse(BinaryReader reader)
|
||||
{
|
||||
var boolTrue = 0x997275b5;
|
||||
var dataCode = reader.ReadUInt32(); // 0x2215bcbd
|
||||
_phoneRegistered = reader.ReadUInt32() == boolTrue;
|
||||
_phoneCodeHash = Serializers.String.read(reader);
|
||||
var sendCodeTimeout = reader.ReadInt32();
|
||||
var isPassword = reader.ReadUInt32() == boolTrue;
|
||||
|
||||
var s = Deserializer.Deserialize(typeof(SentCode), reader);
|
||||
_phoneRegistered = ((SentCode)s).phone_registered;
|
||||
_phoneCodeHash = ((SentCode)s).phone_code_hash;
|
||||
}
|
||||
|
||||
public override void OnException(Exception exception)
|
||||
|
|
|
|||
|
|
@ -1,40 +0,0 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using TLSharp.Core.MTProto;
|
||||
|
||||
namespace TLSharp.Core.Requests
|
||||
{
|
||||
public class AuthSendSmsRequest : MTProtoRequest
|
||||
{
|
||||
private readonly string _phoneNumber;
|
||||
private readonly string _phoneCodeHash;
|
||||
public bool _smsSent;
|
||||
|
||||
public AuthSendSmsRequest(string phoneNumber, string phoneCodeHash)
|
||||
{
|
||||
_phoneNumber = phoneNumber;
|
||||
_phoneCodeHash = phoneCodeHash;
|
||||
}
|
||||
|
||||
public override void OnSend(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(0xda9f3e8);
|
||||
Serializers.String.write(writer, _phoneNumber);
|
||||
Serializers.String.write(writer, _phoneCodeHash);
|
||||
}
|
||||
|
||||
public override void OnResponse(BinaryReader reader)
|
||||
{
|
||||
var dataCode = reader.ReadUInt32();
|
||||
_smsSent = reader.ReadUInt32() == 0x997275b5;
|
||||
}
|
||||
|
||||
public override void OnException(Exception exception)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override bool Confirmed => true;
|
||||
public override bool Responded { get; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,37 +1,30 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using TLSharp.Core.MTProto;
|
||||
|
||||
using TeleSharp.TL;
|
||||
namespace TLSharp.Core.Requests
|
||||
{
|
||||
public class AuthSignInRequest : MTProtoRequest
|
||||
{
|
||||
private readonly string _phoneNumber;
|
||||
private readonly string _phoneCodeHash;
|
||||
private readonly string _code;
|
||||
private SignInArgs args = new SignInArgs();
|
||||
public User user;
|
||||
public int SessionExpires;
|
||||
|
||||
public AuthSignInRequest(string phoneNumber, string phoneCodeHash, string code)
|
||||
{
|
||||
_phoneNumber = phoneNumber;
|
||||
_phoneCodeHash = phoneCodeHash;
|
||||
_code = code;
|
||||
args.phone_number = phoneNumber;
|
||||
args.phone_code_hash = phoneCodeHash;
|
||||
args.phone_code = code;
|
||||
}
|
||||
|
||||
public override void OnSend(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(0xbcd51581);
|
||||
Serializers.String.write(writer, _phoneNumber);
|
||||
Serializers.String.write(writer, _phoneCodeHash);
|
||||
Serializers.String.write(writer, _code);
|
||||
Serializer.Serialize(args, typeof(SignInArgs), writer);
|
||||
}
|
||||
|
||||
public override void OnResponse(BinaryReader reader)
|
||||
{
|
||||
var dataCode = reader.ReadUInt32(); //0xf6b673a4
|
||||
var expires = reader.ReadInt32();
|
||||
user = TL.Parse<User>(reader);
|
||||
var auth = (Authorization)Deserializer.Deserialize(typeof(Authorization), reader);
|
||||
user = auth.user;
|
||||
}
|
||||
|
||||
public override void OnException(Exception exception)
|
||||
|
|
|
|||
|
|
@ -1,52 +0,0 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using TLSharp.Core.MTProto;
|
||||
|
||||
namespace TLSharp.Core.Requests
|
||||
{
|
||||
public class AuthSignUpRequest : MTProtoRequest
|
||||
{
|
||||
private readonly string _phoneNumber;
|
||||
private readonly string _phoneCodeHash;
|
||||
private readonly string _code;
|
||||
private readonly string _firstName;
|
||||
private readonly string _lastName;
|
||||
|
||||
public User user;
|
||||
public int SessionExpires;
|
||||
|
||||
public AuthSignUpRequest(string phoneNumber, string phoneCodeHash, string code, string firstName, string lastName)
|
||||
{
|
||||
_phoneNumber = phoneNumber;
|
||||
_phoneCodeHash = phoneCodeHash;
|
||||
_code = code;
|
||||
_firstName = firstName;
|
||||
_lastName = lastName;
|
||||
}
|
||||
|
||||
public override void OnSend(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(0x1b067634);
|
||||
Serializers.String.write(writer, _phoneNumber);
|
||||
Serializers.String.write(writer, _phoneCodeHash);
|
||||
Serializers.String.write(writer, _code);
|
||||
Serializers.String.write(writer, _firstName);
|
||||
Serializers.String.write(writer, _lastName);
|
||||
}
|
||||
|
||||
public override void OnResponse(BinaryReader reader)
|
||||
{
|
||||
var dataCode = reader.ReadUInt32(); //0xf6b673a4
|
||||
var expires = reader.ReadInt32();
|
||||
user = TL.Parse<User>(reader);
|
||||
}
|
||||
|
||||
public override void OnException(Exception exception)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override bool Confirmed => true;
|
||||
public override bool Responded { get; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using TLSharp.Core.MTProto;
|
||||
|
||||
namespace TLSharp.Core.Requests
|
||||
{
|
||||
class CreateChatRequest : MTProtoRequest
|
||||
{
|
||||
private List<InputUserContactConstructor> _id;
|
||||
private string _title;
|
||||
|
||||
public Messages_statedMessageConstructor message;
|
||||
public CreateChatRequest(List<InputUserContactConstructor> id, string title)
|
||||
{
|
||||
_id = id;
|
||||
_title = title;
|
||||
}
|
||||
|
||||
public override void OnSend(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(0x419d9aee);
|
||||
writer.Write(0x1cb5c415); // vector#1cb5c415
|
||||
writer.Write(_id.Count); // vector length
|
||||
foreach (var id in _id)
|
||||
id.Write(writer);
|
||||
Serializers.String.write(writer, _title);
|
||||
}
|
||||
|
||||
public override void OnResponse(BinaryReader reader)
|
||||
{
|
||||
message = TL.Parse<Messages_statedMessageConstructor>(reader);
|
||||
}
|
||||
|
||||
public override void OnException(Exception exception)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override bool Confirmed { get { return true; } }
|
||||
private readonly bool responded;
|
||||
public override bool Responded { get { return responded; } }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using TLSharp.Core.MTProto;
|
||||
|
||||
namespace TLSharp.Core.Requests
|
||||
{
|
||||
class DeleteChatUserRequest : MTProtoRequest
|
||||
{
|
||||
private int _chatID;
|
||||
|
||||
private InputUserContactConstructor _user;
|
||||
private string _title;
|
||||
|
||||
|
||||
public Messages_statedMessageConstructor message;
|
||||
public DeleteChatUserRequest(int chatID, InputUserContactConstructor user)
|
||||
{
|
||||
_chatID = chatID;
|
||||
_user = user;
|
||||
}
|
||||
|
||||
public override void OnSend(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(0xc3c5cd23);
|
||||
writer.Write(_chatID);
|
||||
_user.Write(writer);
|
||||
}
|
||||
|
||||
public override void OnResponse(BinaryReader reader)
|
||||
{
|
||||
message = TL.Parse<Messages_statedMessageConstructor>(reader);
|
||||
}
|
||||
|
||||
public override void OnException(Exception exception)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override bool Confirmed { get { return true; } }
|
||||
private readonly bool responded;
|
||||
public override bool Responded { get { return responded; } }
|
||||
}
|
||||
}
|
||||
36
TLSharp.Core/Requests/DownloadFileRequest.cs
Normal file
36
TLSharp.Core/Requests/DownloadFileRequest.cs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using TeleSharp.TL;
|
||||
namespace TLSharp.Core.Requests
|
||||
{
|
||||
public class DownloadFileRequest : MTProtoRequest
|
||||
{
|
||||
private GetFileArgs args = new GetFileArgs();
|
||||
public TeleSharp.TL.File file;
|
||||
|
||||
public DownloadFileRequest(InputFileLocation loc,int offset=0,int limit=0)
|
||||
{
|
||||
args.location = loc;
|
||||
args.offset = offset;
|
||||
args.limit = limit;
|
||||
}
|
||||
|
||||
public override void OnSend(BinaryWriter writer)
|
||||
{
|
||||
Serializer.Serialize(args, typeof(InputFileLocation), writer);
|
||||
}
|
||||
|
||||
public override void OnResponse(BinaryReader reader)
|
||||
{
|
||||
file = (TeleSharp.TL.File)Deserializer.Deserialize(typeof(TeleSharp.TL.File), reader);
|
||||
}
|
||||
|
||||
public override void OnException(Exception exception)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override bool Confirmed => true;
|
||||
public override bool Responded { get; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,85 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TLSharp.Core.MTProto;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
namespace TLSharp.Core.Requests
|
||||
{
|
||||
public class GetContactsRequest : MTProtoRequest
|
||||
{
|
||||
private List<int> CurrentContacts { get; set; }
|
||||
|
||||
public List<Contact> Contacts;
|
||||
public List<User> Users;
|
||||
|
||||
public GetContactsRequest(IList<int> currentContacts = null)
|
||||
{
|
||||
if (currentContacts != null)
|
||||
{
|
||||
CurrentContacts = currentContacts.ToList();
|
||||
CurrentContacts.Sort();
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnSend(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(0x22c6aa08);
|
||||
if (CurrentContacts == null)
|
||||
Serializers.String.write(writer, "");
|
||||
else
|
||||
{
|
||||
// create CSV of contactids and calculate md5 hash
|
||||
string hash;
|
||||
var list = string.Join(",", CurrentContacts);
|
||||
using (var md5 = MD5.Create())
|
||||
{
|
||||
var retVal = md5.ComputeHash(Encoding.UTF8.GetBytes(list));
|
||||
var sb = new StringBuilder();
|
||||
foreach (var t in retVal)
|
||||
{
|
||||
sb.Append(t.ToString("x2"));
|
||||
}
|
||||
hash = sb.ToString();
|
||||
}
|
||||
|
||||
Serializers.String.write(writer, hash);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnResponse(BinaryReader reader)
|
||||
{
|
||||
var code = reader.ReadUInt32();
|
||||
// if contactsNotModified then exit
|
||||
if (code == 0xb74ba9d2) return;
|
||||
|
||||
reader.ReadInt32(); // vector code
|
||||
var contactLen = reader.ReadInt32();
|
||||
Contacts = new List<Contact>(contactLen);
|
||||
for (var importedIndex = 0; importedIndex < contactLen; importedIndex++)
|
||||
{
|
||||
var importedElement = TL.Parse<Contact>(reader);
|
||||
this.Contacts.Add(importedElement);
|
||||
}
|
||||
reader.ReadInt32(); // vector code
|
||||
var usersLen = reader.ReadInt32();
|
||||
Users = new List<User>(usersLen);
|
||||
for (var usersIndex = 0; usersIndex < usersLen; usersIndex++)
|
||||
{
|
||||
var usersElement = TL.Parse<User>(reader);
|
||||
this.Users.Add(usersElement);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnException(Exception exception)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
public override bool Confirmed { get { return true; } }
|
||||
private readonly bool _responded;
|
||||
public override bool Responded { get { return _responded; } }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,91 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using TLSharp.Core.MTProto;
|
||||
|
||||
namespace TLSharp.Core.Requests
|
||||
{
|
||||
public class GetDialogsRequest : MTProtoRequest
|
||||
{
|
||||
int _offset;
|
||||
int _max_id;
|
||||
int _limit;
|
||||
|
||||
public int count;
|
||||
public List<Dialog> dialogs;
|
||||
public List<Message> messages;
|
||||
public List<Chat> chats;
|
||||
public List<User> users;
|
||||
|
||||
public GetDialogsRequest(int offset, int max_id, int limit)
|
||||
{
|
||||
_offset = offset;
|
||||
_max_id = max_id;
|
||||
_limit = limit;
|
||||
}
|
||||
|
||||
public override void OnSend(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(0xeccf1df6);
|
||||
writer.Write(_offset);
|
||||
writer.Write(_max_id);
|
||||
writer.Write(_limit);
|
||||
}
|
||||
|
||||
public override void OnResponse(BinaryReader reader)
|
||||
{
|
||||
bool dialogsSlice = reader.ReadUInt32() == 0x71e094f3; // else dialogs#15ba6c40
|
||||
|
||||
if (dialogsSlice) count = reader.ReadInt32(); // count
|
||||
|
||||
// dialogs
|
||||
var result = reader.ReadUInt32(); // vector#1cb5c415
|
||||
int dialogs_len = reader.ReadInt32();
|
||||
dialogs = new List<Dialog>(dialogs_len);
|
||||
for (int dialogs_index = 0; dialogs_index < dialogs_len; dialogs_index++)
|
||||
{
|
||||
Dialog dialog_element;
|
||||
dialog_element = TL.Parse<Dialog>(reader);
|
||||
dialogs.Add(dialog_element);
|
||||
}
|
||||
// messages
|
||||
result = reader.ReadUInt32(); // vector#1cb5c415
|
||||
int messages_len = reader.ReadInt32();
|
||||
messages = new List<Message>(messages_len);
|
||||
for (int message_index = 0; message_index < messages_len; message_index++)
|
||||
{
|
||||
Message messages_element;
|
||||
messages_element = TL.Parse<Message>(reader);
|
||||
messages.Add(messages_element);
|
||||
}
|
||||
// chats
|
||||
result = reader.ReadUInt32(); // vector#1cb5c415
|
||||
int chats_len = reader.ReadInt32();
|
||||
chats = new List<Chat>(chats_len);
|
||||
for (int chat_index = 0; chat_index < chats_len; chat_index++)
|
||||
{
|
||||
Chat chats_element;
|
||||
chats_element = TL.Parse<Chat>(reader);
|
||||
chats.Add(chats_element);
|
||||
}
|
||||
// users
|
||||
result = reader.ReadUInt32(); // vector#1cb5c415
|
||||
int users_len = reader.ReadInt32();
|
||||
users = new List<User>(users_len);
|
||||
for (int users_index = 0; users_index < users_len; users_index++)
|
||||
{
|
||||
User users_element;
|
||||
users_element = TL.Parse<User>(reader);
|
||||
users.Add(users_element);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnException(Exception exception)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override bool Confirmed => true;
|
||||
public override bool Responded { get; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using TLSharp.Core.MTProto;
|
||||
|
||||
namespace TLSharp.Core.Requests
|
||||
{
|
||||
class GetFileRequest : MTProtoRequest
|
||||
{
|
||||
InputFileLocation _location;
|
||||
int _offset;
|
||||
int _limit;
|
||||
|
||||
public storage_FileType type;
|
||||
public int mtime;
|
||||
public byte[] bytes;
|
||||
|
||||
public GetFileRequest(InputFileLocation location, int offset, int limit)
|
||||
{
|
||||
_location = location;
|
||||
_offset = offset;
|
||||
_limit = limit;
|
||||
}
|
||||
|
||||
public override void OnSend(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(0xe3a6cfb5);
|
||||
_location.Write(writer);
|
||||
writer.Write(_offset);
|
||||
writer.Write(_limit);
|
||||
}
|
||||
|
||||
public override void OnResponse(BinaryReader reader)
|
||||
{
|
||||
var code = reader.ReadUInt32(); // upload.file#96a18d5
|
||||
|
||||
type = TL.Parse<storage_FileType>(reader);
|
||||
mtime = reader.ReadInt32();
|
||||
bytes = reader.ReadBytes(_limit);
|
||||
}
|
||||
|
||||
public override void OnException(Exception exception)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override bool Confirmed => true;
|
||||
public override bool Responded { get; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,78 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using TLSharp.Core.MTProto;
|
||||
|
||||
namespace TLSharp.Core.Requests
|
||||
{
|
||||
class GetHistoryRequest : MTProtoRequest
|
||||
{
|
||||
InputPeer _peer;
|
||||
int _offset;
|
||||
int _max_id;
|
||||
int _limit;
|
||||
|
||||
public List<Message> messages;
|
||||
public List<Chat> chats;
|
||||
public List<User> users;
|
||||
|
||||
public GetHistoryRequest(InputPeer peer, int offset, int max_id, int limit)
|
||||
{
|
||||
_peer = peer;
|
||||
_offset = offset;
|
||||
_max_id = max_id;
|
||||
_limit = limit;
|
||||
}
|
||||
|
||||
public override void OnSend(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(0x92a1df2f);
|
||||
_peer.Write(writer);
|
||||
writer.Write(_offset);
|
||||
writer.Write(_max_id);
|
||||
writer.Write(_limit);
|
||||
}
|
||||
|
||||
public override void OnResponse(BinaryReader reader)
|
||||
{
|
||||
bool messagesSlice = reader.ReadUInt32() == 0xb446ae3; // else messages#8c718e87
|
||||
|
||||
if (messagesSlice) reader.ReadInt32(); // count
|
||||
|
||||
// messages
|
||||
var result = reader.ReadUInt32(); // vector#1cb5c415
|
||||
int messages_len = reader.ReadInt32();
|
||||
messages = new List<Message>(messages_len);
|
||||
for (var i = 0; i < messages_len; i++)
|
||||
{
|
||||
var msgEl = TL.Parse<Message>(reader);
|
||||
|
||||
messages.Add(msgEl);
|
||||
}
|
||||
|
||||
// chats
|
||||
reader.ReadUInt32();
|
||||
int chats_len = reader.ReadInt32();
|
||||
chats = new List<Chat>(chats_len);
|
||||
for (int i = 0; i < chats_len; i++)
|
||||
chats.Add(TL.Parse<Chat>(reader));
|
||||
|
||||
/*
|
||||
// users
|
||||
reader.ReadUInt32();
|
||||
int users_len = reader.ReadInt32();
|
||||
users = new List<User>(users_len);
|
||||
for (int i = 0; i < users_len; i++)
|
||||
users.Add(TL.Parse<User>(reader));
|
||||
*/
|
||||
}
|
||||
|
||||
public override void OnException(Exception exception)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override bool Confirmed => true;
|
||||
public override bool Responded { get; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TLSharp.Core.MTProto;
|
||||
|
||||
namespace TLSharp.Core.Requests
|
||||
{
|
||||
public class GetNearestDcRequest : MTProtoRequest
|
||||
{
|
||||
public string country;
|
||||
public int this_dc;
|
||||
public int nearest_dc;
|
||||
|
||||
public GetNearestDcRequest() { }
|
||||
|
||||
public override void OnSend(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(0x1fb33026);
|
||||
}
|
||||
|
||||
public override void OnResponse(BinaryReader reader)
|
||||
{
|
||||
var code = reader.ReadUInt32();
|
||||
|
||||
country = Serializers.String.read(reader);
|
||||
this_dc = reader.ReadInt32();
|
||||
nearest_dc = reader.ReadInt32();
|
||||
|
||||
System.Diagnostics.Debug.WriteLine("country: " + country);
|
||||
System.Diagnostics.Debug.WriteLine("this_dc: " + this_dc);
|
||||
System.Diagnostics.Debug.WriteLine("nearest: " + nearest_dc);
|
||||
}
|
||||
|
||||
public override void OnException(Exception exception)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override bool Confirmed => true;
|
||||
public override bool Responded { get; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using TLSharp.Core.MTProto;
|
||||
|
||||
namespace TLSharp.Core.Requests
|
||||
{
|
||||
public class GetUpdatesDifferenceRequest : MTProtoRequest
|
||||
{
|
||||
public readonly int pts;
|
||||
public readonly int date;
|
||||
public readonly int qts;
|
||||
|
||||
public GetUpdatesDifferenceRequest(int pts, int date, int qts)
|
||||
{
|
||||
this.pts = pts;
|
||||
this.date = date;
|
||||
this.qts = qts;
|
||||
}
|
||||
|
||||
public updates_Difference updatesDifference { get; private set; }
|
||||
|
||||
public override void OnSend(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(0xa041495);
|
||||
writer.Write(pts);
|
||||
writer.Write(date);
|
||||
writer.Write(qts);
|
||||
}
|
||||
|
||||
public override void OnResponse(BinaryReader reader)
|
||||
{
|
||||
updatesDifference = TL.Parse<updates_Difference>(reader);
|
||||
}
|
||||
|
||||
public override void OnException(Exception exception)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override bool Confirmed => true;
|
||||
public override bool Responded { get; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using TLSharp.Core.MTProto;
|
||||
|
||||
namespace TLSharp.Core.Requests
|
||||
{
|
||||
public class GetUpdatesStateRequest : MTProtoRequest
|
||||
{
|
||||
public updates_State updates { get; private set; }
|
||||
|
||||
public override void OnSend(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(0xedd4882a);
|
||||
}
|
||||
|
||||
public override void OnResponse(BinaryReader reader)
|
||||
{
|
||||
updates = TL.Parse<updates_State>(reader);
|
||||
}
|
||||
|
||||
public override void OnException(Exception exception)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override bool Confirmed => true;
|
||||
public override bool Responded { get; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using TLSharp.Core.MTProto;
|
||||
|
||||
namespace TLSharp.Core.Requests
|
||||
{
|
||||
public class GetUserFullRequest : MTProtoRequest
|
||||
{
|
||||
private InputUser _inputUser;
|
||||
public UserFull _userFull;
|
||||
|
||||
public GetUserFullRequest(int id)
|
||||
{
|
||||
_inputUser = new InputUserContactConstructor(id);
|
||||
}
|
||||
|
||||
public override void OnSend(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(0xca30a5b1);
|
||||
_inputUser.Write(writer);
|
||||
}
|
||||
|
||||
public override void OnResponse(BinaryReader reader)
|
||||
{
|
||||
_userFull = new UserFullConstructor();
|
||||
var dataCode = reader.ReadUInt32();
|
||||
_userFull.Read(reader);
|
||||
}
|
||||
|
||||
public override void OnException(Exception exception)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override bool Responded
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
public override bool Confirmed => true;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using TLSharp.Core.MTProto;
|
||||
|
||||
namespace TLSharp.Core.Requests
|
||||
{
|
||||
class GetUsersRequest : MTProtoRequest
|
||||
{
|
||||
List<InputUser> _id;
|
||||
|
||||
public List<User> users;
|
||||
|
||||
public GetUsersRequest(List<InputUser> id)
|
||||
{
|
||||
_id = id;
|
||||
}
|
||||
|
||||
public override void OnSend(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(0xd91a548);
|
||||
writer.Write(0x1cb5c415); // vector#1cb5c415
|
||||
writer.Write(_id.Count); // vector length
|
||||
foreach (var id in _id)
|
||||
id.Write(writer);
|
||||
}
|
||||
|
||||
public override void OnResponse(BinaryReader reader)
|
||||
{
|
||||
var code = reader.ReadUInt32(); // vector#1cb5c415
|
||||
int users_len = reader.ReadInt32(); // vector length
|
||||
if (users_len != 0)
|
||||
{
|
||||
users = new List<User>(users_len);
|
||||
for (int i = 0; i < users_len; i++)
|
||||
users.Add(TL.Parse<User>(reader));
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnException(Exception exception)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override bool Confirmed => true;
|
||||
public override bool Responded { get; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using TLSharp.Core.MTProto;
|
||||
|
||||
namespace TLSharp.Core.Requests
|
||||
{
|
||||
public class ImportByUserName : MTProtoRequest
|
||||
{
|
||||
private readonly string _userName;
|
||||
public int id { get; private set; }
|
||||
public ImportByUserName(string userName)
|
||||
{
|
||||
_userName = userName;
|
||||
}
|
||||
|
||||
public override void OnSend(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(0xBF0131C);
|
||||
Serializers.String.write(writer, _userName);
|
||||
}
|
||||
|
||||
public override void OnResponse(BinaryReader reader)
|
||||
{
|
||||
var code = reader.ReadUInt32();
|
||||
id = reader.ReadInt32();
|
||||
}
|
||||
|
||||
public override void OnException(Exception exception)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override bool Confirmed => true;
|
||||
public override bool Responded { get; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,62 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using TLSharp.Core.MTProto;
|
||||
|
||||
namespace TLSharp.Core.Requests
|
||||
{
|
||||
public class ImportContactRequest : MTProtoRequest
|
||||
{
|
||||
private InputContact Contact { get; set; }
|
||||
private bool Replace { get; set; }
|
||||
|
||||
public List<ImportedContact> imported;
|
||||
public List<User> users;
|
||||
|
||||
public ImportContactRequest(InputContact contact, bool shouldReplace = true)
|
||||
{
|
||||
Contact = contact;
|
||||
Replace = shouldReplace;
|
||||
}
|
||||
|
||||
public override void OnSend(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(0xda30b32d);
|
||||
writer.Write(0x1cb5c415);
|
||||
writer.Write(1);
|
||||
Contact.Write(writer);
|
||||
writer.Write(Replace ? 0x997275b5 : 0xbc799737);
|
||||
}
|
||||
|
||||
public override void OnResponse(BinaryReader reader)
|
||||
{
|
||||
var code = reader.ReadUInt32();
|
||||
var result = reader.ReadInt32(); // vector code
|
||||
int imported_len = reader.ReadInt32();
|
||||
this.imported = new List<ImportedContact>(imported_len);
|
||||
for (int imported_index = 0; imported_index < imported_len; imported_index++)
|
||||
{
|
||||
ImportedContact imported_element;
|
||||
imported_element = TL.Parse<ImportedContact>(reader);
|
||||
this.imported.Add(imported_element);
|
||||
}
|
||||
reader.ReadInt32(); // vector code
|
||||
int users_len = reader.ReadInt32();
|
||||
this.users = new List<User>(users_len);
|
||||
for (int users_index = 0; users_index < users_len; users_index++)
|
||||
{
|
||||
User users_element;
|
||||
users_element = TL.Parse<User>(reader);
|
||||
this.users.Add(users_element);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnException(Exception exception)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override bool Confirmed => true;
|
||||
public override bool Responded { get; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,40 +1,42 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using TeleSharp.TL;
|
||||
using TLSharp.Core.MTProto;
|
||||
|
||||
namespace TLSharp.Core.Requests
|
||||
{
|
||||
public class InitConnectionRequest : MTProtoRequest
|
||||
{
|
||||
private int _apiId;
|
||||
public ConfigConstructor ConfigConstructor { get; set; }
|
||||
public InvokeWithLayerArgs invokeWithLayer { get; set; }
|
||||
public InitConnectionArgs initConn { get; set; }
|
||||
public GetConfigArgs getConfig { get; set; }
|
||||
public TeleSharp.TL.Config Configs { get; set; }
|
||||
|
||||
public InitConnectionRequest(int apiId)
|
||||
{
|
||||
_apiId = apiId;
|
||||
invokeWithLayer = new InvokeWithLayerArgs();
|
||||
initConn = new InitConnectionArgs();
|
||||
invokeWithLayer.layer = 53;
|
||||
initConn.api_id = apiId;
|
||||
initConn.app_version = "1.0-SNAPSHOT";
|
||||
initConn.lang_code = "en";
|
||||
initConn.system_version = "WinPhone 8.0";
|
||||
initConn.device_model = "WinPhone Emulator";
|
||||
initConn.query = new GetConfigArgs();
|
||||
invokeWithLayer.query = initConn;
|
||||
}
|
||||
|
||||
public override void OnSend(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(0xda9b0d0d);
|
||||
writer.Write(23);// invokeWithLayer23#1c900537
|
||||
writer.Write(0x69796de9); // initConnection
|
||||
writer.Write(_apiId); // api id
|
||||
Serializers.String.write(writer, "WinPhone Emulator"); // device model
|
||||
Serializers.String.write(writer, "WinPhone 8.0"); // system version
|
||||
Serializers.String.write(writer, "1.0-SNAPSHOT"); // app version
|
||||
Serializers.String.write(writer, "en"); // lang code
|
||||
|
||||
writer.Write(0xc4f9186b); // help.getConfig
|
||||
Serializer.Serialize(invokeWithLayer, invokeWithLayer.GetType(), writer);
|
||||
}
|
||||
|
||||
|
||||
public override void OnResponse(BinaryReader reader)
|
||||
{
|
||||
uint code = reader.ReadUInt32();
|
||||
ConfigConstructor config = new ConfigConstructor();
|
||||
config.Read(reader);
|
||||
|
||||
ConfigConstructor = config;
|
||||
Configs = (TeleSharp.TL.Config)Deserializer.Deserialize(typeof(TeleSharp.TL.Config), reader);
|
||||
}
|
||||
|
||||
public override void OnException(Exception exception)
|
||||
|
|
|
|||
|
|
@ -1,48 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TLSharp.Core.MTProto;
|
||||
using TLSharp.Core.Utils;
|
||||
|
||||
namespace TLSharp.Core.Requests
|
||||
{
|
||||
//messages.sendMedia#a3c85d76 peer:InputPeer media:InputMedia random_id:long = messages.StatedMessage;
|
||||
public class Message_SendMediaRequest : MTProtoRequest
|
||||
{
|
||||
InputPeer inputPeer;
|
||||
InputMedia inputMedia;
|
||||
|
||||
public messages_StatedMessage StatedMessage { get; set; }
|
||||
|
||||
public Message_SendMediaRequest(InputPeer inputPeer, InputMedia inputMedia)
|
||||
{
|
||||
this.inputPeer = inputPeer;
|
||||
this.inputMedia = inputMedia;
|
||||
}
|
||||
|
||||
public override void OnSend(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(0xa3c85d76);
|
||||
inputPeer.Write(writer);
|
||||
inputMedia.Write(writer);
|
||||
long random_id = Helpers.GenerateRandomLong();
|
||||
writer.Write(random_id);
|
||||
}
|
||||
|
||||
public override void OnResponse(BinaryReader reader)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void OnException(Exception exception)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override bool Confirmed => true;
|
||||
public override bool Responded { get; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using TLSharp.Core.MTProto;
|
||||
using TLSharp.Core.Utils;
|
||||
|
||||
namespace TLSharp.Core.Requests
|
||||
{
|
||||
public class SendMessageRequest : MTProtoRequest
|
||||
{
|
||||
private InputPeer _peer;
|
||||
private string _message;
|
||||
|
||||
public SendMessageRequest(InputPeer peer, string message)
|
||||
{
|
||||
_peer = peer;
|
||||
_message = message;
|
||||
}
|
||||
|
||||
public override void OnSend(BinaryWriter writer)
|
||||
{
|
||||
long random_id = Helpers.GenerateRandomLong();
|
||||
writer.Write(0x4cde0aab);
|
||||
_peer.Write(writer);
|
||||
Serializers.String.write(writer, _message);
|
||||
writer.Write(random_id);
|
||||
}
|
||||
|
||||
public override void OnResponse(BinaryReader reader)
|
||||
{
|
||||
var code = reader.ReadUInt32();
|
||||
|
||||
var id = reader.ReadInt32();
|
||||
var date = reader.ReadInt32();
|
||||
var pts = reader.ReadInt32();
|
||||
var seq = reader.ReadInt32();
|
||||
}
|
||||
|
||||
public override void OnException(Exception exception)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override bool Confirmed => true;
|
||||
public override bool Responded { get; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TLSharp.Core.MTProto;
|
||||
|
||||
namespace TLSharp.Core.Requests
|
||||
{
|
||||
//upload.saveFilePart#b304a621 file_id:long file_part:int bytes:bytes = Bool;
|
||||
public class Upload_SaveFilePartRequest : MTProtoRequest
|
||||
{
|
||||
long file_id;
|
||||
int file_part;
|
||||
byte[] bytes;
|
||||
|
||||
public bool Done { get; set; }
|
||||
|
||||
public Upload_SaveFilePartRequest(long file_id, int file_part, byte[] bytes)
|
||||
{
|
||||
this.file_id = file_id;
|
||||
this.file_part = file_part;
|
||||
this.bytes = bytes;
|
||||
}
|
||||
|
||||
public override void OnResponse(BinaryReader reader)
|
||||
{
|
||||
var code = reader.ReadUInt32();
|
||||
|
||||
if (code != 0xbc799737 && code != 0x997275b5)
|
||||
throw new InvalidOperationException($"Expected Tl Bool type");
|
||||
|
||||
Done = code == 0x997275b5 ? true : false;
|
||||
}
|
||||
|
||||
public override void OnSend(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(0xb304a621);
|
||||
writer.Write(file_id);
|
||||
writer.Write(file_part);
|
||||
Serializers.Bytes.write(writer, bytes);
|
||||
}
|
||||
|
||||
public override void OnException(Exception exception)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override bool Confirmed => true;
|
||||
public override bool Responded { get; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using TeleSharp.TL;
|
||||
using TLSharp.Core.MTProto;
|
||||
using TLSharp.Core.MTProto.Crypto;
|
||||
|
||||
|
|
@ -66,7 +67,7 @@ namespace TLSharp.Core
|
|||
public int TimeOffset { get; set; }
|
||||
public long LastMessageId { get; set; }
|
||||
public int SessionExpires { get; set; }
|
||||
public User User { get; set; }
|
||||
public TLUser TLUser { get; set; }
|
||||
private Random random;
|
||||
|
||||
private ISessionStore _store;
|
||||
|
|
@ -90,11 +91,11 @@ namespace TLSharp.Core
|
|||
Serializers.String.write(writer, ServerAddress);
|
||||
writer.Write(Port);
|
||||
|
||||
if (User != null)
|
||||
if (TLUser != null)
|
||||
{
|
||||
writer.Write(1);
|
||||
writer.Write(SessionExpires);
|
||||
User.Write(writer);
|
||||
ObjectUtils.SerializeObject(TLUser, writer);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -122,11 +123,11 @@ namespace TLSharp.Core
|
|||
|
||||
var isAuthExsist = reader.ReadInt32() == 1;
|
||||
int sessionExpires = 0;
|
||||
User user = null;
|
||||
TLUser TLUser = null;
|
||||
if (isAuthExsist)
|
||||
{
|
||||
sessionExpires = reader.ReadInt32();
|
||||
user = TL.Parse<User>(reader);
|
||||
TLUser = (TLUser)ObjectUtils.DeserializeObject(reader);
|
||||
}
|
||||
|
||||
var authData = Serializers.Bytes.read(reader);
|
||||
|
|
@ -140,7 +141,7 @@ namespace TLSharp.Core
|
|||
LastMessageId = lastMessageId,
|
||||
TimeOffset = timeOffset,
|
||||
SessionExpires = sessionExpires,
|
||||
User = user,
|
||||
TLUser = TLUser,
|
||||
SessionUserId = sessionUserId,
|
||||
ServerAddress = serverAddress,
|
||||
Port = port
|
||||
|
|
|
|||
|
|
@ -57,43 +57,24 @@
|
|||
<Compile Include="MTProto\Crypto\RSA.cs" />
|
||||
<Compile Include="MTProto\Crypto\Salt.cs" />
|
||||
<Compile Include="MTProto\Serializers.cs" />
|
||||
<Compile Include="MTProto\TL.cs" />
|
||||
<Compile Include="Network\MtProtoPlainSender.cs" />
|
||||
<Compile Include="Network\MtProtoSender.cs" />
|
||||
<Compile Include="Network\TcpMessage.cs" />
|
||||
<Compile Include="Network\TcpTransport.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Requests\AckRequest.cs" />
|
||||
<Compile Include="Requests\AuthCheckPhoneRequest.cs" />
|
||||
<Compile Include="Requests\AuthSendCodeRequest.cs" />
|
||||
<Compile Include="Requests\AuthSendSmsRequest.cs" />
|
||||
<Compile Include="Requests\AuthSignInRequest.cs" />
|
||||
<Compile Include="Requests\AuthSignUpRequest.cs" />
|
||||
<Compile Include="Requests\GetUpdatesDifferenceRequest.cs" />
|
||||
<Compile Include="Requests\GetContactsRequest.cs" />
|
||||
<Compile Include="Requests\GetDialogsRequest.cs" />
|
||||
<Compile Include="Requests\GetFileRequest.cs" />
|
||||
<Compile Include="Requests\GetHistoryRequest.cs" />
|
||||
<Compile Include="Requests\GetNearestDcRequest.cs" />
|
||||
<Compile Include="Requests\GetUpdatesStateRequest.cs" />
|
||||
<Compile Include="Requests\GetUserFullRequest.cs" />
|
||||
<Compile Include="Requests\GetUsersRequest.cs" />
|
||||
<Compile Include="Requests\ImportByUserName.cs" />
|
||||
<Compile Include="Requests\ImportContactRequest.cs" />
|
||||
<Compile Include="Requests\InitConnectionRequest.cs" />
|
||||
<Compile Include="Requests\MTProtoRequest.cs" />
|
||||
<Compile Include="Requests\SendMessageRequest.cs" />
|
||||
<Compile Include="Requests\Message_SendMediaRequest.cs" />
|
||||
<Compile Include="Requests\Upload_SaveFilePartRequest.cs" />
|
||||
<Compile Include="Session.cs" />
|
||||
<Compile Include="TelegramClient.cs" />
|
||||
<Compile Include="Utils\Helpers.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
<Compile Include="Requests\CreateChatRequest.cs" />
|
||||
<Compile Include="Requests\AddChatUserRequest.cs" />
|
||||
<Compile Include="Requests\DeleteChatUserRequest.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\TeleSharp.TL\TeleSharp.TL.csproj">
|
||||
<Project>{d6144517-91d2-4880-86df-e9ff5d7f383a}</Project>
|
||||
<Name>TeleSharp.TL</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
|
|
|||
|
|
@ -9,7 +9,10 @@ using TLSharp.Core.MTProto;
|
|||
using TLSharp.Core.MTProto.Crypto;
|
||||
using TLSharp.Core.Network;
|
||||
using TLSharp.Core.Requests;
|
||||
using TeleSharp.TL;
|
||||
using MD5 = System.Security.Cryptography.MD5;
|
||||
using TeleSharp.TL.Help;
|
||||
using TeleSharp.TL.Auth;
|
||||
|
||||
namespace TLSharp.Core
|
||||
{
|
||||
|
|
@ -21,12 +24,11 @@ namespace TLSharp.Core
|
|||
private string _apiHash = "";
|
||||
private int _apiId = 0;
|
||||
private Session _session;
|
||||
private List<DcOption> dcOptions;
|
||||
|
||||
public enum sms_type { numeric_code_via_sms = 0, numeric_code_via_telegram = 5 }
|
||||
private List<TLDcOption> dcOptions;
|
||||
|
||||
public TelegramClient(ISessionStore store, string sessionUserId, int apiId, string apiHash)
|
||||
{
|
||||
TLContext.Init();
|
||||
_apiHash = apiHash;
|
||||
_apiId = apiId;
|
||||
if (_apiId == 0)
|
||||
|
|
@ -34,7 +36,6 @@ namespace TLSharp.Core
|
|||
|
||||
if (string.IsNullOrEmpty(_apiHash))
|
||||
throw new InvalidOperationException("Your API_ID is invalid. Do a configuration first https://github.com/sochix/TLSharp#quick-configuration");
|
||||
|
||||
_session = Session.TryLoadOrCreateNew(store, sessionUserId);
|
||||
_transport = new TcpTransport(_session.ServerAddress, _session.Port);
|
||||
}
|
||||
|
|
@ -52,12 +53,13 @@ namespace TLSharp.Core
|
|||
|
||||
if (!reconnect)
|
||||
{
|
||||
var request = new InitConnectionRequest(_apiId);
|
||||
var config = new TLRequestGetConfig() ;
|
||||
var request = new TLRequestInitConnection() { api_id = _apiId, app_version = "1.0.0", device_model = "PC", lang_code = "en", query= config, system_version = "Win 10.0" };
|
||||
var invokewithLayer = new TLRequestInvokeWithLayer() { layer = 53, query = request };
|
||||
await _sender.Send(invokewithLayer);
|
||||
await _sender.Receive(invokewithLayer);
|
||||
|
||||
await _sender.Send(request);
|
||||
await _sender.Receive(request);
|
||||
|
||||
dcOptions = request.ConfigConstructor.dc_options;
|
||||
dcOptions = ((TLConfig)invokewithLayer.Response).dc_options.lists;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -68,7 +70,7 @@ namespace TLSharp.Core
|
|||
if (dcOptions == null || !dcOptions.Any())
|
||||
throw new InvalidOperationException($"Can't reconnect. Establish initial connection first.");
|
||||
|
||||
var dc = dcOptions.Cast<DcOptionConstructor>().First(d => d.id == dcId);
|
||||
var dc = dcOptions.First(d => d.id == dcId);
|
||||
|
||||
_transport = new TcpTransport(dc.ip_address, dc.port);
|
||||
_session.ServerAddress = dc.ip_address;
|
||||
|
|
@ -79,7 +81,7 @@ namespace TLSharp.Core
|
|||
|
||||
public bool IsUserAuthorized()
|
||||
{
|
||||
return _session.User != null;
|
||||
return _session.TLUser != null;
|
||||
}
|
||||
|
||||
public async Task<bool> IsPhoneRegistered(string phoneNumber)
|
||||
|
|
@ -87,22 +89,22 @@ namespace TLSharp.Core
|
|||
if (_sender == null)
|
||||
throw new InvalidOperationException("Not connected!");
|
||||
|
||||
var authCheckPhoneRequest = new AuthCheckPhoneRequest(phoneNumber);
|
||||
var authCheckPhoneRequest = new TLRequestCheckPhone() { phone_number = phoneNumber };
|
||||
await _sender.Send(authCheckPhoneRequest);
|
||||
await _sender.Receive(authCheckPhoneRequest);
|
||||
|
||||
return authCheckPhoneRequest._phoneRegistered;
|
||||
return authCheckPhoneRequest.Response.phone_registered;
|
||||
}
|
||||
|
||||
public async Task<string> SendCodeRequest(string phoneNumber, sms_type tokenDestination = sms_type.numeric_code_via_telegram)
|
||||
public async Task<string> SendCodeRequest(string phoneNumber)
|
||||
{
|
||||
var completed = false;
|
||||
|
||||
AuthSendCodeRequest request = null;
|
||||
TLRequestSendCode request = null;
|
||||
|
||||
while (!completed)
|
||||
{
|
||||
request = new AuthSendCodeRequest(phoneNumber, (int)tokenDestination, _apiId, _apiHash, "en");
|
||||
request = new TLRequestSendCode() { phone_number = phoneNumber, api_id = _apiId, api_hash = _apiHash };
|
||||
try
|
||||
{
|
||||
await _sender.Send(request);
|
||||
|
|
@ -123,261 +125,43 @@ namespace TLSharp.Core
|
|||
}
|
||||
}
|
||||
|
||||
return request._phoneCodeHash;
|
||||
return request.Response.phone_code_hash;
|
||||
}
|
||||
|
||||
public async Task<User> MakeAuth(string phoneNumber, string phoneCodeHash, string code)
|
||||
public async Task<TLUser> MakeAuth(string phoneNumber, string phoneCodeHash, string code)
|
||||
{
|
||||
var request = new AuthSignInRequest(phoneNumber, phoneCodeHash, code);
|
||||
var request = new TLRequestSignIn() { phone_number = phoneNumber, phone_code_hash = phoneCodeHash, phone_code = code };
|
||||
await _sender.Send(request);
|
||||
await _sender.Receive(request);
|
||||
|
||||
OnUserAuthenticated(request.user, request.SessionExpires);
|
||||
OnUserAuthenticated(((TLUser)request.Response.user));
|
||||
|
||||
return request.user;
|
||||
return ((TLUser)request.Response.user);
|
||||
}
|
||||
|
||||
public async Task<User> SignUp(string phoneNumber, string phoneCodeHash, string code, string firstName, string lastName)
|
||||
public async Task<TLUser> SignUp(string phoneNumber, string phoneCodeHash, string code, string firstName, string lastName)
|
||||
{
|
||||
var request = new AuthSignUpRequest(phoneNumber, phoneCodeHash, code, firstName, lastName);
|
||||
var request = new TLRequestSignUp() { phone_number = phoneNumber, phone_code = code, phone_code_hash = phoneCodeHash, first_name = firstName, last_name = lastName };
|
||||
await _sender.Send(request);
|
||||
await _sender.Receive(request);
|
||||
|
||||
OnUserAuthenticated(request.user, request.SessionExpires);
|
||||
OnUserAuthenticated(((TLUser)request.Response.user));
|
||||
|
||||
return request.user;
|
||||
return ((TLUser)request.Response.user);
|
||||
}
|
||||
|
||||
private void OnUserAuthenticated(User user, int sessionExpiration)
|
||||
public async Task<T> SendRequest<T>(TLMethod methodtoExceute)
|
||||
{
|
||||
_session.User = user;
|
||||
_session.SessionExpires = sessionExpiration;
|
||||
await _sender.Send(methodtoExceute);
|
||||
await _sender.Receive(methodtoExceute);
|
||||
return (T)Convert.ChangeType(typeof(TLMethod).GetProperty("Response").GetValue(methodtoExceute),typeof(T));
|
||||
}
|
||||
private void OnUserAuthenticated(TLUser TLUser)
|
||||
{
|
||||
_session.TLUser = TLUser;
|
||||
_session.SessionExpires = int.MaxValue;
|
||||
|
||||
_session.Save();
|
||||
}
|
||||
|
||||
public async Task<InputFile> UploadFile(string name, byte[] data)
|
||||
{
|
||||
var partSize = 65536;
|
||||
|
||||
var file_id = DateTime.Now.Ticks;
|
||||
|
||||
var partedData = new Dictionary<int, byte[]>();
|
||||
var parts = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(data.Length) / Convert.ToDouble(partSize)));
|
||||
var remainBytes = data.Length;
|
||||
for (int i = 0; i < parts; i++)
|
||||
{
|
||||
partedData.Add(i, data
|
||||
.Skip(i * partSize)
|
||||
.Take(remainBytes < partSize ? remainBytes : partSize)
|
||||
.ToArray());
|
||||
|
||||
remainBytes -= partSize;
|
||||
}
|
||||
|
||||
for (int i = 0; i < parts; i++)
|
||||
{
|
||||
var saveFilePartRequest = new Upload_SaveFilePartRequest(file_id, i, partedData[i]);
|
||||
await _sender.Send(saveFilePartRequest);
|
||||
await _sender.Receive(saveFilePartRequest);
|
||||
|
||||
if (saveFilePartRequest.Done == false)
|
||||
throw new InvalidOperationException($"File part {i} does not uploaded");
|
||||
}
|
||||
|
||||
string md5_checksum;
|
||||
using (var md5 = MD5.Create())
|
||||
{
|
||||
var hash = md5.ComputeHash(data);
|
||||
var hashResult = new StringBuilder(hash.Length * 2);
|
||||
|
||||
for (int i = 0; i < hash.Length; i++)
|
||||
hashResult.Append(hash[i].ToString("x2"));
|
||||
|
||||
md5_checksum = hashResult.ToString();
|
||||
}
|
||||
|
||||
var inputFile = new InputFileConstructor(file_id, parts, name, md5_checksum);
|
||||
|
||||
return inputFile;
|
||||
}
|
||||
|
||||
public async Task<bool> SendMediaMessage(int contactId, InputFile file)
|
||||
{
|
||||
var request = new Message_SendMediaRequest(
|
||||
new InputPeerContactConstructor(contactId),
|
||||
new InputMediaUploadedPhotoConstructor(file));
|
||||
|
||||
await _sender.Send(request);
|
||||
await _sender.Receive(request);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public async Task<int?> ImportContactByPhoneNumber(string phoneNumber)
|
||||
{
|
||||
if (!validateNumber(phoneNumber))
|
||||
throw new InvalidOperationException("Invalid phone number. It should be only digit string, from 5 to 20 digits.");
|
||||
|
||||
var request = new ImportContactRequest(new InputPhoneContactConstructor(0, phoneNumber, "My Test Name", String.Empty));
|
||||
await _sender.Send(request);
|
||||
await _sender.Receive(request);
|
||||
|
||||
var importedUser = (ImportedContactConstructor)request.imported.FirstOrDefault();
|
||||
|
||||
return importedUser?.user_id;
|
||||
}
|
||||
|
||||
public async Task<int?> ImportByUserName(string username)
|
||||
{
|
||||
if (string.IsNullOrEmpty(username))
|
||||
throw new InvalidOperationException("Username can't be null");
|
||||
|
||||
var request = new ImportByUserName(username);
|
||||
await _sender.Send(request);
|
||||
await _sender.Receive(request);
|
||||
|
||||
return request.id;
|
||||
}
|
||||
|
||||
public async Task SendMessage(int id, string message)
|
||||
{
|
||||
var request = new SendMessageRequest(new InputPeerContactConstructor(id), message);
|
||||
|
||||
await _sender.Send(request);
|
||||
await _sender.Receive(request);
|
||||
}
|
||||
|
||||
public async Task<List<Message>> GetMessagesHistoryForContact(int user_id, int offset, int limit, int max_id = -1)
|
||||
{
|
||||
var request = new GetHistoryRequest(new InputPeerContactConstructor(user_id), offset, max_id, limit);
|
||||
await _sender.Send(request);
|
||||
await _sender.Receive(request);
|
||||
|
||||
return request.messages;
|
||||
}
|
||||
|
||||
public async Task<Tuple<storage_FileType, byte[]>> GetFile(long volume_id, int local_id, long secret, int offset, int limit)
|
||||
{
|
||||
var request = new GetFileRequest(new InputFileLocationConstructor(volume_id, local_id, secret), offset, limit);
|
||||
await _sender.Send(request);
|
||||
await _sender.Receive(request);
|
||||
|
||||
return Tuple.Create(request.type, request.bytes);
|
||||
}
|
||||
|
||||
public async Task<MessageDialogs> GetDialogs(int offset, int limit, int max_id = 0)
|
||||
{
|
||||
var request = new GetDialogsRequest(offset, max_id, limit);
|
||||
await _sender.Send(request);
|
||||
await _sender.Receive(request);
|
||||
|
||||
return new MessageDialogs
|
||||
{
|
||||
Dialogs = request.dialogs,
|
||||
Messages = request.messages,
|
||||
Chats = request.chats,
|
||||
Users = request.users,
|
||||
};
|
||||
}
|
||||
|
||||
public async Task<UserFull> GetUserFull(int user_id)
|
||||
{
|
||||
var request = new GetUserFullRequest(user_id);
|
||||
await _sender.Send(request);
|
||||
await _sender.Receive(request);
|
||||
|
||||
return request._userFull;
|
||||
}
|
||||
|
||||
private bool validateNumber(string number)
|
||||
{
|
||||
var regex = new Regex("^\\d{7,20}$");
|
||||
|
||||
return regex.IsMatch(number);
|
||||
}
|
||||
|
||||
public async Task<ContactsContacts> GetContacts(IList<int> contactIds = null)
|
||||
{
|
||||
var request = new GetContactsRequest(contactIds);
|
||||
await _sender.Send(request);
|
||||
await _sender.Receive(request);
|
||||
|
||||
return new ContactsContacts
|
||||
{
|
||||
Contacts = request.Contacts,
|
||||
Users = request.Users,
|
||||
};
|
||||
}
|
||||
|
||||
public async Task<Messages_statedMessageConstructor> CreateChat(string title, List<string> userPhonesToInvite)
|
||||
{
|
||||
var userIdsToInvite = new List<int>();
|
||||
foreach (var userPhone in userPhonesToInvite)
|
||||
{
|
||||
var uid = await ImportContactByPhoneNumber(userPhone);
|
||||
if (!uid.HasValue)
|
||||
throw new InvalidOperationException($"Failed to retrieve contact {userPhone}");
|
||||
|
||||
userIdsToInvite.Add(uid.Value);
|
||||
}
|
||||
|
||||
return await CreateChat(title, userIdsToInvite);
|
||||
}
|
||||
|
||||
public async Task<Messages_statedMessageConstructor> CreateChat(string title, List<int> userIdsToInvite)
|
||||
{
|
||||
var request = new CreateChatRequest(userIdsToInvite.Select(uid => new InputUserContactConstructor(uid)).ToList(), title);
|
||||
|
||||
await _sender.Send(request);
|
||||
await _sender.Receive(request);
|
||||
|
||||
return request.message;
|
||||
}
|
||||
|
||||
public async Task<Messages_statedMessageConstructor> AddChatUser(int chatId, int userId)
|
||||
{
|
||||
var request = new AddChatUserRequest(chatId, new InputUserContactConstructor(userId));
|
||||
|
||||
await _sender.Send(request);
|
||||
await _sender.Receive(request);
|
||||
|
||||
return request.message;
|
||||
}
|
||||
|
||||
public async Task<Messages_statedMessageConstructor> DeleteChatUser(int chatId, int userId)
|
||||
{
|
||||
var request = new DeleteChatUserRequest(chatId, new InputUserContactConstructor(userId));
|
||||
|
||||
await _sender.Send(request);
|
||||
await _sender.Receive(request);
|
||||
|
||||
return request.message;
|
||||
}
|
||||
|
||||
public async Task<Messages_statedMessageConstructor> LeaveChat(int chatId)
|
||||
{
|
||||
return await DeleteChatUser(chatId, ((UserSelfConstructor) _session.User).id);
|
||||
}
|
||||
|
||||
public async Task<updates_State> GetUpdatesState()
|
||||
{
|
||||
var request = new GetUpdatesStateRequest();
|
||||
|
||||
await _sender.Send(request);
|
||||
await _sender.Receive(request);
|
||||
|
||||
return request.updates;
|
||||
}
|
||||
|
||||
public async Task<updates_Difference> GetUpdatesDifference(int lastPts, int lastDate, int lastQts)
|
||||
{
|
||||
var request = new GetUpdatesDifferenceRequest(lastPts, lastDate, lastQts);
|
||||
|
||||
await _sender.Send(request);
|
||||
await _sender.Receive(request);
|
||||
|
||||
return request.updatesDifference;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,6 +59,10 @@
|
|||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\TeleSharp.TL\TeleSharp.TL.csproj">
|
||||
<Project>{d6144517-91d2-4880-86df-e9ff5d7f383a}</Project>
|
||||
<Name>TeleSharp.TL</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\TLSharp.Core\TLSharp.Core.csproj">
|
||||
<Project>{400d2544-1cc6-4d8a-a62c-2292d9947a16}</Project>
|
||||
<Name>TLSharp.Core</Name>
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ namespace TLSharp.Tests
|
|||
|
||||
private string apiHash = "";
|
||||
|
||||
private int apiId = 0;
|
||||
private int apiId;
|
||||
|
||||
[TestInitialize]
|
||||
public void Init()
|
||||
|
|
@ -107,317 +107,5 @@ namespace TLSharp.Tests
|
|||
Assert.IsTrue(result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task ImportContactByPhoneNumber()
|
||||
{
|
||||
// User should be already authenticated!
|
||||
|
||||
var store = new FileSessionStore();
|
||||
var client = new TelegramClient(store, "session", apiId, apiHash);
|
||||
|
||||
await client.Connect();
|
||||
|
||||
Assert.IsTrue(client.IsUserAuthorized());
|
||||
|
||||
var res = await client.ImportContactByPhoneNumber(NumberToSendMessage);
|
||||
|
||||
Assert.IsNotNull(res);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task ImportByUserName()
|
||||
{
|
||||
var store = new FileSessionStore();
|
||||
var client = new TelegramClient(store, "session", apiId, apiHash);
|
||||
|
||||
await client.Connect();
|
||||
|
||||
Assert.IsTrue(client.IsUserAuthorized());
|
||||
|
||||
var res = await client.ImportByUserName(UserNameToSendMessage);
|
||||
|
||||
Assert.IsNotNull(res);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task ImportByUserNameAndSendMessage()
|
||||
{
|
||||
var store = new FileSessionStore();
|
||||
var client = new TelegramClient(store, "session", apiId, apiHash);
|
||||
|
||||
await client.Connect();
|
||||
|
||||
Assert.IsTrue(client.IsUserAuthorized());
|
||||
|
||||
var res = await client.ImportByUserName(UserNameToSendMessage);
|
||||
|
||||
Assert.IsNotNull(res);
|
||||
|
||||
await client.SendMessage(res.Value, "Test message from TelegramClient");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task ImportContactByPhoneNumberAndSendMessage()
|
||||
{
|
||||
// User should be already authenticated!
|
||||
|
||||
var store = new FileSessionStore();
|
||||
var client = new TelegramClient(store, "session", apiId, apiHash);
|
||||
await client.Connect();
|
||||
|
||||
Assert.IsTrue(client.IsUserAuthorized());
|
||||
|
||||
var res = await client.ImportContactByPhoneNumber(NumberToSendMessage);
|
||||
|
||||
Assert.IsNotNull(res);
|
||||
|
||||
await client.SendMessage(res.Value, "Test message from TelegramClient");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task GetHistory()
|
||||
{
|
||||
var store = new FileSessionStore();
|
||||
var client = new TelegramClient(store, "session", apiId, apiHash);
|
||||
await client.Connect();
|
||||
|
||||
Assert.IsTrue(client.IsUserAuthorized());
|
||||
|
||||
var res = await client.ImportContactByPhoneNumber(NumberToSendMessage);
|
||||
|
||||
Assert.IsNotNull(res);
|
||||
|
||||
var hist = await client.GetMessagesHistoryForContact(res.Value, 0, 5);
|
||||
|
||||
Assert.IsNotNull(hist);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task UploadAndSendMedia()
|
||||
{
|
||||
var store = new FileSessionStore();
|
||||
var client = new TelegramClient(store, "session", apiId, apiHash);
|
||||
await client.Connect();
|
||||
|
||||
Assert.IsTrue(client.IsUserAuthorized());
|
||||
|
||||
var res = await client.ImportContactByPhoneNumber(NumberToSendMessage);
|
||||
|
||||
Assert.IsNotNull(res);
|
||||
|
||||
var file = File.ReadAllBytes("../../data/cat.jpg");
|
||||
|
||||
var mediaFile = await client.UploadFile("test_file.jpg", file);
|
||||
|
||||
Assert.IsNotNull(mediaFile);
|
||||
|
||||
var state = await client.SendMediaMessage(res.Value, mediaFile);
|
||||
|
||||
Assert.IsTrue(state);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task GetFile()
|
||||
{
|
||||
// Get uploaded file from last message (ie: cat.jpg)
|
||||
|
||||
var store = new FileSessionStore();
|
||||
var client = new TelegramClient(store, "session", apiId, apiHash);
|
||||
await client.Connect();
|
||||
Assert.IsTrue(client.IsUserAuthorized());
|
||||
|
||||
var res = await client.ImportContactByPhoneNumber(NumberToSendMessage);
|
||||
Assert.IsNotNull(res);
|
||||
|
||||
// Get last message
|
||||
var hist = await client.GetMessagesHistoryForContact(res.Value, 0, 1);
|
||||
Assert.AreEqual(1, hist.Count);
|
||||
|
||||
var message = (MessageConstructor) hist[0];
|
||||
Assert.AreEqual(typeof (MessageMediaPhotoConstructor), message.media.GetType());
|
||||
|
||||
var media = (MessageMediaPhotoConstructor) message.media;
|
||||
Assert.AreEqual(typeof (PhotoConstructor), media.photo.GetType());
|
||||
|
||||
var photo = (PhotoConstructor) media.photo;
|
||||
Assert.AreEqual(3, photo.sizes.Count);
|
||||
Assert.AreEqual(typeof (PhotoSizeConstructor), photo.sizes[2].GetType());
|
||||
|
||||
var photoSize = (PhotoSizeConstructor) photo.sizes[2];
|
||||
Assert.AreEqual(typeof (FileLocationConstructor), photoSize.location.GetType());
|
||||
|
||||
var fileLocation = (FileLocationConstructor) photoSize.location;
|
||||
var file = await client.GetFile(fileLocation.volume_id, fileLocation.local_id, fileLocation.secret, 0, photoSize.size + 1024);
|
||||
storage_FileType type = file.Item1;
|
||||
byte[] bytes = file.Item2;
|
||||
|
||||
string name = "../../data/get_file.";
|
||||
if (type.GetType() == typeof (Storage_fileJpegConstructor))
|
||||
name += "jpg";
|
||||
else if (type.GetType() == typeof (Storage_fileGifConstructor))
|
||||
name += "gif";
|
||||
else if (type.GetType() == typeof (Storage_filePngConstructor))
|
||||
name += "png";
|
||||
|
||||
using (var fileStream = new FileStream(name, FileMode.Create, FileAccess.Write))
|
||||
{
|
||||
fileStream.Write(bytes, 4, photoSize.size); // The first 4 bytes seem to be the error code
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task TestConnection()
|
||||
{
|
||||
var store = new FakeSessionStore();
|
||||
var client = new TelegramClient(store, "", apiId, apiHash);
|
||||
|
||||
Assert.IsTrue(await client.Connect());
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task AuthenticationWorks()
|
||||
{
|
||||
using (var transport = new TcpTransport("91.108.56.165", 443))
|
||||
{
|
||||
var authKey = await Authenticator.DoAuthentication(transport);
|
||||
|
||||
Assert.IsNotNull(authKey.AuthKey.Data);
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task GetUserFullRequest()
|
||||
{
|
||||
var store = new FileSessionStore();
|
||||
var client = new TelegramClient(store, "session", apiId, apiHash);
|
||||
await client.Connect();
|
||||
|
||||
Assert.IsTrue(client.IsUserAuthorized());
|
||||
|
||||
var res = await client.ImportContactByPhoneNumber(NumberToGetUserFull);
|
||||
|
||||
Assert.IsNotNull(res);
|
||||
|
||||
var userFull = await client.GetUserFull(res.Value);
|
||||
|
||||
Assert.IsNotNull(userFull);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task CreateChatRequest()
|
||||
{
|
||||
var client = await InitializeClient();
|
||||
|
||||
var chatName = Guid.NewGuid().ToString();
|
||||
var statedMessage = await client.CreateChat(chatName, new List<string> {NumberToSendMessage});
|
||||
|
||||
var createdChat = GetChatFromStatedMessage(statedMessage);
|
||||
|
||||
Assert.AreEqual(chatName, createdChat.title);
|
||||
Assert.AreEqual(2, createdChat.participants_count);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task AddChatUserRequest()
|
||||
{
|
||||
var client = await InitializeClient();
|
||||
|
||||
var chatName = Guid.NewGuid().ToString();
|
||||
var statedMessageAfterCreation = await client.CreateChat(chatName, new List<string> { NumberToSendMessage });
|
||||
|
||||
var createdChat = GetChatFromStatedMessage(statedMessageAfterCreation);
|
||||
|
||||
var addUserId = await client.ImportContactByPhoneNumber(NumberToAddToChat);
|
||||
|
||||
var statedMessageAfterAddUser = await client.AddChatUser(createdChat.id, addUserId.Value);
|
||||
var modifiedChat = GetChatFromStatedMessage(statedMessageAfterAddUser);
|
||||
|
||||
Assert.AreEqual(createdChat.id, modifiedChat.id);
|
||||
Assert.AreEqual(3, modifiedChat.participants_count);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task LeaveChatRequest()
|
||||
{
|
||||
var client = await InitializeClient();
|
||||
|
||||
var chatName = Guid.NewGuid().ToString();
|
||||
var statedMessageAfterCreation = await client.CreateChat(chatName, new List<string> { NumberToSendMessage });
|
||||
|
||||
var createdChat = GetChatFromStatedMessage(statedMessageAfterCreation);
|
||||
|
||||
var statedMessageAfterLeave = await client.LeaveChat(createdChat.id);
|
||||
var modifiedChat = GetChatFromStatedMessage(statedMessageAfterLeave);
|
||||
|
||||
Assert.AreEqual(createdChat.id, modifiedChat.id);
|
||||
Assert.AreEqual(1, modifiedChat.participants_count);
|
||||
}
|
||||
|
||||
private ChatConstructor GetChatFromStatedMessage(Messages_statedMessageConstructor message)
|
||||
{
|
||||
var serviceMessage = message.message as MessageServiceConstructor;
|
||||
var peerChat = serviceMessage.to_id as PeerChatConstructor;
|
||||
|
||||
var createdChatId = peerChat.chat_id;
|
||||
return message.chats.OfType<ChatConstructor>().Single(c => c.id == createdChatId);
|
||||
}
|
||||
|
||||
private async Task<TelegramClient> InitializeClient()
|
||||
{
|
||||
var store = new FileSessionStore();
|
||||
var client = new TelegramClient(store, "session", apiId, apiHash);
|
||||
await client.Connect();
|
||||
|
||||
if (!client.IsUserAuthorized())
|
||||
{
|
||||
var hash = await client.SendCodeRequest(NumberToAuthenticate);
|
||||
|
||||
var code = ""; // you can change code in debugger
|
||||
Debugger.Break();
|
||||
|
||||
await client.MakeAuth(NumberToAuthenticate, hash, code);
|
||||
}
|
||||
|
||||
Assert.IsTrue(client.IsUserAuthorized());
|
||||
|
||||
return client;
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task GetUpdates()
|
||||
{
|
||||
var store = new FileSessionStore();
|
||||
var client = new TelegramClient(store, "session", apiId, apiHash);
|
||||
await client.Connect();
|
||||
|
||||
Assert.IsTrue(client.IsUserAuthorized());
|
||||
|
||||
var updatesState = await client.GetUpdatesState();
|
||||
var initialState = updatesState as Updates_stateConstructor;
|
||||
|
||||
Assert.IsNotNull(initialState);
|
||||
|
||||
var difference = await client.GetUpdatesDifference(initialState.pts, initialState.date, initialState.qts);
|
||||
Assert.IsNotNull(difference);
|
||||
Assert.AreEqual(difference.Constructor, Constructor.updates_differenceEmpty);
|
||||
|
||||
var userIdToSendMessage = await client.ImportContactByPhoneNumber(NumberToSendMessage);
|
||||
|
||||
await client.SendMessage(userIdToSendMessage.Value, "test");
|
||||
|
||||
var differenceAfterMessage = await client.GetUpdatesDifference(initialState.pts, initialState.date, initialState.qts);
|
||||
|
||||
Assert.IsNotNull(differenceAfterMessage);
|
||||
Assert.AreEqual(differenceAfterMessage.Constructor, Constructor.updates_difference);
|
||||
|
||||
var differenceUpdate = differenceAfterMessage as Updates_differenceConstructor;
|
||||
Assert.IsNotNull(differenceUpdate);
|
||||
Assert.AreEqual(1, differenceUpdate.new_messages.Count);
|
||||
|
||||
var messageUpdate = differenceUpdate.new_messages[0] as MessageConstructor;
|
||||
Assert.IsNotNull(messageUpdate);
|
||||
|
||||
Assert.AreEqual("test", messageUpdate.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
14
TLSharp.sln
14
TLSharp.sln
|
|
@ -1,10 +1,14 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.23107.0
|
||||
VisualStudioVersion = 14.0.24720.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TLSharp.Core", "TLSharp.Core\TLSharp.Core.csproj", "{400D2544-1CC6-4D8A-A62C-2292D9947A16}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TeleSharp.TL", "TeleSharp.TL\TeleSharp.TL.csproj", "{D6144517-91D2-4880-86DF-E9FF5D7F383A}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TeleSharp.Generator", "TeleSharp.Generator\TeleSharp.Generator.csproj", "{9BE3B9D4-9FF6-4DC8-B9CC-EB2E3F390129}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TLSharp.Tests", "TLSharp.Tests\TLSharp.Tests.csproj", "{DE5C0467-EE99-4734-95F2-EFF7A0B99924}"
|
||||
EndProject
|
||||
Global
|
||||
|
|
@ -17,6 +21,14 @@ Global
|
|||
{400D2544-1CC6-4D8A-A62C-2292D9947A16}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{400D2544-1CC6-4D8A-A62C-2292D9947A16}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{400D2544-1CC6-4D8A-A62C-2292D9947A16}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{D6144517-91D2-4880-86DF-E9FF5D7F383A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D6144517-91D2-4880-86DF-E9FF5D7F383A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D6144517-91D2-4880-86DF-E9FF5D7F383A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D6144517-91D2-4880-86DF-E9FF5D7F383A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{9BE3B9D4-9FF6-4DC8-B9CC-EB2E3F390129}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9BE3B9D4-9FF6-4DC8-B9CC-EB2E3F390129}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9BE3B9D4-9FF6-4DC8-B9CC-EB2E3F390129}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9BE3B9D4-9FF6-4DC8-B9CC-EB2E3F390129}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{DE5C0467-EE99-4734-95F2-EFF7A0B99924}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{DE5C0467-EE99-4734-95F2-EFF7A0B99924}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{DE5C0467-EE99-4734-95F2-EFF7A0B99924}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
|
|
|
|||
6
TeleSharp.Generator/App.config
Normal file
6
TeleSharp.Generator/App.config
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
||||
</startup>
|
||||
</configuration>
|
||||
39
TeleSharp.Generator/Constructor.tmp
Normal file
39
TeleSharp.Generator/Constructor.tmp
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TeleSharp.TL;
|
||||
namespace /* NAMESPACE */
|
||||
{
|
||||
[TLObject(/*Constructor*/)]
|
||||
public class /* NAME */ : /* PARENT */
|
||||
{
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return /*Constructor*/;
|
||||
}
|
||||
}
|
||||
|
||||
/* PARAMS */
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
/* COMPUTE */
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
/* DESERIALIZE */
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
/* SERIALIZE */
|
||||
}
|
||||
}
|
||||
}
|
||||
13
TeleSharp.Generator/ConstructorAbs.tmp
Normal file
13
TeleSharp.Generator/ConstructorAbs.tmp
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TeleSharp.TL;
|
||||
namespace /* NAMESPACE */
|
||||
{
|
||||
public abstract class /* NAME */ : TLObject
|
||||
{
|
||||
}
|
||||
}
|
||||
43
TeleSharp.Generator/Method.tmp
Normal file
43
TeleSharp.Generator/Method.tmp
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TeleSharp.TL;
|
||||
namespace /* NAMESPACE */
|
||||
{
|
||||
[TLObject(/*Constructor*/)]
|
||||
public class /* NAME */ : /* PARENT */
|
||||
{
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return /*Constructor*/;
|
||||
}
|
||||
}
|
||||
|
||||
/* PARAMS */
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
/* COMPUTE */
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
/* DESERIALIZE */
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
/* SERIALIZE */
|
||||
}
|
||||
public override void deserializeResponse(BinaryReader br)
|
||||
{
|
||||
/* DESERIALIZEResp */
|
||||
}
|
||||
}
|
||||
}
|
||||
36
TeleSharp.Generator/Models.cs
Normal file
36
TeleSharp.Generator/Models.cs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json.Schema;
|
||||
namespace TeleSharp.Generator
|
||||
{
|
||||
class Method
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string method { get; set; }
|
||||
[Newtonsoft.Json.JsonProperty("params")]
|
||||
public List<Param> Params { get; set; }
|
||||
public string type { get; set; }
|
||||
|
||||
}
|
||||
class Param
|
||||
{
|
||||
public string name { get; set; }
|
||||
public string type { get; set; }
|
||||
}
|
||||
class Constructor
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string predicate { get; set; }
|
||||
[Newtonsoft.Json.JsonProperty("params")]
|
||||
public List<Param> Params { get; set; }
|
||||
public string type { get; set; }
|
||||
}
|
||||
class Schema
|
||||
{
|
||||
public List<Constructor> constructors { get; set; }
|
||||
public List<Method> methods { get; set; }
|
||||
}
|
||||
}
|
||||
433
TeleSharp.Generator/Program.cs
Normal file
433
TeleSharp.Generator/Program.cs
Normal file
|
|
@ -0,0 +1,433 @@
|
|||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.CodeDom;
|
||||
using System.Reflection;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace TeleSharp.Generator
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static List<String> keywords = new List<string>(new string[] { "abstract", "as", "base", "bool", "break", "byte", "case", "catch", "char", "checked", "class", "const", "continue", "decimal", "default", "delegate", "do", "double", "else", "enum", "event", "explicit", "extern", "false", "finally", "fixed", "float", "for", "foreach", "goto", "if", "implicit", "in", "in", "int", "interface", "internal", "is", "lock", "long", "namespace", "new", "null", "object", "operator", "out", "out", "override", "params", "private", "protected", "public", "readonly", "ref", "return", "sbyte", "sealed", "short", "sizeof", "stackalloc", "static", "string", "struct", "switch", "this", "throw", "true", "try", "typeof", "uint", "ulong", "unchecked", "unsafe", "ushort", "using", "virtual", "void", "volatile", "while", "add", "alias", "ascending", "async", "await", "descending", "dynamic", "from", "get", "global", "group", "into", "join", "let", "orderby", "partial", "partial", "remove", "select", "set", "value", "var", "where", "where", "yield" });
|
||||
static List<String> interfacesList = new List<string>();
|
||||
static List<String> classesList = new List<string>();
|
||||
static void Main(string[] args)
|
||||
{
|
||||
|
||||
string AbsStyle = File.ReadAllText("ConstructorAbs.tmp");
|
||||
string NormalStyle = File.ReadAllText("Constructor.tmp");
|
||||
string MethodStyle = File.ReadAllText("Method.tmp");
|
||||
//string method = File.ReadAllText("constructor.tt");
|
||||
string Json = "";
|
||||
string url;
|
||||
if (args.Count() == 0) url = "tl-schema.json"; else url = args[0];
|
||||
|
||||
Json = File.ReadAllText(url);
|
||||
FileStream file = File.OpenWrite("Result.cs");
|
||||
StreamWriter sw = new StreamWriter(file);
|
||||
Schema schema = JsonConvert.DeserializeObject<Schema>(Json);
|
||||
foreach (var c in schema.constructors)
|
||||
{
|
||||
interfacesList.Add(c.type);
|
||||
classesList.Add(c.predicate);
|
||||
}
|
||||
foreach (var c in schema.constructors)
|
||||
{
|
||||
var list = schema.constructors.Where(x => x.type == c.type);
|
||||
if (list.Count() > 1)
|
||||
{
|
||||
string path = (GetNameSpace(c.type).Replace("TeleSharp.TL", "TL\\").Replace(".", "") + "\\" + GetNameofClass(c.type, true) + ".cs").Replace("\\\\", "\\");
|
||||
FileStream classFile = MakeFile(path);
|
||||
using (StreamWriter writer = new StreamWriter(classFile))
|
||||
{
|
||||
string nspace = (GetNameSpace(c.type).Replace("TeleSharp.TL", "TL\\").Replace(".", "")).Replace("\\\\", "\\").Replace("\\", ".");
|
||||
if (nspace.EndsWith("."))
|
||||
nspace = nspace.Remove(nspace.Length - 1, 1);
|
||||
string temp = AbsStyle.Replace("/* NAMESPACE */", "TeleSharp." + nspace);
|
||||
temp = temp.Replace("/* NAME */", GetNameofClass(c.type, true));
|
||||
writer.Write(temp);
|
||||
writer.Close();
|
||||
classFile.Close();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
interfacesList.Remove(list.First().type);
|
||||
list.First().type = "himself";
|
||||
}
|
||||
}
|
||||
foreach (var c in schema.constructors)
|
||||
{
|
||||
string path = (GetNameSpace(c.predicate).Replace("TeleSharp.TL", "TL\\").Replace(".", "") + "\\" + GetNameofClass(c.predicate, false) + ".cs").Replace("\\\\", "\\");
|
||||
FileStream classFile = MakeFile(path);
|
||||
using (StreamWriter writer = new StreamWriter(classFile))
|
||||
{
|
||||
#region About Class
|
||||
string nspace = (GetNameSpace(c.predicate).Replace("TeleSharp.TL", "TL\\").Replace(".", "")).Replace("\\\\", "\\").Replace("\\", ".");
|
||||
if (nspace.EndsWith("."))
|
||||
nspace = nspace.Remove(nspace.Length - 1, 1);
|
||||
string temp = NormalStyle.Replace("/* NAMESPACE */", "TeleSharp." + nspace);
|
||||
temp = (c.type == "himself") ? temp.Replace("/* PARENT */", "TLObject") : temp.Replace("/* PARENT */", GetNameofClass(c.type, true));
|
||||
temp = temp.Replace("/*Constructor*/", c.id.ToString());
|
||||
temp = temp.Replace("/* NAME */", GetNameofClass(c.predicate, false));
|
||||
#endregion
|
||||
#region Fields
|
||||
string fields = "";
|
||||
foreach (var tmp in c.Params)
|
||||
{
|
||||
fields += $" public {CheckForFlagBase(tmp.type, GetTypeName(tmp.type))} {CheckForKeyword(tmp.name)} " + "{get;set;}" + Environment.NewLine;
|
||||
}
|
||||
temp = temp.Replace("/* PARAMS */", fields);
|
||||
#endregion
|
||||
#region ComputeFlagFunc
|
||||
if (!c.Params.Any(x => x.name == "flags")) temp = temp.Replace("/* COMPUTE */", "");
|
||||
else
|
||||
{
|
||||
var compute = "flags = 0;" + Environment.NewLine;
|
||||
foreach (var param in c.Params.Where(x => IsFlagBase(x.type)))
|
||||
{
|
||||
if (IsTrueFlag(param.type))
|
||||
{
|
||||
compute += $"flags = {CheckForKeyword(param.name)} ? (flags | {GetBitMask(param.type)}) : (flags & ~{GetBitMask(param.type)});" + Environment.NewLine;
|
||||
}
|
||||
else
|
||||
{
|
||||
compute += $"flags = {CheckForKeyword(param.name)} != null ? (flags | {GetBitMask(param.type)}) : (flags & ~{GetBitMask(param.type)});" + Environment.NewLine;
|
||||
}
|
||||
}
|
||||
temp = temp.Replace("/* COMPUTE */", compute);
|
||||
}
|
||||
#endregion
|
||||
#region SerializeFunc
|
||||
var serialize = "";
|
||||
|
||||
if (c.Params.Any(x => x.name == "flags")) serialize += "ComputeFlags();" + Environment.NewLine + "bw.Write(flags);" + Environment.NewLine;
|
||||
foreach (var p in c.Params.Where(x => x.name != "flags"))
|
||||
{
|
||||
serialize += WriteWriteCode(p) + Environment.NewLine;
|
||||
}
|
||||
temp = temp.Replace("/* SERIALIZE */", serialize);
|
||||
#endregion
|
||||
#region DeSerializeFunc
|
||||
var deserialize = "";
|
||||
|
||||
foreach (var p in c.Params)
|
||||
{
|
||||
deserialize += WriteReadCode(p) + Environment.NewLine;
|
||||
}
|
||||
temp = temp.Replace("/* DESERIALIZE */", deserialize);
|
||||
#endregion
|
||||
writer.Write(temp);
|
||||
writer.Close();
|
||||
classFile.Close();
|
||||
}
|
||||
}
|
||||
foreach (var c in schema.methods)
|
||||
{
|
||||
if (c.method.Contains("updateUsername"))
|
||||
{
|
||||
|
||||
}
|
||||
string path = (GetNameSpace(c.method).Replace("TeleSharp.TL", "TL\\").Replace(".", "") + "\\" + GetNameofClass(c.method, false,true) + ".cs").Replace("\\\\", "\\");
|
||||
FileStream classFile = MakeFile(path);
|
||||
using (StreamWriter writer = new StreamWriter(classFile))
|
||||
{
|
||||
#region About Class
|
||||
string nspace = (GetNameSpace(c.method).Replace("TeleSharp.TL", "TL\\").Replace(".", "")).Replace("\\\\", "\\").Replace("\\", ".");
|
||||
if (nspace.EndsWith("."))
|
||||
nspace = nspace.Remove(nspace.Length - 1, 1);
|
||||
string temp = MethodStyle.Replace("/* NAMESPACE */", "TeleSharp." + nspace);
|
||||
temp = temp.Replace("/* PARENT */", "TLMethod");
|
||||
temp = temp.Replace("/*Constructor*/", c.id.ToString());
|
||||
temp = temp.Replace("/* NAME */", GetNameofClass(c.method, false,true));
|
||||
#endregion
|
||||
#region Fields
|
||||
string fields = "";
|
||||
foreach (var tmp in c.Params)
|
||||
{
|
||||
fields += $" public {CheckForFlagBase(tmp.type, GetTypeName(tmp.type))} {CheckForKeyword(tmp.name)} " + "{get;set;}" + Environment.NewLine;
|
||||
}
|
||||
fields += $" public {CheckForFlagBase(c.type, GetTypeName(c.type))} Response" + "{ get; set;}" + Environment.NewLine;
|
||||
temp = temp.Replace("/* PARAMS */", fields);
|
||||
#endregion
|
||||
#region ComputeFlagFunc
|
||||
if (!c.Params.Any(x => x.name == "flags")) temp = temp.Replace("/* COMPUTE */", "");
|
||||
else
|
||||
{
|
||||
var compute = "flags = 0;" + Environment.NewLine;
|
||||
foreach (var param in c.Params.Where(x => IsFlagBase(x.type)))
|
||||
{
|
||||
if (IsTrueFlag(param.type))
|
||||
{
|
||||
compute += $"flags = {CheckForKeyword(param.name)} ? (flags | {GetBitMask(param.type)}) : (flags & ~{GetBitMask(param.type)});" + Environment.NewLine;
|
||||
}
|
||||
else
|
||||
{
|
||||
compute += $"flags = {CheckForKeyword(param.name)} != null ? (flags | {GetBitMask(param.type)}) : (flags & ~{GetBitMask(param.type)});" + Environment.NewLine;
|
||||
}
|
||||
}
|
||||
temp = temp.Replace("/* COMPUTE */", compute);
|
||||
}
|
||||
#endregion
|
||||
#region SerializeFunc
|
||||
var serialize = "";
|
||||
|
||||
if (c.Params.Any(x => x.name == "flags")) serialize += "ComputeFlags();" + Environment.NewLine + "bw.Write(flags);" + Environment.NewLine;
|
||||
foreach (var p in c.Params.Where(x => x.name != "flags"))
|
||||
{
|
||||
serialize += WriteWriteCode(p) + Environment.NewLine;
|
||||
}
|
||||
temp = temp.Replace("/* SERIALIZE */", serialize);
|
||||
#endregion
|
||||
#region DeSerializeFunc
|
||||
var deserialize = "";
|
||||
|
||||
foreach (var p in c.Params)
|
||||
{
|
||||
deserialize += WriteReadCode(p) + Environment.NewLine;
|
||||
}
|
||||
temp = temp.Replace("/* DESERIALIZE */", deserialize);
|
||||
#endregion
|
||||
#region DeSerializeRespFunc
|
||||
var deserializeResp = "";
|
||||
Param p2 = new Param() { name = "Response", type = c.type };
|
||||
deserializeResp += WriteReadCode(p2) + Environment.NewLine;
|
||||
temp = temp.Replace("/* DESERIALIZEResp */", deserializeResp);
|
||||
#endregion
|
||||
writer.Write(temp);
|
||||
writer.Close();
|
||||
classFile.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
public static string FormatName(string input)
|
||||
{
|
||||
if (String.IsNullOrEmpty(input))
|
||||
throw new ArgumentException("ARGH!");
|
||||
if (input.IndexOf('.') != -1)
|
||||
{
|
||||
input = input.Replace(".", " ");
|
||||
var temp = "";
|
||||
foreach (var s in input.Split(' '))
|
||||
{
|
||||
temp += FormatName(s) + " ";
|
||||
}
|
||||
input = temp.Trim();
|
||||
}
|
||||
return input.First().ToString().ToUpper() + input.Substring(1);
|
||||
}
|
||||
public static string CheckForKeyword(string name)
|
||||
{
|
||||
if (keywords.Contains(name)) return "@" + name;
|
||||
return name;
|
||||
}
|
||||
public static string GetNameofClass(string type, bool isinterface = false, bool ismethod = false)
|
||||
{
|
||||
if (!ismethod)
|
||||
{
|
||||
if (type.IndexOf('.') != -1 && type.IndexOf('?') == -1)
|
||||
return isinterface ? "TLAbs" + FormatName(type.Split('.')[1]) : "TL" + FormatName(type.Split('.')[1]);
|
||||
else if (type.IndexOf('.') != -1 && type.IndexOf('?') != -1)
|
||||
return isinterface ? "TLAbs" + FormatName(type.Split('?')[1]) : "TL" + FormatName(type.Split('?')[1]);
|
||||
else
|
||||
return isinterface ? "TLAbs" + FormatName(type) : "TL" + FormatName(type);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (type.IndexOf('.') != -1 && type.IndexOf('?') == -1)
|
||||
return "TLRequest" + FormatName(type.Split('.')[1]);
|
||||
else if (type.IndexOf('.') != -1 && type.IndexOf('?') != -1)
|
||||
return "TLRequest" + FormatName(type.Split('?')[1]);
|
||||
else
|
||||
return "TLRequest" + FormatName(type) ;
|
||||
}
|
||||
}
|
||||
private static bool IsFlagBase(string type)
|
||||
{
|
||||
return type.IndexOf("?") != -1;
|
||||
}
|
||||
private static int GetBitMask(string type)
|
||||
{
|
||||
return (int)Math.Pow((double)2, (double)int.Parse(type.Split('?')[0].Split('.')[1]));
|
||||
}
|
||||
private static bool IsTrueFlag(string type)
|
||||
{
|
||||
return type.Split('?')[1] == "true";
|
||||
}
|
||||
public static string GetNameSpace(string type)
|
||||
{
|
||||
if (type.IndexOf('.') != -1)
|
||||
return "TeleSharp.TL" + FormatName(type.Split('.')[0]);
|
||||
else
|
||||
return "TeleSharp.TL";
|
||||
}
|
||||
public static string CheckForFlagBase(string type, string result)
|
||||
{
|
||||
if (type.IndexOf('?') == -1)
|
||||
return result;
|
||||
else
|
||||
{
|
||||
string innerType = type.Split('?')[1];
|
||||
if (innerType == "true") return result;
|
||||
else if ((new string[] {"bool","int", "uint", "long", "double" }).Contains(result)) return result + "?";
|
||||
else return result;
|
||||
}
|
||||
}
|
||||
public static string GetTypeName(string type)
|
||||
{
|
||||
if (type.ToLower().Contains("inputcontact")) return "TLInputPhoneContact";
|
||||
switch (type.ToLower())
|
||||
{
|
||||
case "#":
|
||||
case "int":
|
||||
return "int";
|
||||
case "uint":
|
||||
return "uint";
|
||||
case "long":
|
||||
return "long";
|
||||
case "double":
|
||||
return "double";
|
||||
case "string":
|
||||
return "string";
|
||||
case "bytes":
|
||||
return "byte[]";
|
||||
case "true":
|
||||
case "bool":
|
||||
return "bool";
|
||||
case "!x":
|
||||
return "TLObject";
|
||||
case "x":
|
||||
return "TLObject";
|
||||
}
|
||||
if (type.StartsWith("Vector"))
|
||||
return "TLVector<" + GetTypeName(type.Replace("Vector<", "").Replace(">", "")) + ">";
|
||||
else
|
||||
{
|
||||
if (type.IndexOf('.') != -1 && type.IndexOf('?') == -1)
|
||||
{
|
||||
|
||||
if (interfacesList.Any(x => x.ToLower() == (type).ToLower()))
|
||||
return FormatName(type.Split('.')[0]) + "." + "TLAbs" + type.Split('.')[1];
|
||||
else if (classesList.Any(x => x.ToLower() == (type).ToLower()))
|
||||
return FormatName(type.Split('.')[0]) + "." + "TL" + type.Split('.')[1];
|
||||
else
|
||||
return FormatName(type.Split('.')[1]);
|
||||
}
|
||||
else if (type.IndexOf('?') == -1)
|
||||
{
|
||||
if (interfacesList.Any(x => x.ToLower() == type.ToLower()))
|
||||
return "TLAbs" + type;
|
||||
else if (classesList.Any(x => x.ToLower() == type.ToLower()))
|
||||
return "TL" + type;
|
||||
else
|
||||
return type;
|
||||
}
|
||||
else
|
||||
{
|
||||
return GetTypeName(type.Split('?')[1]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public static string LookTypeInLists(string src)
|
||||
{
|
||||
if (interfacesList.Any(x => x.ToLower() == src.ToLower()))
|
||||
return "TLAbs" + FormatName(src);
|
||||
else if (classesList.Any(x => x.ToLower() == src.ToLower()))
|
||||
return "TL" + FormatName(src);
|
||||
else
|
||||
return src;
|
||||
}
|
||||
public static string WriteWriteCode(Param p, bool flag = false)
|
||||
{
|
||||
switch (p.type.ToLower())
|
||||
{
|
||||
case "#":
|
||||
case "int":
|
||||
return flag ? $"bw.Write({CheckForKeyword(p.name)}.Value);" : $"bw.Write({CheckForKeyword(p.name)});";
|
||||
case "long":
|
||||
return flag ? $"bw.Write({CheckForKeyword(p.name)}.Value);" : $"bw.Write({CheckForKeyword(p.name)});";
|
||||
case "string":
|
||||
return $"StringUtil.Serialize({CheckForKeyword(p.name)},bw);";
|
||||
case "bool":
|
||||
return flag ? $"BoolUtil.Serialize({CheckForKeyword(p.name)}.Value,bw);" : $"BoolUtil.Serialize({CheckForKeyword(p.name)},bw);";
|
||||
case "true":
|
||||
return $"BoolUtil.Serialize({CheckForKeyword(p.name)},bw);";
|
||||
case "bytes":
|
||||
return $"BytesUtil.Serialize({CheckForKeyword(p.name)},bw);";
|
||||
case "double":
|
||||
return flag ? $"bw.Write({CheckForKeyword(p.name)}.Value);" : $"bw.Write({CheckForKeyword(p.name)});";
|
||||
default:
|
||||
if (!IsFlagBase(p.type))
|
||||
return $"ObjectUtils.SerializeObject({CheckForKeyword(p.name)},bw);";
|
||||
else
|
||||
{
|
||||
if (IsTrueFlag(p.type))
|
||||
return $"";
|
||||
else
|
||||
{
|
||||
Param p2 = new Param() { name = p.name, type = p.type.Split('?')[1] };
|
||||
return $"if ((flags & {GetBitMask(p.type).ToString()}) != 0)" + Environment.NewLine +
|
||||
WriteWriteCode(p2, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public static string WriteReadCode(Param p)
|
||||
{
|
||||
switch (p.type.ToLower())
|
||||
{
|
||||
case "#":
|
||||
case "int":
|
||||
return $"{CheckForKeyword(p.name)} = br.ReadInt32();";
|
||||
case "long":
|
||||
return $"{CheckForKeyword(p.name)} = br.ReadInt64();";
|
||||
case "string":
|
||||
return $"{CheckForKeyword(p.name)} = StringUtil.Deserialize(br);";
|
||||
case "bool":
|
||||
case "true":
|
||||
return $"{CheckForKeyword(p.name)} = BoolUtil.Deserialize(br);";
|
||||
case "bytes":
|
||||
return $"{CheckForKeyword(p.name)} = BytesUtil.Deserialize(br);";
|
||||
case "double":
|
||||
return $"{CheckForKeyword(p.name)} = br.ReadDouble();";
|
||||
default:
|
||||
if (!IsFlagBase(p.type))
|
||||
{
|
||||
if (p.type.ToLower().Contains("vector"))
|
||||
{
|
||||
return $"{CheckForKeyword(p.name)} = ({GetTypeName(p.type)})ObjectUtils.DeserializeVector<{GetTypeName(p.type).Replace("TLVector<","").Replace(">","")}>(br);";
|
||||
}
|
||||
else return $"{CheckForKeyword(p.name)} = ({GetTypeName(p.type)})ObjectUtils.DeserializeObject(br);";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (IsTrueFlag(p.type))
|
||||
return $"{CheckForKeyword(p.name)} = (flags & {GetBitMask(p.type).ToString()}) != 0;";
|
||||
else
|
||||
{
|
||||
Param p2 = new Param() { name = p.name, type = p.type.Split('?')[1] };
|
||||
return $"if ((flags & {GetBitMask(p.type).ToString()}) != 0)" + Environment.NewLine +
|
||||
WriteReadCode(p2) + Environment.NewLine +
|
||||
"else" + Environment.NewLine +
|
||||
$"{CheckForKeyword(p.name)} = null;" + Environment.NewLine;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public static FileStream MakeFile(string path)
|
||||
{
|
||||
if (!Directory.Exists(Path.GetDirectoryName(path)))
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(path));
|
||||
if (File.Exists(path))
|
||||
File.Delete(path);
|
||||
return File.OpenWrite(path);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
36
TeleSharp.Generator/Properties/AssemblyInfo.cs
Normal file
36
TeleSharp.Generator/Properties/AssemblyInfo.cs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("TeleSharp.Generator")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("TeleSharp.Generator")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2016")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("9be3b9d4-9ff6-4dc8-b9cc-eb2e3f390129")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
80
TeleSharp.Generator/TeleSharp.Generator.csproj
Normal file
80
TeleSharp.Generator/TeleSharp.Generator.csproj
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{9BE3B9D4-9FF6-4DC8-B9CC-EB2E3F390129}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>TeleSharp.Generator</RootNamespace>
|
||||
<AssemblyName>TeleSharp.Generator</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Models.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
<Content Include="Method.tmp">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Constructor.tmp">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="ConstructorAbs.tmp">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
4
TeleSharp.Generator/packages.config
Normal file
4
TeleSharp.Generator/packages.config
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net452" />
|
||||
</packages>
|
||||
50
TeleSharp.TL/ObjectDeserializer.cs
Normal file
50
TeleSharp.TL/ObjectDeserializer.cs
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
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
|
||||
{
|
||||
public class ObjectUtils
|
||||
{
|
||||
public static object DeserializeObject(BinaryReader reader)
|
||||
{
|
||||
int Constructor = reader.ReadInt32();
|
||||
object obj;
|
||||
Type t =null;
|
||||
try {
|
||||
t = TLContext.getType(Constructor);
|
||||
obj = Activator.CreateInstance(t);
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
throw new InvalidDataException("Constructor Invalid Or Context.Init Not Called !");
|
||||
}
|
||||
if (t.IsSubclassOf(typeof(TLMethod)))
|
||||
{
|
||||
((TLMethod)obj).deserializeResponse(reader);
|
||||
return obj;
|
||||
}
|
||||
else if (t.IsSubclassOf(typeof(TLObject)))
|
||||
{
|
||||
((TLObject)obj).DeserializeBody(reader);
|
||||
return obj;
|
||||
}
|
||||
else throw new NotImplementedException("Weird Type : " + t.Namespace + " | " + t.Name);
|
||||
}
|
||||
public static void SerializeObject(object obj,BinaryWriter writer)
|
||||
{
|
||||
((TLObject)obj).SerializeBody(writer);
|
||||
}
|
||||
public static TLVector<T> DeserializeVector<T>(BinaryReader reader)
|
||||
{
|
||||
if (reader.ReadInt32() != 481674261) throw new InvalidDataException("Bad Constructor");
|
||||
TLVector<T> t = new TLVector<T>();
|
||||
t.DeserializeBody(reader);
|
||||
return t;
|
||||
}
|
||||
}
|
||||
}
|
||||
36
TeleSharp.TL/Properties/AssemblyInfo.cs
Normal file
36
TeleSharp.TL/Properties/AssemblyInfo.cs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("TeleSharp.TL")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("TeleSharp.TL")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2016")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("d6144517-91d2-4880-86df-e9ff5d7f383a")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
13
TeleSharp.TL/TL/Account/TLAbsPassword.cs
Normal file
13
TeleSharp.TL/TL/Account/TLAbsPassword.cs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
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.Account
|
||||
{
|
||||
public abstract class TLAbsPassword : TLObject
|
||||
{
|
||||
}
|
||||
}
|
||||
42
TeleSharp.TL/TL/Account/TLAuthorizations.cs
Normal file
42
TeleSharp.TL/TL/Account/TLAuthorizations.cs
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
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.Account
|
||||
{
|
||||
[TLObject(307276766)]
|
||||
public class TLAuthorizations : TLObject
|
||||
{
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return 307276766;
|
||||
}
|
||||
}
|
||||
|
||||
public TLVector<TLAuthorization> authorizations {get;set;}
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
authorizations = (TLVector<TLAuthorization>)ObjectUtils.DeserializeVector<TLAuthorization>(br);
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
ObjectUtils.SerializeObject(authorizations,bw);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
45
TeleSharp.TL/TL/Account/TLNoPassword.cs
Normal file
45
TeleSharp.TL/TL/Account/TLNoPassword.cs
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
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.Account
|
||||
{
|
||||
[TLObject(-1764049896)]
|
||||
public class TLNoPassword : TLAbsPassword
|
||||
{
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return -1764049896;
|
||||
}
|
||||
}
|
||||
|
||||
public byte[] new_salt {get;set;}
|
||||
public string email_unconfirmed_pattern {get;set;}
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
new_salt = BytesUtil.Deserialize(br);
|
||||
email_unconfirmed_pattern = StringUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
BytesUtil.Serialize(new_salt,bw);
|
||||
StringUtil.Serialize(email_unconfirmed_pattern,bw);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
54
TeleSharp.TL/TL/Account/TLPassword.cs
Normal file
54
TeleSharp.TL/TL/Account/TLPassword.cs
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
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.Account
|
||||
{
|
||||
[TLObject(2081952796)]
|
||||
public class TLPassword : TLAbsPassword
|
||||
{
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return 2081952796;
|
||||
}
|
||||
}
|
||||
|
||||
public byte[] current_salt {get;set;}
|
||||
public byte[] new_salt {get;set;}
|
||||
public string hint {get;set;}
|
||||
public bool has_recovery {get;set;}
|
||||
public string email_unconfirmed_pattern {get;set;}
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
current_salt = BytesUtil.Deserialize(br);
|
||||
new_salt = BytesUtil.Deserialize(br);
|
||||
hint = StringUtil.Deserialize(br);
|
||||
has_recovery = BoolUtil.Deserialize(br);
|
||||
email_unconfirmed_pattern = StringUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
BytesUtil.Serialize(current_salt,bw);
|
||||
BytesUtil.Serialize(new_salt,bw);
|
||||
StringUtil.Serialize(hint,bw);
|
||||
BoolUtil.Serialize(has_recovery,bw);
|
||||
StringUtil.Serialize(email_unconfirmed_pattern,bw);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
80
TeleSharp.TL/TL/Account/TLPasswordInputSettings.cs
Normal file
80
TeleSharp.TL/TL/Account/TLPasswordInputSettings.cs
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
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.Account
|
||||
{
|
||||
[TLObject(-2037289493)]
|
||||
public class TLPasswordInputSettings : TLObject
|
||||
{
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return -2037289493;
|
||||
}
|
||||
}
|
||||
|
||||
public int flags {get;set;}
|
||||
public byte[] new_salt {get;set;}
|
||||
public byte[] new_password_hash {get;set;}
|
||||
public string hint {get;set;}
|
||||
public string email {get;set;}
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
flags = 0;
|
||||
flags = new_salt != null ? (flags | 1) : (flags & ~1);
|
||||
flags = new_password_hash != null ? (flags | 1) : (flags & ~1);
|
||||
flags = hint != null ? (flags | 1) : (flags & ~1);
|
||||
flags = email != null ? (flags | 2) : (flags & ~2);
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
flags = br.ReadInt32();
|
||||
if ((flags & 1) != 0)
|
||||
new_salt = BytesUtil.Deserialize(br);
|
||||
else
|
||||
new_salt = null;
|
||||
|
||||
if ((flags & 1) != 0)
|
||||
new_password_hash = BytesUtil.Deserialize(br);
|
||||
else
|
||||
new_password_hash = null;
|
||||
|
||||
if ((flags & 1) != 0)
|
||||
hint = StringUtil.Deserialize(br);
|
||||
else
|
||||
hint = null;
|
||||
|
||||
if ((flags & 2) != 0)
|
||||
email = StringUtil.Deserialize(br);
|
||||
else
|
||||
email = null;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
ComputeFlags();
|
||||
bw.Write(flags);
|
||||
if ((flags & 1) != 0)
|
||||
BytesUtil.Serialize(new_salt,bw);
|
||||
if ((flags & 1) != 0)
|
||||
BytesUtil.Serialize(new_password_hash,bw);
|
||||
if ((flags & 1) != 0)
|
||||
StringUtil.Serialize(hint,bw);
|
||||
if ((flags & 2) != 0)
|
||||
StringUtil.Serialize(email,bw);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
42
TeleSharp.TL/TL/Account/TLPasswordSettings.cs
Normal file
42
TeleSharp.TL/TL/Account/TLPasswordSettings.cs
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
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.Account
|
||||
{
|
||||
[TLObject(-1212732749)]
|
||||
public class TLPasswordSettings : TLObject
|
||||
{
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return -1212732749;
|
||||
}
|
||||
}
|
||||
|
||||
public string email {get;set;}
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
email = StringUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
StringUtil.Serialize(email,bw);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
45
TeleSharp.TL/TL/Account/TLPrivacyRules.cs
Normal file
45
TeleSharp.TL/TL/Account/TLPrivacyRules.cs
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
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.Account
|
||||
{
|
||||
[TLObject(1430961007)]
|
||||
public class TLPrivacyRules : TLObject
|
||||
{
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1430961007;
|
||||
}
|
||||
}
|
||||
|
||||
public TLVector<TLAbsPrivacyRule> rules {get;set;}
|
||||
public TLVector<TLAbsUser> users {get;set;}
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
rules = (TLVector<TLAbsPrivacyRule>)ObjectUtils.DeserializeVector<TLAbsPrivacyRule>(br);
|
||||
users = (TLVector<TLAbsUser>)ObjectUtils.DeserializeVector<TLAbsUser>(br);
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
ObjectUtils.SerializeObject(rules,bw);
|
||||
ObjectUtils.SerializeObject(users,bw);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
54
TeleSharp.TL/TL/Account/TLRequestChangePhone.cs
Normal file
54
TeleSharp.TL/TL/Account/TLRequestChangePhone.cs
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
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.Account
|
||||
{
|
||||
[TLObject(1891839707)]
|
||||
public class TLRequestChangePhone : TLMethod
|
||||
{
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1891839707;
|
||||
}
|
||||
}
|
||||
|
||||
public string phone_number {get;set;}
|
||||
public string phone_code_hash {get;set;}
|
||||
public string phone_code {get;set;}
|
||||
public TLAbsUser Response{ get; set;}
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
phone_number = StringUtil.Deserialize(br);
|
||||
phone_code_hash = StringUtil.Deserialize(br);
|
||||
phone_code = StringUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
StringUtil.Serialize(phone_number,bw);
|
||||
StringUtil.Serialize(phone_code_hash,bw);
|
||||
StringUtil.Serialize(phone_code,bw);
|
||||
|
||||
}
|
||||
public override void deserializeResponse(BinaryReader br)
|
||||
{
|
||||
Response = (TLAbsUser)ObjectUtils.DeserializeObject(br);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
48
TeleSharp.TL/TL/Account/TLRequestCheckUsername.cs
Normal file
48
TeleSharp.TL/TL/Account/TLRequestCheckUsername.cs
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
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.Account
|
||||
{
|
||||
[TLObject(655677548)]
|
||||
public class TLRequestCheckUsername : TLMethod
|
||||
{
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return 655677548;
|
||||
}
|
||||
}
|
||||
|
||||
public string username {get;set;}
|
||||
public bool Response{ get; set;}
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
username = StringUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
StringUtil.Serialize(username,bw);
|
||||
|
||||
}
|
||||
public override void deserializeResponse(BinaryReader br)
|
||||
{
|
||||
Response = BoolUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
48
TeleSharp.TL/TL/Account/TLRequestDeleteAccount.cs
Normal file
48
TeleSharp.TL/TL/Account/TLRequestDeleteAccount.cs
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
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.Account
|
||||
{
|
||||
[TLObject(1099779595)]
|
||||
public class TLRequestDeleteAccount : TLMethod
|
||||
{
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1099779595;
|
||||
}
|
||||
}
|
||||
|
||||
public string reason {get;set;}
|
||||
public bool Response{ get; set;}
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
reason = StringUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
StringUtil.Serialize(reason,bw);
|
||||
|
||||
}
|
||||
public override void deserializeResponse(BinaryReader br)
|
||||
{
|
||||
Response = BoolUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
45
TeleSharp.TL/TL/Account/TLRequestGetAccountTTL.cs
Normal file
45
TeleSharp.TL/TL/Account/TLRequestGetAccountTTL.cs
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
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.Account
|
||||
{
|
||||
[TLObject(150761757)]
|
||||
public class TLRequestGetAccountTTL : TLMethod
|
||||
{
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return 150761757;
|
||||
}
|
||||
}
|
||||
|
||||
public TLAccountDaysTTL Response{ get; set;}
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
|
||||
}
|
||||
public override void deserializeResponse(BinaryReader br)
|
||||
{
|
||||
Response = (TLAccountDaysTTL)ObjectUtils.DeserializeObject(br);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
45
TeleSharp.TL/TL/Account/TLRequestGetAuthorizations.cs
Normal file
45
TeleSharp.TL/TL/Account/TLRequestGetAuthorizations.cs
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
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.Account
|
||||
{
|
||||
[TLObject(-484392616)]
|
||||
public class TLRequestGetAuthorizations : TLMethod
|
||||
{
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return -484392616;
|
||||
}
|
||||
}
|
||||
|
||||
public Account.TLAuthorizations Response{ get; set;}
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
|
||||
}
|
||||
public override void deserializeResponse(BinaryReader br)
|
||||
{
|
||||
Response = (Account.TLAuthorizations)ObjectUtils.DeserializeObject(br);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
48
TeleSharp.TL/TL/Account/TLRequestGetNotifySettings.cs
Normal file
48
TeleSharp.TL/TL/Account/TLRequestGetNotifySettings.cs
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
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.Account
|
||||
{
|
||||
[TLObject(313765169)]
|
||||
public class TLRequestGetNotifySettings : TLMethod
|
||||
{
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return 313765169;
|
||||
}
|
||||
}
|
||||
|
||||
public TLAbsInputNotifyPeer peer {get;set;}
|
||||
public TLAbsPeerNotifySettings Response{ get; set;}
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
peer = (TLAbsInputNotifyPeer)ObjectUtils.DeserializeObject(br);
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
ObjectUtils.SerializeObject(peer,bw);
|
||||
|
||||
}
|
||||
public override void deserializeResponse(BinaryReader br)
|
||||
{
|
||||
Response = (TLAbsPeerNotifySettings)ObjectUtils.DeserializeObject(br);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
45
TeleSharp.TL/TL/Account/TLRequestGetPassword.cs
Normal file
45
TeleSharp.TL/TL/Account/TLRequestGetPassword.cs
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
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.Account
|
||||
{
|
||||
[TLObject(1418342645)]
|
||||
public class TLRequestGetPassword : TLMethod
|
||||
{
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1418342645;
|
||||
}
|
||||
}
|
||||
|
||||
public Account.TLAbsPassword Response{ get; set;}
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
|
||||
}
|
||||
public override void deserializeResponse(BinaryReader br)
|
||||
{
|
||||
Response = (Account.TLAbsPassword)ObjectUtils.DeserializeObject(br);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
48
TeleSharp.TL/TL/Account/TLRequestGetPasswordSettings.cs
Normal file
48
TeleSharp.TL/TL/Account/TLRequestGetPasswordSettings.cs
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
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.Account
|
||||
{
|
||||
[TLObject(-1131605573)]
|
||||
public class TLRequestGetPasswordSettings : TLMethod
|
||||
{
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return -1131605573;
|
||||
}
|
||||
}
|
||||
|
||||
public byte[] current_password_hash {get;set;}
|
||||
public Account.TLPasswordSettings Response{ get; set;}
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
current_password_hash = BytesUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
BytesUtil.Serialize(current_password_hash,bw);
|
||||
|
||||
}
|
||||
public override void deserializeResponse(BinaryReader br)
|
||||
{
|
||||
Response = (Account.TLPasswordSettings)ObjectUtils.DeserializeObject(br);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
48
TeleSharp.TL/TL/Account/TLRequestGetPrivacy.cs
Normal file
48
TeleSharp.TL/TL/Account/TLRequestGetPrivacy.cs
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
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.Account
|
||||
{
|
||||
[TLObject(-623130288)]
|
||||
public class TLRequestGetPrivacy : TLMethod
|
||||
{
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return -623130288;
|
||||
}
|
||||
}
|
||||
|
||||
public TLAbsInputPrivacyKey key {get;set;}
|
||||
public Account.TLPrivacyRules Response{ get; set;}
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
key = (TLAbsInputPrivacyKey)ObjectUtils.DeserializeObject(br);
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
ObjectUtils.SerializeObject(key,bw);
|
||||
|
||||
}
|
||||
public override void deserializeResponse(BinaryReader br)
|
||||
{
|
||||
Response = (Account.TLPrivacyRules)ObjectUtils.DeserializeObject(br);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
45
TeleSharp.TL/TL/Account/TLRequestGetWallPapers.cs
Normal file
45
TeleSharp.TL/TL/Account/TLRequestGetWallPapers.cs
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
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.Account
|
||||
{
|
||||
[TLObject(-1068696894)]
|
||||
public class TLRequestGetWallPapers : TLMethod
|
||||
{
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return -1068696894;
|
||||
}
|
||||
}
|
||||
|
||||
public TLVector<TLAbsWallPaper> Response{ get; set;}
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
|
||||
}
|
||||
public override void deserializeResponse(BinaryReader br)
|
||||
{
|
||||
Response = (TLVector<TLAbsWallPaper>)ObjectUtils.DeserializeVector<TLAbsWallPaper>(br);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
51
TeleSharp.TL/TL/Account/TLRequestRegisterDevice.cs
Normal file
51
TeleSharp.TL/TL/Account/TLRequestRegisterDevice.cs
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
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.Account
|
||||
{
|
||||
[TLObject(1669245048)]
|
||||
public class TLRequestRegisterDevice : TLMethod
|
||||
{
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1669245048;
|
||||
}
|
||||
}
|
||||
|
||||
public int token_type {get;set;}
|
||||
public string token {get;set;}
|
||||
public bool Response{ get; set;}
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
token_type = br.ReadInt32();
|
||||
token = StringUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
bw.Write(token_type);
|
||||
StringUtil.Serialize(token,bw);
|
||||
|
||||
}
|
||||
public override void deserializeResponse(BinaryReader br)
|
||||
{
|
||||
Response = BoolUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
51
TeleSharp.TL/TL/Account/TLRequestReportPeer.cs
Normal file
51
TeleSharp.TL/TL/Account/TLRequestReportPeer.cs
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
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.Account
|
||||
{
|
||||
[TLObject(-1374118561)]
|
||||
public class TLRequestReportPeer : TLMethod
|
||||
{
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return -1374118561;
|
||||
}
|
||||
}
|
||||
|
||||
public TLAbsInputPeer peer {get;set;}
|
||||
public TLAbsReportReason reason {get;set;}
|
||||
public bool Response{ get; set;}
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
peer = (TLAbsInputPeer)ObjectUtils.DeserializeObject(br);
|
||||
reason = (TLAbsReportReason)ObjectUtils.DeserializeObject(br);
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
ObjectUtils.SerializeObject(peer,bw);
|
||||
ObjectUtils.SerializeObject(reason,bw);
|
||||
|
||||
}
|
||||
public override void deserializeResponse(BinaryReader br)
|
||||
{
|
||||
Response = BoolUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
48
TeleSharp.TL/TL/Account/TLRequestResetAuthorization.cs
Normal file
48
TeleSharp.TL/TL/Account/TLRequestResetAuthorization.cs
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
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.Account
|
||||
{
|
||||
[TLObject(-545786948)]
|
||||
public class TLRequestResetAuthorization : TLMethod
|
||||
{
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return -545786948;
|
||||
}
|
||||
}
|
||||
|
||||
public long hash {get;set;}
|
||||
public bool Response{ get; set;}
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
hash = br.ReadInt64();
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
bw.Write(hash);
|
||||
|
||||
}
|
||||
public override void deserializeResponse(BinaryReader br)
|
||||
{
|
||||
Response = BoolUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
45
TeleSharp.TL/TL/Account/TLRequestResetNotifySettings.cs
Normal file
45
TeleSharp.TL/TL/Account/TLRequestResetNotifySettings.cs
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
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.Account
|
||||
{
|
||||
[TLObject(-612493497)]
|
||||
public class TLRequestResetNotifySettings : TLMethod
|
||||
{
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return -612493497;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Response{ get; set;}
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
|
||||
}
|
||||
public override void deserializeResponse(BinaryReader br)
|
||||
{
|
||||
Response = BoolUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
66
TeleSharp.TL/TL/Account/TLRequestSendChangePhoneCode.cs
Normal file
66
TeleSharp.TL/TL/Account/TLRequestSendChangePhoneCode.cs
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
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.Account
|
||||
{
|
||||
[TLObject(149257707)]
|
||||
public class TLRequestSendChangePhoneCode : TLMethod
|
||||
{
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return 149257707;
|
||||
}
|
||||
}
|
||||
|
||||
public int flags {get;set;}
|
||||
public bool allow_flashcall {get;set;}
|
||||
public string phone_number {get;set;}
|
||||
public bool? current_number {get;set;}
|
||||
public Auth.TLSentCode Response{ get; set;}
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
flags = 0;
|
||||
flags = allow_flashcall ? (flags | 1) : (flags & ~1);
|
||||
flags = current_number != null ? (flags | 1) : (flags & ~1);
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
flags = br.ReadInt32();
|
||||
allow_flashcall = (flags & 1) != 0;
|
||||
phone_number = StringUtil.Deserialize(br);
|
||||
if ((flags & 1) != 0)
|
||||
current_number = BoolUtil.Deserialize(br);
|
||||
else
|
||||
current_number = null;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
ComputeFlags();
|
||||
bw.Write(flags);
|
||||
|
||||
StringUtil.Serialize(phone_number,bw);
|
||||
if ((flags & 1) != 0)
|
||||
BoolUtil.Serialize(current_number.Value,bw);
|
||||
|
||||
}
|
||||
public override void deserializeResponse(BinaryReader br)
|
||||
{
|
||||
Response = (Auth.TLSentCode)ObjectUtils.DeserializeObject(br);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
48
TeleSharp.TL/TL/Account/TLRequestSetAccountTTL.cs
Normal file
48
TeleSharp.TL/TL/Account/TLRequestSetAccountTTL.cs
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
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.Account
|
||||
{
|
||||
[TLObject(608323678)]
|
||||
public class TLRequestSetAccountTTL : TLMethod
|
||||
{
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return 608323678;
|
||||
}
|
||||
}
|
||||
|
||||
public TLAccountDaysTTL ttl {get;set;}
|
||||
public bool Response{ get; set;}
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
ttl = (TLAccountDaysTTL)ObjectUtils.DeserializeObject(br);
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
ObjectUtils.SerializeObject(ttl,bw);
|
||||
|
||||
}
|
||||
public override void deserializeResponse(BinaryReader br)
|
||||
{
|
||||
Response = BoolUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
51
TeleSharp.TL/TL/Account/TLRequestSetPrivacy.cs
Normal file
51
TeleSharp.TL/TL/Account/TLRequestSetPrivacy.cs
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
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.Account
|
||||
{
|
||||
[TLObject(-906486552)]
|
||||
public class TLRequestSetPrivacy : TLMethod
|
||||
{
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return -906486552;
|
||||
}
|
||||
}
|
||||
|
||||
public TLAbsInputPrivacyKey key {get;set;}
|
||||
public TLVector<TLAbsInputPrivacyRule> rules {get;set;}
|
||||
public Account.TLPrivacyRules Response{ get; set;}
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
key = (TLAbsInputPrivacyKey)ObjectUtils.DeserializeObject(br);
|
||||
rules = (TLVector<TLAbsInputPrivacyRule>)ObjectUtils.DeserializeVector<TLAbsInputPrivacyRule>(br);
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
ObjectUtils.SerializeObject(key,bw);
|
||||
ObjectUtils.SerializeObject(rules,bw);
|
||||
|
||||
}
|
||||
public override void deserializeResponse(BinaryReader br)
|
||||
{
|
||||
Response = (Account.TLPrivacyRules)ObjectUtils.DeserializeObject(br);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
51
TeleSharp.TL/TL/Account/TLRequestUnregisterDevice.cs
Normal file
51
TeleSharp.TL/TL/Account/TLRequestUnregisterDevice.cs
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
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.Account
|
||||
{
|
||||
[TLObject(1707432768)]
|
||||
public class TLRequestUnregisterDevice : TLMethod
|
||||
{
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1707432768;
|
||||
}
|
||||
}
|
||||
|
||||
public int token_type {get;set;}
|
||||
public string token {get;set;}
|
||||
public bool Response{ get; set;}
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
token_type = br.ReadInt32();
|
||||
token = StringUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
bw.Write(token_type);
|
||||
StringUtil.Serialize(token,bw);
|
||||
|
||||
}
|
||||
public override void deserializeResponse(BinaryReader br)
|
||||
{
|
||||
Response = BoolUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
48
TeleSharp.TL/TL/Account/TLRequestUpdateDeviceLocked.cs
Normal file
48
TeleSharp.TL/TL/Account/TLRequestUpdateDeviceLocked.cs
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
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.Account
|
||||
{
|
||||
[TLObject(954152242)]
|
||||
public class TLRequestUpdateDeviceLocked : TLMethod
|
||||
{
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return 954152242;
|
||||
}
|
||||
}
|
||||
|
||||
public int period {get;set;}
|
||||
public bool Response{ get; set;}
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
period = br.ReadInt32();
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
bw.Write(period);
|
||||
|
||||
}
|
||||
public override void deserializeResponse(BinaryReader br)
|
||||
{
|
||||
Response = BoolUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
51
TeleSharp.TL/TL/Account/TLRequestUpdateNotifySettings.cs
Normal file
51
TeleSharp.TL/TL/Account/TLRequestUpdateNotifySettings.cs
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
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.Account
|
||||
{
|
||||
[TLObject(-2067899501)]
|
||||
public class TLRequestUpdateNotifySettings : TLMethod
|
||||
{
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return -2067899501;
|
||||
}
|
||||
}
|
||||
|
||||
public TLAbsInputNotifyPeer peer {get;set;}
|
||||
public TLInputPeerNotifySettings settings {get;set;}
|
||||
public bool Response{ get; set;}
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
peer = (TLAbsInputNotifyPeer)ObjectUtils.DeserializeObject(br);
|
||||
settings = (TLInputPeerNotifySettings)ObjectUtils.DeserializeObject(br);
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
ObjectUtils.SerializeObject(peer,bw);
|
||||
ObjectUtils.SerializeObject(settings,bw);
|
||||
|
||||
}
|
||||
public override void deserializeResponse(BinaryReader br)
|
||||
{
|
||||
Response = BoolUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
51
TeleSharp.TL/TL/Account/TLRequestUpdatePasswordSettings.cs
Normal file
51
TeleSharp.TL/TL/Account/TLRequestUpdatePasswordSettings.cs
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
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.Account
|
||||
{
|
||||
[TLObject(-92517498)]
|
||||
public class TLRequestUpdatePasswordSettings : TLMethod
|
||||
{
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return -92517498;
|
||||
}
|
||||
}
|
||||
|
||||
public byte[] current_password_hash {get;set;}
|
||||
public Account.TLPasswordInputSettings new_settings {get;set;}
|
||||
public bool Response{ get; set;}
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
current_password_hash = BytesUtil.Deserialize(br);
|
||||
new_settings = (Account.TLPasswordInputSettings)ObjectUtils.DeserializeObject(br);
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
BytesUtil.Serialize(current_password_hash,bw);
|
||||
ObjectUtils.SerializeObject(new_settings,bw);
|
||||
|
||||
}
|
||||
public override void deserializeResponse(BinaryReader br)
|
||||
{
|
||||
Response = BoolUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
77
TeleSharp.TL/TL/Account/TLRequestUpdateProfile.cs
Normal file
77
TeleSharp.TL/TL/Account/TLRequestUpdateProfile.cs
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
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.Account
|
||||
{
|
||||
[TLObject(2018596725)]
|
||||
public class TLRequestUpdateProfile : TLMethod
|
||||
{
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return 2018596725;
|
||||
}
|
||||
}
|
||||
|
||||
public int flags {get;set;}
|
||||
public string first_name {get;set;}
|
||||
public string last_name {get;set;}
|
||||
public string about {get;set;}
|
||||
public TLAbsUser Response{ get; set;}
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
flags = 0;
|
||||
flags = first_name != null ? (flags | 1) : (flags & ~1);
|
||||
flags = last_name != null ? (flags | 2) : (flags & ~2);
|
||||
flags = about != null ? (flags | 4) : (flags & ~4);
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
flags = br.ReadInt32();
|
||||
if ((flags & 1) != 0)
|
||||
first_name = StringUtil.Deserialize(br);
|
||||
else
|
||||
first_name = null;
|
||||
|
||||
if ((flags & 2) != 0)
|
||||
last_name = StringUtil.Deserialize(br);
|
||||
else
|
||||
last_name = null;
|
||||
|
||||
if ((flags & 4) != 0)
|
||||
about = StringUtil.Deserialize(br);
|
||||
else
|
||||
about = null;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
ComputeFlags();
|
||||
bw.Write(flags);
|
||||
if ((flags & 1) != 0)
|
||||
StringUtil.Serialize(first_name,bw);
|
||||
if ((flags & 2) != 0)
|
||||
StringUtil.Serialize(last_name,bw);
|
||||
if ((flags & 4) != 0)
|
||||
StringUtil.Serialize(about,bw);
|
||||
|
||||
}
|
||||
public override void deserializeResponse(BinaryReader br)
|
||||
{
|
||||
Response = (TLAbsUser)ObjectUtils.DeserializeObject(br);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
48
TeleSharp.TL/TL/Account/TLRequestUpdateStatus.cs
Normal file
48
TeleSharp.TL/TL/Account/TLRequestUpdateStatus.cs
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
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.Account
|
||||
{
|
||||
[TLObject(1713919532)]
|
||||
public class TLRequestUpdateStatus : TLMethod
|
||||
{
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1713919532;
|
||||
}
|
||||
}
|
||||
|
||||
public bool offline {get;set;}
|
||||
public bool Response{ get; set;}
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
offline = BoolUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
BoolUtil.Serialize(offline,bw);
|
||||
|
||||
}
|
||||
public override void deserializeResponse(BinaryReader br)
|
||||
{
|
||||
Response = BoolUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
48
TeleSharp.TL/TL/Account/TLRequestUpdateUsername.cs
Normal file
48
TeleSharp.TL/TL/Account/TLRequestUpdateUsername.cs
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
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.Account
|
||||
{
|
||||
[TLObject(1040964988)]
|
||||
public class TLRequestUpdateUsername : TLMethod
|
||||
{
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1040964988;
|
||||
}
|
||||
}
|
||||
|
||||
public string username {get;set;}
|
||||
public TLAbsUser Response{ get; set;}
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
username = StringUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
StringUtil.Serialize(username,bw);
|
||||
|
||||
}
|
||||
public override void deserializeResponse(BinaryReader br)
|
||||
{
|
||||
Response = (TLAbsUser)ObjectUtils.DeserializeObject(br);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
13
TeleSharp.TL/TL/Auth/TLAbsCodeType.cs
Normal file
13
TeleSharp.TL/TL/Auth/TLAbsCodeType.cs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
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.Auth
|
||||
{
|
||||
public abstract class TLAbsCodeType : TLObject
|
||||
{
|
||||
}
|
||||
}
|
||||
13
TeleSharp.TL/TL/Auth/TLAbsSentCodeType.cs
Normal file
13
TeleSharp.TL/TL/Auth/TLAbsSentCodeType.cs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
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.Auth
|
||||
{
|
||||
public abstract class TLAbsSentCodeType : TLObject
|
||||
{
|
||||
}
|
||||
}
|
||||
42
TeleSharp.TL/TL/Auth/TLAuthorization.cs
Normal file
42
TeleSharp.TL/TL/Auth/TLAuthorization.cs
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
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.Auth
|
||||
{
|
||||
[TLObject(-16553231)]
|
||||
public class TLAuthorization : TLObject
|
||||
{
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return -16553231;
|
||||
}
|
||||
}
|
||||
|
||||
public TLAbsUser user {get;set;}
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
user = (TLAbsUser)ObjectUtils.DeserializeObject(br);
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
ObjectUtils.SerializeObject(user,bw);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
42
TeleSharp.TL/TL/Auth/TLCheckedPhone.cs
Normal file
42
TeleSharp.TL/TL/Auth/TLCheckedPhone.cs
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
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.Auth
|
||||
{
|
||||
[TLObject(-2128698738)]
|
||||
public class TLCheckedPhone : TLObject
|
||||
{
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return -2128698738;
|
||||
}
|
||||
}
|
||||
|
||||
public bool phone_registered {get;set;}
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
phone_registered = BoolUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
BoolUtil.Serialize(phone_registered,bw);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
39
TeleSharp.TL/TL/Auth/TLCodeTypeCall.cs
Normal file
39
TeleSharp.TL/TL/Auth/TLCodeTypeCall.cs
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
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.Auth
|
||||
{
|
||||
[TLObject(1948046307)]
|
||||
public class TLCodeTypeCall : TLAbsCodeType
|
||||
{
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1948046307;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
39
TeleSharp.TL/TL/Auth/TLCodeTypeFlashCall.cs
Normal file
39
TeleSharp.TL/TL/Auth/TLCodeTypeFlashCall.cs
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
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.Auth
|
||||
{
|
||||
[TLObject(577556219)]
|
||||
public class TLCodeTypeFlashCall : TLAbsCodeType
|
||||
{
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return 577556219;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
39
TeleSharp.TL/TL/Auth/TLCodeTypeSms.cs
Normal file
39
TeleSharp.TL/TL/Auth/TLCodeTypeSms.cs
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
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.Auth
|
||||
{
|
||||
[TLObject(1923290508)]
|
||||
public class TLCodeTypeSms : TLAbsCodeType
|
||||
{
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1923290508;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
45
TeleSharp.TL/TL/Auth/TLExportedAuthorization.cs
Normal file
45
TeleSharp.TL/TL/Auth/TLExportedAuthorization.cs
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
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.Auth
|
||||
{
|
||||
[TLObject(-543777747)]
|
||||
public class TLExportedAuthorization : TLObject
|
||||
{
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return -543777747;
|
||||
}
|
||||
}
|
||||
|
||||
public int id {get;set;}
|
||||
public byte[] bytes {get;set;}
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
id = br.ReadInt32();
|
||||
bytes = BytesUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
bw.Write(id);
|
||||
BytesUtil.Serialize(bytes,bw);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
42
TeleSharp.TL/TL/Auth/TLPasswordRecovery.cs
Normal file
42
TeleSharp.TL/TL/Auth/TLPasswordRecovery.cs
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
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.Auth
|
||||
{
|
||||
[TLObject(326715557)]
|
||||
public class TLPasswordRecovery : TLObject
|
||||
{
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return 326715557;
|
||||
}
|
||||
}
|
||||
|
||||
public string email_pattern {get;set;}
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
email_pattern = StringUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
StringUtil.Serialize(email_pattern,bw);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
57
TeleSharp.TL/TL/Auth/TLRequestBindTempAuthKey.cs
Normal file
57
TeleSharp.TL/TL/Auth/TLRequestBindTempAuthKey.cs
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
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.Auth
|
||||
{
|
||||
[TLObject(-841733627)]
|
||||
public class TLRequestBindTempAuthKey : TLMethod
|
||||
{
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return -841733627;
|
||||
}
|
||||
}
|
||||
|
||||
public long perm_auth_key_id {get;set;}
|
||||
public long nonce {get;set;}
|
||||
public int expires_at {get;set;}
|
||||
public byte[] encrypted_message {get;set;}
|
||||
public bool Response{ get; set;}
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
perm_auth_key_id = br.ReadInt64();
|
||||
nonce = br.ReadInt64();
|
||||
expires_at = br.ReadInt32();
|
||||
encrypted_message = BytesUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
bw.Write(perm_auth_key_id);
|
||||
bw.Write(nonce);
|
||||
bw.Write(expires_at);
|
||||
BytesUtil.Serialize(encrypted_message,bw);
|
||||
|
||||
}
|
||||
public override void deserializeResponse(BinaryReader br)
|
||||
{
|
||||
Response = BoolUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
51
TeleSharp.TL/TL/Auth/TLRequestCancelCode.cs
Normal file
51
TeleSharp.TL/TL/Auth/TLRequestCancelCode.cs
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
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.Auth
|
||||
{
|
||||
[TLObject(520357240)]
|
||||
public class TLRequestCancelCode : TLMethod
|
||||
{
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return 520357240;
|
||||
}
|
||||
}
|
||||
|
||||
public string phone_number {get;set;}
|
||||
public string phone_code_hash {get;set;}
|
||||
public bool Response{ get; set;}
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
phone_number = StringUtil.Deserialize(br);
|
||||
phone_code_hash = StringUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
StringUtil.Serialize(phone_number,bw);
|
||||
StringUtil.Serialize(phone_code_hash,bw);
|
||||
|
||||
}
|
||||
public override void deserializeResponse(BinaryReader br)
|
||||
{
|
||||
Response = BoolUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
48
TeleSharp.TL/TL/Auth/TLRequestCheckPassword.cs
Normal file
48
TeleSharp.TL/TL/Auth/TLRequestCheckPassword.cs
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
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.Auth
|
||||
{
|
||||
[TLObject(174260510)]
|
||||
public class TLRequestCheckPassword : TLMethod
|
||||
{
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return 174260510;
|
||||
}
|
||||
}
|
||||
|
||||
public byte[] password_hash {get;set;}
|
||||
public Auth.TLAuthorization Response{ get; set;}
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
password_hash = BytesUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
BytesUtil.Serialize(password_hash,bw);
|
||||
|
||||
}
|
||||
public override void deserializeResponse(BinaryReader br)
|
||||
{
|
||||
Response = (Auth.TLAuthorization)ObjectUtils.DeserializeObject(br);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
48
TeleSharp.TL/TL/Auth/TLRequestCheckPhone.cs
Normal file
48
TeleSharp.TL/TL/Auth/TLRequestCheckPhone.cs
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
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.Auth
|
||||
{
|
||||
[TLObject(1877286395)]
|
||||
public class TLRequestCheckPhone : TLMethod
|
||||
{
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1877286395;
|
||||
}
|
||||
}
|
||||
|
||||
public string phone_number {get;set;}
|
||||
public Auth.TLCheckedPhone Response{ get; set;}
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
phone_number = StringUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
StringUtil.Serialize(phone_number,bw);
|
||||
|
||||
}
|
||||
public override void deserializeResponse(BinaryReader br)
|
||||
{
|
||||
Response = (Auth.TLCheckedPhone)ObjectUtils.DeserializeObject(br);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
48
TeleSharp.TL/TL/Auth/TLRequestExportAuthorization.cs
Normal file
48
TeleSharp.TL/TL/Auth/TLRequestExportAuthorization.cs
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
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.Auth
|
||||
{
|
||||
[TLObject(-440401971)]
|
||||
public class TLRequestExportAuthorization : TLMethod
|
||||
{
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return -440401971;
|
||||
}
|
||||
}
|
||||
|
||||
public int dc_id {get;set;}
|
||||
public Auth.TLExportedAuthorization Response{ get; set;}
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
dc_id = br.ReadInt32();
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
bw.Write(dc_id);
|
||||
|
||||
}
|
||||
public override void deserializeResponse(BinaryReader br)
|
||||
{
|
||||
Response = (Auth.TLExportedAuthorization)ObjectUtils.DeserializeObject(br);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
51
TeleSharp.TL/TL/Auth/TLRequestImportAuthorization.cs
Normal file
51
TeleSharp.TL/TL/Auth/TLRequestImportAuthorization.cs
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
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.Auth
|
||||
{
|
||||
[TLObject(-470837741)]
|
||||
public class TLRequestImportAuthorization : TLMethod
|
||||
{
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return -470837741;
|
||||
}
|
||||
}
|
||||
|
||||
public int id {get;set;}
|
||||
public byte[] bytes {get;set;}
|
||||
public Auth.TLAuthorization Response{ get; set;}
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
id = br.ReadInt32();
|
||||
bytes = BytesUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
bw.Write(id);
|
||||
BytesUtil.Serialize(bytes,bw);
|
||||
|
||||
}
|
||||
public override void deserializeResponse(BinaryReader br)
|
||||
{
|
||||
Response = (Auth.TLAuthorization)ObjectUtils.DeserializeObject(br);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
59
TeleSharp.TL/TL/Auth/TLRequestImportBotAuthorization.cs
Normal file
59
TeleSharp.TL/TL/Auth/TLRequestImportBotAuthorization.cs
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
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.Auth
|
||||
{
|
||||
[TLObject(1738800940)]
|
||||
public class TLRequestImportBotAuthorization : TLMethod
|
||||
{
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1738800940;
|
||||
}
|
||||
}
|
||||
|
||||
public int flags {get;set;}
|
||||
public int api_id {get;set;}
|
||||
public string api_hash {get;set;}
|
||||
public string bot_auth_token {get;set;}
|
||||
public Auth.TLAuthorization Response{ get; set;}
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
flags = 0;
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
flags = br.ReadInt32();
|
||||
api_id = br.ReadInt32();
|
||||
api_hash = StringUtil.Deserialize(br);
|
||||
bot_auth_token = StringUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
ComputeFlags();
|
||||
bw.Write(flags);
|
||||
bw.Write(api_id);
|
||||
StringUtil.Serialize(api_hash,bw);
|
||||
StringUtil.Serialize(bot_auth_token,bw);
|
||||
|
||||
}
|
||||
public override void deserializeResponse(BinaryReader br)
|
||||
{
|
||||
Response = (Auth.TLAuthorization)ObjectUtils.DeserializeObject(br);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
45
TeleSharp.TL/TL/Auth/TLRequestLogOut.cs
Normal file
45
TeleSharp.TL/TL/Auth/TLRequestLogOut.cs
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
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.Auth
|
||||
{
|
||||
[TLObject(1461180992)]
|
||||
public class TLRequestLogOut : TLMethod
|
||||
{
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1461180992;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Response{ get; set;}
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
|
||||
}
|
||||
public override void deserializeResponse(BinaryReader br)
|
||||
{
|
||||
Response = BoolUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
48
TeleSharp.TL/TL/Auth/TLRequestRecoverPassword.cs
Normal file
48
TeleSharp.TL/TL/Auth/TLRequestRecoverPassword.cs
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
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.Auth
|
||||
{
|
||||
[TLObject(1319464594)]
|
||||
public class TLRequestRecoverPassword : TLMethod
|
||||
{
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1319464594;
|
||||
}
|
||||
}
|
||||
|
||||
public string code {get;set;}
|
||||
public Auth.TLAuthorization Response{ get; set;}
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
code = StringUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
StringUtil.Serialize(code,bw);
|
||||
|
||||
}
|
||||
public override void deserializeResponse(BinaryReader br)
|
||||
{
|
||||
Response = (Auth.TLAuthorization)ObjectUtils.DeserializeObject(br);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
45
TeleSharp.TL/TL/Auth/TLRequestRequestPasswordRecovery.cs
Normal file
45
TeleSharp.TL/TL/Auth/TLRequestRequestPasswordRecovery.cs
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
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.Auth
|
||||
{
|
||||
[TLObject(-661144474)]
|
||||
public class TLRequestRequestPasswordRecovery : TLMethod
|
||||
{
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return -661144474;
|
||||
}
|
||||
}
|
||||
|
||||
public Auth.TLPasswordRecovery Response{ get; set;}
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
|
||||
}
|
||||
public override void deserializeResponse(BinaryReader br)
|
||||
{
|
||||
Response = (Auth.TLPasswordRecovery)ObjectUtils.DeserializeObject(br);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
51
TeleSharp.TL/TL/Auth/TLRequestResendCode.cs
Normal file
51
TeleSharp.TL/TL/Auth/TLRequestResendCode.cs
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
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.Auth
|
||||
{
|
||||
[TLObject(1056025023)]
|
||||
public class TLRequestResendCode : TLMethod
|
||||
{
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1056025023;
|
||||
}
|
||||
}
|
||||
|
||||
public string phone_number {get;set;}
|
||||
public string phone_code_hash {get;set;}
|
||||
public Auth.TLSentCode Response{ get; set;}
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
phone_number = StringUtil.Deserialize(br);
|
||||
phone_code_hash = StringUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
StringUtil.Serialize(phone_number,bw);
|
||||
StringUtil.Serialize(phone_code_hash,bw);
|
||||
|
||||
}
|
||||
public override void deserializeResponse(BinaryReader br)
|
||||
{
|
||||
Response = (Auth.TLSentCode)ObjectUtils.DeserializeObject(br);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
45
TeleSharp.TL/TL/Auth/TLRequestResetAuthorizations.cs
Normal file
45
TeleSharp.TL/TL/Auth/TLRequestResetAuthorizations.cs
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
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.Auth
|
||||
{
|
||||
[TLObject(-1616179942)]
|
||||
public class TLRequestResetAuthorizations : TLMethod
|
||||
{
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return -1616179942;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Response{ get; set;}
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
|
||||
}
|
||||
public override void deserializeResponse(BinaryReader br)
|
||||
{
|
||||
Response = BoolUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
72
TeleSharp.TL/TL/Auth/TLRequestSendCode.cs
Normal file
72
TeleSharp.TL/TL/Auth/TLRequestSendCode.cs
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
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.Auth
|
||||
{
|
||||
[TLObject(-2035355412)]
|
||||
public class TLRequestSendCode : TLMethod
|
||||
{
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return -2035355412;
|
||||
}
|
||||
}
|
||||
|
||||
public int flags { get; set; }
|
||||
public bool allow_flashcall { get; set; }
|
||||
public string phone_number { get; set; }
|
||||
public bool? current_number { get; set; }
|
||||
public int api_id { get; set; }
|
||||
public string api_hash { get; set; }
|
||||
public Auth.TLSentCode Response { get; set; }
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
flags = 0;
|
||||
flags = allow_flashcall ? (flags | 1) : (flags & ~1);
|
||||
flags = current_number != null ? (flags | 1) : (flags & ~1);
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
flags = br.ReadInt32();
|
||||
allow_flashcall = (flags & 1) != 0;
|
||||
phone_number = StringUtil.Deserialize(br);
|
||||
if ((flags & 1) != 0)
|
||||
current_number = BoolUtil.Deserialize(br);
|
||||
else
|
||||
current_number = null;
|
||||
|
||||
api_id = br.ReadInt32();
|
||||
api_hash = StringUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
ComputeFlags();
|
||||
bw.Write(flags);
|
||||
|
||||
StringUtil.Serialize(phone_number, bw);
|
||||
if ((flags & 1) != 0)
|
||||
BoolUtil.Serialize(current_number.Value, bw);
|
||||
bw.Write(api_id);
|
||||
StringUtil.Serialize(api_hash, bw);
|
||||
|
||||
}
|
||||
public override void deserializeResponse(BinaryReader br)
|
||||
{
|
||||
Response = (Auth.TLSentCode)ObjectUtils.DeserializeObject(br);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
51
TeleSharp.TL/TL/Auth/TLRequestSendInvites.cs
Normal file
51
TeleSharp.TL/TL/Auth/TLRequestSendInvites.cs
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
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.Auth
|
||||
{
|
||||
[TLObject(1998331287)]
|
||||
public class TLRequestSendInvites : TLMethod
|
||||
{
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1998331287;
|
||||
}
|
||||
}
|
||||
|
||||
public TLVector<string> phone_numbers {get;set;}
|
||||
public string message {get;set;}
|
||||
public bool Response{ get; set;}
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
phone_numbers = (TLVector<string>)ObjectUtils.DeserializeVector<string>(br);
|
||||
message = StringUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
ObjectUtils.SerializeObject(phone_numbers,bw);
|
||||
StringUtil.Serialize(message,bw);
|
||||
|
||||
}
|
||||
public override void deserializeResponse(BinaryReader br)
|
||||
{
|
||||
Response = BoolUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
54
TeleSharp.TL/TL/Auth/TLRequestSignIn.cs
Normal file
54
TeleSharp.TL/TL/Auth/TLRequestSignIn.cs
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
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.Auth
|
||||
{
|
||||
[TLObject(-1126886015)]
|
||||
public class TLRequestSignIn : TLMethod
|
||||
{
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return -1126886015;
|
||||
}
|
||||
}
|
||||
|
||||
public string phone_number {get;set;}
|
||||
public string phone_code_hash {get;set;}
|
||||
public string phone_code {get;set;}
|
||||
public Auth.TLAuthorization Response{ get; set;}
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
phone_number = StringUtil.Deserialize(br);
|
||||
phone_code_hash = StringUtil.Deserialize(br);
|
||||
phone_code = StringUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
StringUtil.Serialize(phone_number,bw);
|
||||
StringUtil.Serialize(phone_code_hash,bw);
|
||||
StringUtil.Serialize(phone_code,bw);
|
||||
|
||||
}
|
||||
public override void deserializeResponse(BinaryReader br)
|
||||
{
|
||||
Response = (Auth.TLAuthorization)ObjectUtils.DeserializeObject(br);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue