Redesign Everything

This commit is contained in:
Afshin Arani 2016-09-24 17:08:26 +03:30
parent b5472c6cd7
commit 6af7c66a81
710 changed files with 32932 additions and 302 deletions

1
.gitignore vendored
View file

@ -64,7 +64,6 @@ artifacts/
*.tlb *.tlb
*.tli *.tli
*.tlh *.tlh
*.tmp
*.tmp_proj *.tmp_proj
*.log *.log
*.vspscc *.vspscc

View file

@ -39,7 +39,7 @@ namespace TLSharp.Core.Network
return confirmed ? _session.Sequence++ * 2 + 1 : _session.Sequence * 2; 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 // TODO: refactor
if (needConfirmation.Any()) if (needConfirmation.Any())
@ -48,7 +48,7 @@ namespace TLSharp.Core.Network
using (var memory = new MemoryStream()) using (var memory = new MemoryStream())
using (var writer = new BinaryWriter(memory)) using (var writer = new BinaryWriter(memory))
{ {
ackRequest.OnSend(writer); ackRequest.SerializeBody(writer);
await Send(memory.ToArray(), ackRequest); await Send(memory.ToArray(), ackRequest);
needConfirmation.Clear(); needConfirmation.Clear();
} }
@ -58,14 +58,14 @@ namespace TLSharp.Core.Network
using (var memory = new MemoryStream()) using (var memory = new MemoryStream())
using (var writer = new BinaryWriter(memory)) using (var writer = new BinaryWriter(memory))
{ {
request.OnSend(writer); request.SerializeBody(writer);
await Send(memory.ToArray(), request); await Send(memory.ToArray(), request);
} }
_session.Save(); _session.Save();
} }
public async Task Send(byte[] packet, MTProtoRequest request) public async Task Send(byte[] packet, TeleSharp.TL.TLMethod request)
{ {
request.MessageId = _session.GetNewMessageId(); request.MessageId = _session.GetNewMessageId();
@ -132,7 +132,7 @@ namespace TLSharp.Core.Network
return new Tuple<byte[], ulong, int>(message, remoteMessageId, remoteSequence); 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) while (!request.ConfirmReceived)
{ {
@ -148,7 +148,7 @@ namespace TLSharp.Core.Network
return null; 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 salt
// TODO: check sessionid // 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(); uint code = messageReader.ReadUInt32();
byte[] packedData = GZipStream.UncompressBuffer(Serializers.Bytes.read(messageReader)); byte[] packedData = GZipStream.UncompressBuffer(Serializers.Bytes.read(messageReader));
@ -238,7 +238,7 @@ namespace TLSharp.Core.Network
return true; 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(); uint code = messageReader.ReadUInt32();
ulong requestId = messageReader.ReadUInt64(); ulong requestId = messageReader.ReadUInt64();
@ -305,7 +305,7 @@ namespace TLSharp.Core.Network
} }
using (var compressedReader = new BinaryReader(ms)) using (var compressedReader = new BinaryReader(ms))
{ {
request.OnResponse(compressedReader); request.deserializeResponse(compressedReader);
} }
} }
} }
@ -317,8 +317,7 @@ namespace TLSharp.Core.Network
else else
{ {
messageReader.BaseStream.Position -= 4; messageReader.BaseStream.Position -= 4;
request.deserializeResponse(messageReader);
request.OnResponse(messageReader);
} }
return false; return false;
@ -382,7 +381,7 @@ namespace TLSharp.Core.Network
return true; 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(); uint code = messageReader.ReadUInt32();
ulong badMsgId = messageReader.ReadUInt64(); ulong badMsgId = messageReader.ReadUInt64();
@ -453,7 +452,7 @@ namespace TLSharp.Core.Network
return false; 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(); uint code = messageReader.ReadUInt32();
int size = messageReader.ReadInt32(); int size = messageReader.ReadInt32();

View file

@ -1,18 +1,20 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using TeleSharp.TL;
namespace TLSharp.Core.Requests namespace TLSharp.Core.Requests
{ {
public class AckRequest : MTProtoRequest public class AckRequest : TeleSharp.TL.TLMethod
{ {
private readonly List<ulong> _msgs; private readonly List<ulong> _msgs;
public AckRequest(List<ulong> msgs) public AckRequest(List<ulong> msgs)
{ {
_msgs = msgs; _msgs = msgs;
} }
public override void OnSend(BinaryWriter writer) public override void SerializeBody(BinaryWriter writer)
{ {
writer.Write(0x62d6b459); // msgs_ack writer.Write(0x62d6b459); // msgs_ack
writer.Write(0x1cb5c415); // Vector 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(); throw new NotImplementedException();
} }
public override bool Confirmed => false; public override bool Confirmed => false;
public override bool Responded { get; } public override bool Responded { get; }
public override int Constructor
{
get
{
return 0x62d6b459;
}
}
} }
} }

View file

@ -26,7 +26,7 @@ namespace TLSharp.Core
public Session Load(string sessionUserId) public Session Load(string sessionUserId)
{ {
var sessionFileName = $"{sessionUserId}.dat"; var sessionFileName = $"{sessionUserId}.dat";
if (!System.IO.File.Exists(sessionFileName)) if (!File.Exists(sessionFileName))
return null; return null;
using (var stream = new FileStream(sessionFileName, FileMode.Open)) using (var stream = new FileStream(sessionFileName, FileMode.Open))
@ -67,7 +67,7 @@ namespace TLSharp.Core
public int TimeOffset { get; set; } public int TimeOffset { get; set; }
public long LastMessageId { get; set; } public long LastMessageId { get; set; }
public int SessionExpires { get; set; } public int SessionExpires { get; set; }
public TeleSharp.TL.User User { get; set; } public TLUser TLUser { get; set; }
private Random random; private Random random;
private ISessionStore _store; private ISessionStore _store;
@ -91,11 +91,11 @@ namespace TLSharp.Core
Serializers.String.write(writer, ServerAddress); Serializers.String.write(writer, ServerAddress);
writer.Write(Port); writer.Write(Port);
if (User != null) if (TLUser != null)
{ {
writer.Write(1); writer.Write(1);
writer.Write(SessionExpires); writer.Write(SessionExpires);
Serializer.Serialize(User, typeof(TeleSharp.TL.User), writer); ObjectUtils.SerializeObject(TLUser, writer);
} }
else else
{ {
@ -123,11 +123,11 @@ namespace TLSharp.Core
var isAuthExsist = reader.ReadInt32() == 1; var isAuthExsist = reader.ReadInt32() == 1;
int sessionExpires = 0; int sessionExpires = 0;
User user = null; TLUser TLUser = null;
if (isAuthExsist) if (isAuthExsist)
{ {
sessionExpires = reader.ReadInt32(); sessionExpires = reader.ReadInt32();
user = (User)Deserializer.Deserialize(typeof(User), reader); TLUser = (TLUser)ObjectUtils.DeserializeObject(reader);
} }
var authData = Serializers.Bytes.read(reader); var authData = Serializers.Bytes.read(reader);
@ -141,7 +141,7 @@ namespace TLSharp.Core
LastMessageId = lastMessageId, LastMessageId = lastMessageId,
TimeOffset = timeOffset, TimeOffset = timeOffset,
SessionExpires = sessionExpires, SessionExpires = sessionExpires,
User = user, TLUser = TLUser,
SessionUserId = sessionUserId, SessionUserId = sessionUserId,
ServerAddress = serverAddress, ServerAddress = serverAddress,
Port = port Port = port

View file

@ -30,10 +30,6 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="BigMath, Version=0.5.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\BigMath.0.5.0\lib\portable-net45+netcore45+wpa81+wp8+MonoAndroid1+MonoTouch1\BigMath.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Ionic.ZLib, Version=2.0.0.14, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Ionic.ZLib, Version=2.0.0.14, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MarkerMetro.Unity.Ionic.Zlib.2.0.0.14\lib\net35\Ionic.ZLib.dll</HintPath> <HintPath>..\packages\MarkerMetro.Unity.Ionic.Zlib.2.0.0.14\lib\net35\Ionic.ZLib.dll</HintPath>
<Private>True</Private> <Private>True</Private>
@ -46,10 +42,6 @@
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.Net.Http" /> <Reference Include="System.Net.Http" />
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
<Reference Include="TeleSharp.TL, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\TeleSharp.TL.1.0.0-CI00000\lib\net452\TeleSharp.TL.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Auth\Authenticator.cs" /> <Compile Include="Auth\Authenticator.cs" />
@ -71,11 +63,6 @@
<Compile Include="Network\TcpTransport.cs" /> <Compile Include="Network\TcpTransport.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Requests\AckRequest.cs" /> <Compile Include="Requests\AckRequest.cs" />
<Compile Include="Requests\AuthSendCodeRequest.cs" />
<Compile Include="Requests\DownloadFileRequest.cs" />
<Compile Include="Requests\AuthSignInRequest.cs" />
<Compile Include="Requests\InitConnectionRequest.cs" />
<Compile Include="Requests\MTProtoRequest.cs" />
<Compile Include="Session.cs" /> <Compile Include="Session.cs" />
<Compile Include="TelegramClient.cs" /> <Compile Include="TelegramClient.cs" />
<Compile Include="Utils\Helpers.cs" /> <Compile Include="Utils\Helpers.cs" />
@ -83,6 +70,12 @@
<ItemGroup> <ItemGroup>
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </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" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- 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. Other similar extension points exist, see Microsoft.Common.targets.

View file

@ -4,13 +4,15 @@ using System.Linq;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading.Tasks; using System.Threading.Tasks;
using TeleSharp.TL;
using TLSharp.Core.Auth; using TLSharp.Core.Auth;
using TLSharp.Core.MTProto; using TLSharp.Core.MTProto;
using TLSharp.Core.MTProto.Crypto; using TLSharp.Core.MTProto.Crypto;
using TLSharp.Core.Network; using TLSharp.Core.Network;
using TLSharp.Core.Requests; using TLSharp.Core.Requests;
using TeleSharp.TL;
using MD5 = System.Security.Cryptography.MD5; using MD5 = System.Security.Cryptography.MD5;
using TeleSharp.TL.Help;
using TeleSharp.TL.Auth;
namespace TLSharp.Core namespace TLSharp.Core
{ {
@ -22,12 +24,11 @@ namespace TLSharp.Core
private string _apiHash = ""; private string _apiHash = "";
private int _apiId = 0; private int _apiId = 0;
private Session _session; private Session _session;
private List<TeleSharp.TL.DcOption> dcOptions; private List<TLDcOption> dcOptions;
public enum sms_type { numeric_code_via_sms = 0, numeric_code_via_telegram = 5 }
public TelegramClient(ISessionStore store, string sessionUserId, int apiId, string apiHash) public TelegramClient(ISessionStore store, string sessionUserId, int apiId, string apiHash)
{ {
TLContext.Init();
_apiHash = apiHash; _apiHash = apiHash;
_apiId = apiId; _apiId = apiId;
if (_apiId == 0) if (_apiId == 0)
@ -35,7 +36,6 @@ namespace TLSharp.Core
if (string.IsNullOrEmpty(_apiHash)) if (string.IsNullOrEmpty(_apiHash))
throw new InvalidOperationException("Your API_ID is invalid. Do a configuration first https://github.com/sochix/TLSharp#quick-configuration"); throw new InvalidOperationException("Your API_ID is invalid. Do a configuration first https://github.com/sochix/TLSharp#quick-configuration");
_session = Session.TryLoadOrCreateNew(store, sessionUserId); _session = Session.TryLoadOrCreateNew(store, sessionUserId);
_transport = new TcpTransport(_session.ServerAddress, _session.Port); _transport = new TcpTransport(_session.ServerAddress, _session.Port);
} }
@ -53,12 +53,13 @@ namespace TLSharp.Core
if (!reconnect) 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); dcOptions = ((TLConfig)invokewithLayer.Response).dc_options.lists;
await _sender.Receive(request);
dcOptions = (request.Configs).dc_options;
} }
return true; return true;
@ -69,30 +70,41 @@ namespace TLSharp.Core
if (dcOptions == null || !dcOptions.Any()) if (dcOptions == null || !dcOptions.Any())
throw new InvalidOperationException($"Can't reconnect. Establish initial connection first."); throw new InvalidOperationException($"Can't reconnect. Establish initial connection first.");
var dc = dcOptions.Cast<DcOption>().First(d => d.id == dcId); var dc = dcOptions.First(d => d.id == dcId);
_transport = new TcpTransport(dc.ip_address, dc.port.Value); _transport = new TcpTransport(dc.ip_address, dc.port);
_session.ServerAddress = dc.ip_address; _session.ServerAddress = dc.ip_address;
_session.Port = dc.port.Value; _session.Port = dc.port;
await Connect(true); await Connect(true);
} }
public bool IsUserAuthorized() public bool IsUserAuthorized()
{ {
return _session.User != null; return _session.TLUser != null;
} }
public async Task<bool> IsPhoneRegistered(string phoneNumber)
public async Task<string> SendCodeRequest(string phoneNumber, sms_type tokenDestination = sms_type.numeric_code_via_telegram) {
if (_sender == null)
throw new InvalidOperationException("Not connected!");
var authCheckPhoneRequest = new TLRequestCheckPhone() { phone_number = phoneNumber };
await _sender.Send(authCheckPhoneRequest);
await _sender.Receive(authCheckPhoneRequest);
return authCheckPhoneRequest.Response.phone_registered;
}
public async Task<string> SendCodeRequest(string phoneNumber)
{ {
var completed = false; var completed = false;
AuthSendCodeRequest request = null; TLRequestSendCode request = null;
while (!completed) while (!completed)
{ {
request = new AuthSendCodeRequest(phoneNumber, (int)tokenDestination, _apiId, _apiHash, "en"); request = new TLRequestSendCode() { phone_number = phoneNumber, api_id = _apiId, api_hash = _apiHash };
try try
{ {
await _sender.Send(request); await _sender.Send(request);
@ -113,261 +125,43 @@ namespace TLSharp.Core
} }
} }
return request._phoneCodeHash; return request.Response.phone_code_hash;
} }
public async Task<TeleSharp.TL.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.Send(request);
await _sender.Receive(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);
// await _sender.Send(request);
// await _sender.Receive(request);
// OnUserAuthenticated(request.user, request.SessionExpires);
// return request.user;
//}
private void OnUserAuthenticated(TeleSharp.TL.User user, int sessionExpiration)
{ {
_session.User = user; var request = new TLRequestSignUp() { phone_number = phoneNumber, phone_code = code, phone_code_hash = phoneCodeHash, first_name = firstName, last_name = lastName };
_session.SessionExpires = sessionExpiration; await _sender.Send(request);
await _sender.Receive(request);
OnUserAuthenticated(((TLUser)request.Response.user));
return ((TLUser)request.Response.user);
}
public async Task<T> SendRequest<T>(TLMethod methodtoExceute)
{
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(); _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;
//}
} }
} }

View file

@ -1,7 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="BigMath" version="0.5.0" targetFramework="net452" />
<package id="DotNetZip" version="1.9.3" targetFramework="net451" /> <package id="DotNetZip" version="1.9.3" targetFramework="net451" />
<package id="MarkerMetro.Unity.Ionic.Zlib" version="2.0.0.14" targetFramework="net452" /> <package id="MarkerMetro.Unity.Ionic.Zlib" version="2.0.0.14" targetFramework="net452" />
<package id="TeleSharp.TL" version="1.0.0-CI00000" targetFramework="net452" />
</packages> </packages>

View 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("TLSharp.Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TLSharp.Tests")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[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("de5c0467-ee99-4734-95f2-eff7a0b99924")]
// 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")]

View file

@ -0,0 +1,98 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{DE5C0467-EE99-4734-95F2-EFF7A0B99924}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>TLSharp.Tests</RootNamespace>
<AssemblyName>TLSharp.Tests</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
<IsCodedUITest>False</IsCodedUITest>
<TestProjectType>UnitTest</TestProjectType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<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' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Configuration" />
</ItemGroup>
<Choose>
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
</ItemGroup>
</When>
<Otherwise>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
</ItemGroup>
</Otherwise>
</Choose>
<ItemGroup>
<Compile Include="TLSharpTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<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>
</ProjectReference>
</ItemGroup>
<Choose>
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
</ItemGroup>
</When>
</Choose>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<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>

View file

@ -0,0 +1,111 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using TLSharp.Core;
using TLSharp.Core.Auth;
using TLSharp.Core.MTProto;
using TLSharp.Core.Network;
namespace TLSharp.Tests
{
[TestClass]
public class TLSharpTests
{
private string NumberToSendMessage { get; set; }
private string NumberToAuthenticate { get; set; }
private string NotRegisteredNumberToSignUp { get; set; }
private string UserNameToSendMessage { get; set; }
private string NumberToGetUserFull { get; set; }
private string NumberToAddToChat { get; set; }
private string apiHash = "";
private int apiId;
[TestInitialize]
public void Init()
{
// Setup your phone numbers in app.config
NumberToAuthenticate = ConfigurationManager.AppSettings[nameof(NumberToAuthenticate)];
if (string.IsNullOrEmpty(NumberToAuthenticate))
Debug.WriteLine("NumberToAuthenticate not configured in app.config! Some tests may fail.");
NotRegisteredNumberToSignUp = ConfigurationManager.AppSettings[nameof(NotRegisteredNumberToSignUp)];
if (string.IsNullOrEmpty(NotRegisteredNumberToSignUp))
Debug.WriteLine("NotRegisteredNumberToSignUp not configured in app.config! Some tests may fail.");
NumberToSendMessage = ConfigurationManager.AppSettings[nameof(NumberToSendMessage)];
if (string.IsNullOrEmpty(NumberToSendMessage))
Debug.WriteLine("NumberToSendMessage not configured in app.config! Some tests may fail.");
UserNameToSendMessage = ConfigurationManager.AppSettings[nameof(UserNameToSendMessage)];
if (string.IsNullOrEmpty(UserNameToSendMessage))
Debug.WriteLine("UserNameToSendMessage not configured in app.config! Some tests may fail.");
NumberToGetUserFull = ConfigurationManager.AppSettings[nameof(NumberToGetUserFull)];
if (string.IsNullOrEmpty(NumberToGetUserFull))
Debug.WriteLine("NumberToGetUserFull not configured in app.config! Some tests may fail.");
NumberToAddToChat = ConfigurationManager.AppSettings[nameof(NumberToAddToChat)];
if (string.IsNullOrEmpty(NumberToAddToChat))
Debug.WriteLine("NumberToAddToChat not configured in app.config! Some tests may fail.");
}
[TestMethod]
public async Task AuthUser()
{
var store = new FileSessionStore();
var client = new TelegramClient(store, "session", apiId, apiHash);
await client.Connect();
var hash = await client.SendCodeRequest(NumberToAuthenticate);
var code = "93463"; // you can change code in debugger
var user = await client.MakeAuth(NumberToAuthenticate, hash, code);
Assert.IsNotNull(user);
Assert.IsTrue(client.IsUserAuthorized());
}
[TestMethod]
public async Task SignUpNewUser()
{
var store = new FileSessionStore();
var client = new TelegramClient(store, "session", apiId, apiHash);
await client.Connect();
var hash = await client.SendCodeRequest(NotRegisteredNumberToSignUp);
var code = "";
var registeredUser = await client.SignUp(NotRegisteredNumberToSignUp, hash, code, "TLSharp", "User");
Assert.IsNotNull(registeredUser);
Assert.IsTrue(client.IsUserAuthorized());
var loggedInUser = await client.MakeAuth(NotRegisteredNumberToSignUp, hash, code);
Assert.IsNotNull(loggedInUser);
}
[TestMethod]
public async Task CheckPhones()
{
var store = new FileSessionStore();
var client = new TelegramClient(store, "session", apiId, apiHash);
await client.Connect();
var result = await client.IsPhoneRegistered(NumberToAuthenticate);
Assert.IsTrue(result);
}
}
}

11
TLSharp.Tests/app.config Normal file
View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="NumberToAuthenticate" value="" />
<add key="NotRegisteredNumberToSignUp" value=""/>
<add key="NumberToSendMessage" value=""/>
<add key="UserNameToSendMessage" value=""/>
<add key="NumberToGetUserFull" value=""/>
<add key="NumberToAddToChat" value=""/>
</appSettings>
</configuration>

BIN
TLSharp.Tests/data/cat.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View file

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
</packages>

View file

@ -5,6 +5,12 @@ VisualStudioVersion = 14.0.24720.0
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TLSharp.Core", "TLSharp.Core\TLSharp.Core.csproj", "{400D2544-1CC6-4D8A-A62C-2292D9947A16}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TLSharp.Core", "TLSharp.Core\TLSharp.Core.csproj", "{400D2544-1CC6-4D8A-A62C-2292D9947A16}"
EndProject 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 Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -15,6 +21,18 @@ Global
{400D2544-1CC6-4D8A-A62C-2292D9947A16}.Debug|Any CPU.Build.0 = Debug|Any CPU {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.ActiveCfg = Release|Any CPU
{400D2544-1CC6-4D8A-A62C-2292D9947A16}.Release|Any CPU.Build.0 = 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
{DE5C0467-EE99-4734-95F2-EFF7A0B99924}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View 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>

View 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 */
}
}
}

View 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
{
}
}

View 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 */
}
}
}

View 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; }
}
}

View 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);
}
}
}

View 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")]

View 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>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net452" />
</packages>

View 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;
}
}
}

View 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")]

View 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
{
}
}

View 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);
}
}
}

View 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);
}
}
}

View 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);
}
}
}

View 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);
}
}
}

View 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);
}
}
}

View 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);
}
}
}

View 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);
}
}
}

View 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);
}
}
}

View 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);
}
}
}

View 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);
}
}
}

View 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);
}
}
}

View 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);
}
}
}

View 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);
}
}
}

View 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);
}
}
}

View 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);
}
}
}

View 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);
}
}
}

View 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);
}
}
}

View 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);
}
}
}

View 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);
}
}
}

View 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);
}
}
}

View 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);
}
}
}

View 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);
}
}
}

View 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);
}
}
}

View 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);
}
}
}

View 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);
}
}
}

View 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);
}
}
}

View 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);
}
}
}

View 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);
}
}
}

View 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);
}
}
}

View 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);
}
}
}

View 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
{
}
}

View 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
{
}
}

View 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);
}
}
}

View 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);
}
}
}

View 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);
}
}
}

View 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);
}
}
}

View 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);
}
}
}

View 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);
}
}
}

View 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);
}
}
}

View 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);
}
}
}

View 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);
}
}
}

View 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);
}
}
}

View 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);
}
}
}

View 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);
}
}
}

View 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);
}
}
}

View 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);
}
}
}

View 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);
}
}
}

View 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);
}
}
}

View 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);
}
}
}

View 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);
}
}
}

View 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);
}
}
}

View 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);
}
}
}

View 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);
}
}
}

View 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);
}
}
}

View file

@ -0,0 +1,60 @@
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(453408308)]
public class TLRequestSignUp : TLMethod
{
public override int Constructor
{
get
{
return 453408308;
}
}
public string phone_number {get;set;}
public string phone_code_hash {get;set;}
public string phone_code {get;set;}
public string first_name {get;set;}
public string last_name {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);
first_name = StringUtil.Deserialize(br);
last_name = 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);
StringUtil.Serialize(first_name,bw);
StringUtil.Serialize(last_name,bw);
}
public override void deserializeResponse(BinaryReader br)
{
Response = (Auth.TLAuthorization)ObjectUtils.DeserializeObject(br);
}
}
}

View 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(1577067778)]
public class TLSentCode : TLObject
{
public override int Constructor
{
get
{
return 1577067778;
}
}
public int flags {get;set;}
public bool phone_registered {get;set;}
public Auth.TLAbsSentCodeType type {get;set;}
public string phone_code_hash {get;set;}
public Auth.TLAbsCodeType next_type {get;set;}
public int? timeout {get;set;}
public void ComputeFlags()
{
flags = 0;
flags = phone_registered ? (flags | 1) : (flags & ~1);
flags = next_type != null ? (flags | 2) : (flags & ~2);
flags = timeout != null ? (flags | 4) : (flags & ~4);
}
public override void DeserializeBody(BinaryReader br)
{
flags = br.ReadInt32();
phone_registered = (flags & 1) != 0;
type = (Auth.TLAbsSentCodeType)ObjectUtils.DeserializeObject(br);
phone_code_hash = StringUtil.Deserialize(br);
if ((flags & 2) != 0)
next_type = (Auth.TLAbsCodeType)ObjectUtils.DeserializeObject(br);
else
next_type = null;
if ((flags & 4) != 0)
timeout = br.ReadInt32();
else
timeout = null;
}
public override void SerializeBody(BinaryWriter bw)
{
bw.Write(Constructor);
ComputeFlags();
bw.Write(flags);
ObjectUtils.SerializeObject(type,bw);
StringUtil.Serialize(phone_code_hash,bw);
if ((flags & 2) != 0)
ObjectUtils.SerializeObject(next_type,bw);
if ((flags & 4) != 0)
bw.Write(timeout.Value);
}
}
}

View 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(1035688326)]
public class TLSentCodeTypeApp : TLAbsSentCodeType
{
public override int Constructor
{
get
{
return 1035688326;
}
}
public int length {get;set;}
public void ComputeFlags()
{
}
public override void DeserializeBody(BinaryReader br)
{
length = br.ReadInt32();
}
public override void SerializeBody(BinaryWriter bw)
{
bw.Write(Constructor);
bw.Write(length);
}
}
}

View 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(1398007207)]
public class TLSentCodeTypeCall : TLAbsSentCodeType
{
public override int Constructor
{
get
{
return 1398007207;
}
}
public int length {get;set;}
public void ComputeFlags()
{
}
public override void DeserializeBody(BinaryReader br)
{
length = br.ReadInt32();
}
public override void SerializeBody(BinaryWriter bw)
{
bw.Write(Constructor);
bw.Write(length);
}
}
}

View 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(-1425815847)]
public class TLSentCodeTypeFlashCall : TLAbsSentCodeType
{
public override int Constructor
{
get
{
return -1425815847;
}
}
public string pattern {get;set;}
public void ComputeFlags()
{
}
public override void DeserializeBody(BinaryReader br)
{
pattern = StringUtil.Deserialize(br);
}
public override void SerializeBody(BinaryWriter bw)
{
bw.Write(Constructor);
StringUtil.Serialize(pattern,bw);
}
}
}

View 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(-1073693790)]
public class TLSentCodeTypeSms : TLAbsSentCodeType
{
public override int Constructor
{
get
{
return -1073693790;
}
}
public int length {get;set;}
public void ComputeFlags()
{
}
public override void DeserializeBody(BinaryReader br)
{
length = br.ReadInt32();
}
public override void SerializeBody(BinaryWriter bw)
{
bw.Write(Constructor);
bw.Write(length);
}
}
}

View 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.Channels
{
[TLObject(-791039645)]
public class TLChannelParticipant : TLObject
{
public override int Constructor
{
get
{
return -791039645;
}
}
public TLAbsChannelParticipant participant {get;set;}
public TLVector<TLAbsUser> users {get;set;}
public void ComputeFlags()
{
}
public override void DeserializeBody(BinaryReader br)
{
participant = (TLAbsChannelParticipant)ObjectUtils.DeserializeObject(br);
users = (TLVector<TLAbsUser>)ObjectUtils.DeserializeVector<TLAbsUser>(br);
}
public override void SerializeBody(BinaryWriter bw)
{
bw.Write(Constructor);
ObjectUtils.SerializeObject(participant,bw);
ObjectUtils.SerializeObject(users,bw);
}
}
}

View 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.Channels
{
[TLObject(-177282392)]
public class TLChannelParticipants : TLObject
{
public override int Constructor
{
get
{
return -177282392;
}
}
public int count {get;set;}
public TLVector<TLAbsChannelParticipant> participants {get;set;}
public TLVector<TLAbsUser> users {get;set;}
public void ComputeFlags()
{
}
public override void DeserializeBody(BinaryReader br)
{
count = br.ReadInt32();
participants = (TLVector<TLAbsChannelParticipant>)ObjectUtils.DeserializeVector<TLAbsChannelParticipant>(br);
users = (TLVector<TLAbsUser>)ObjectUtils.DeserializeVector<TLAbsUser>(br);
}
public override void SerializeBody(BinaryWriter bw)
{
bw.Write(Constructor);
bw.Write(count);
ObjectUtils.SerializeObject(participants,bw);
ObjectUtils.SerializeObject(users,bw);
}
}
}

View 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.Channels
{
[TLObject(283557164)]
public class TLRequestCheckUsername : TLMethod
{
public override int Constructor
{
get
{
return 283557164;
}
}
public TLAbsInputChannel channel {get;set;}
public string username {get;set;}
public bool Response{ get; set;}
public void ComputeFlags()
{
}
public override void DeserializeBody(BinaryReader br)
{
channel = (TLAbsInputChannel)ObjectUtils.DeserializeObject(br);
username = StringUtil.Deserialize(br);
}
public override void SerializeBody(BinaryWriter bw)
{
bw.Write(Constructor);
ObjectUtils.SerializeObject(channel,bw);
StringUtil.Serialize(username,bw);
}
public override void deserializeResponse(BinaryReader br)
{
Response = BoolUtil.Deserialize(br);
}
}
}

View file

@ -0,0 +1,64 @@
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.Channels
{
[TLObject(-192332417)]
public class TLRequestCreateChannel : TLMethod
{
public override int Constructor
{
get
{
return -192332417;
}
}
public int flags {get;set;}
public bool broadcast {get;set;}
public bool megagroup {get;set;}
public string title {get;set;}
public string about {get;set;}
public TLAbsUpdates Response{ get; set;}
public void ComputeFlags()
{
flags = 0;
flags = broadcast ? (flags | 1) : (flags & ~1);
flags = megagroup ? (flags | 2) : (flags & ~2);
}
public override void DeserializeBody(BinaryReader br)
{
flags = br.ReadInt32();
broadcast = (flags & 1) != 0;
megagroup = (flags & 2) != 0;
title = StringUtil.Deserialize(br);
about = StringUtil.Deserialize(br);
}
public override void SerializeBody(BinaryWriter bw)
{
bw.Write(Constructor);
ComputeFlags();
bw.Write(flags);
StringUtil.Serialize(title,bw);
StringUtil.Serialize(about,bw);
}
public override void deserializeResponse(BinaryReader br)
{
Response = (TLAbsUpdates)ObjectUtils.DeserializeObject(br);
}
}
}

View 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.Channels
{
[TLObject(-1072619549)]
public class TLRequestDeleteChannel : TLMethod
{
public override int Constructor
{
get
{
return -1072619549;
}
}
public TLAbsInputChannel channel {get;set;}
public TLAbsUpdates Response{ get; set;}
public void ComputeFlags()
{
}
public override void DeserializeBody(BinaryReader br)
{
channel = (TLAbsInputChannel)ObjectUtils.DeserializeObject(br);
}
public override void SerializeBody(BinaryWriter bw)
{
bw.Write(Constructor);
ObjectUtils.SerializeObject(channel,bw);
}
public override void deserializeResponse(BinaryReader br)
{
Response = (TLAbsUpdates)ObjectUtils.DeserializeObject(br);
}
}
}

View 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.Channels
{
[TLObject(-2067661490)]
public class TLRequestDeleteMessages : TLMethod
{
public override int Constructor
{
get
{
return -2067661490;
}
}
public TLAbsInputChannel channel {get;set;}
public TLVector<int> id {get;set;}
public Messages.TLAffectedMessages Response{ get; set;}
public void ComputeFlags()
{
}
public override void DeserializeBody(BinaryReader br)
{
channel = (TLAbsInputChannel)ObjectUtils.DeserializeObject(br);
id = (TLVector<int>)ObjectUtils.DeserializeVector<int>(br);
}
public override void SerializeBody(BinaryWriter bw)
{
bw.Write(Constructor);
ObjectUtils.SerializeObject(channel,bw);
ObjectUtils.SerializeObject(id,bw);
}
public override void deserializeResponse(BinaryReader br)
{
Response = (Messages.TLAffectedMessages)ObjectUtils.DeserializeObject(br);
}
}
}

View 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.Channels
{
[TLObject(-787622117)]
public class TLRequestDeleteUserHistory : TLMethod
{
public override int Constructor
{
get
{
return -787622117;
}
}
public TLAbsInputChannel channel {get;set;}
public TLAbsInputUser user_id {get;set;}
public Messages.TLAffectedHistory Response{ get; set;}
public void ComputeFlags()
{
}
public override void DeserializeBody(BinaryReader br)
{
channel = (TLAbsInputChannel)ObjectUtils.DeserializeObject(br);
user_id = (TLAbsInputUser)ObjectUtils.DeserializeObject(br);
}
public override void SerializeBody(BinaryWriter bw)
{
bw.Write(Constructor);
ObjectUtils.SerializeObject(channel,bw);
ObjectUtils.SerializeObject(user_id,bw);
}
public override void deserializeResponse(BinaryReader br)
{
Response = (Messages.TLAffectedHistory)ObjectUtils.DeserializeObject(br);
}
}
}

View 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.Channels
{
[TLObject(333610782)]
public class TLRequestEditAbout : TLMethod
{
public override int Constructor
{
get
{
return 333610782;
}
}
public TLAbsInputChannel channel {get;set;}
public string about {get;set;}
public bool Response{ get; set;}
public void ComputeFlags()
{
}
public override void DeserializeBody(BinaryReader br)
{
channel = (TLAbsInputChannel)ObjectUtils.DeserializeObject(br);
about = StringUtil.Deserialize(br);
}
public override void SerializeBody(BinaryWriter bw)
{
bw.Write(Constructor);
ObjectUtils.SerializeObject(channel,bw);
StringUtil.Serialize(about,bw);
}
public override void deserializeResponse(BinaryReader br)
{
Response = BoolUtil.Deserialize(br);
}
}
}

View 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.Channels
{
[TLObject(-344583728)]
public class TLRequestEditAdmin : TLMethod
{
public override int Constructor
{
get
{
return -344583728;
}
}
public TLAbsInputChannel channel {get;set;}
public TLAbsInputUser user_id {get;set;}
public TLAbsChannelParticipantRole role {get;set;}
public TLAbsUpdates Response{ get; set;}
public void ComputeFlags()
{
}
public override void DeserializeBody(BinaryReader br)
{
channel = (TLAbsInputChannel)ObjectUtils.DeserializeObject(br);
user_id = (TLAbsInputUser)ObjectUtils.DeserializeObject(br);
role = (TLAbsChannelParticipantRole)ObjectUtils.DeserializeObject(br);
}
public override void SerializeBody(BinaryWriter bw)
{
bw.Write(Constructor);
ObjectUtils.SerializeObject(channel,bw);
ObjectUtils.SerializeObject(user_id,bw);
ObjectUtils.SerializeObject(role,bw);
}
public override void deserializeResponse(BinaryReader br)
{
Response = (TLAbsUpdates)ObjectUtils.DeserializeObject(br);
}
}
}

View 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.Channels
{
[TLObject(-248621111)]
public class TLRequestEditPhoto : TLMethod
{
public override int Constructor
{
get
{
return -248621111;
}
}
public TLAbsInputChannel channel {get;set;}
public TLAbsInputChatPhoto photo {get;set;}
public TLAbsUpdates Response{ get; set;}
public void ComputeFlags()
{
}
public override void DeserializeBody(BinaryReader br)
{
channel = (TLAbsInputChannel)ObjectUtils.DeserializeObject(br);
photo = (TLAbsInputChatPhoto)ObjectUtils.DeserializeObject(br);
}
public override void SerializeBody(BinaryWriter bw)
{
bw.Write(Constructor);
ObjectUtils.SerializeObject(channel,bw);
ObjectUtils.SerializeObject(photo,bw);
}
public override void deserializeResponse(BinaryReader br)
{
Response = (TLAbsUpdates)ObjectUtils.DeserializeObject(br);
}
}
}

View 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.Channels
{
[TLObject(1450044624)]
public class TLRequestEditTitle : TLMethod
{
public override int Constructor
{
get
{
return 1450044624;
}
}
public TLAbsInputChannel channel {get;set;}
public string title {get;set;}
public TLAbsUpdates Response{ get; set;}
public void ComputeFlags()
{
}
public override void DeserializeBody(BinaryReader br)
{
channel = (TLAbsInputChannel)ObjectUtils.DeserializeObject(br);
title = StringUtil.Deserialize(br);
}
public override void SerializeBody(BinaryWriter bw)
{
bw.Write(Constructor);
ObjectUtils.SerializeObject(channel,bw);
StringUtil.Serialize(title,bw);
}
public override void deserializeResponse(BinaryReader br)
{
Response = (TLAbsUpdates)ObjectUtils.DeserializeObject(br);
}
}
}

View 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.Channels
{
[TLObject(-950663035)]
public class TLRequestExportInvite : TLMethod
{
public override int Constructor
{
get
{
return -950663035;
}
}
public TLAbsInputChannel channel {get;set;}
public TLAbsExportedChatInvite Response{ get; set;}
public void ComputeFlags()
{
}
public override void DeserializeBody(BinaryReader br)
{
channel = (TLAbsInputChannel)ObjectUtils.DeserializeObject(br);
}
public override void SerializeBody(BinaryWriter bw)
{
bw.Write(Constructor);
ObjectUtils.SerializeObject(channel,bw);
}
public override void deserializeResponse(BinaryReader br)
{
Response = (TLAbsExportedChatInvite)ObjectUtils.DeserializeObject(br);
}
}
}

View 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.Channels
{
[TLObject(-934882771)]
public class TLRequestExportMessageLink : TLMethod
{
public override int Constructor
{
get
{
return -934882771;
}
}
public TLAbsInputChannel channel {get;set;}
public int id {get;set;}
public TLExportedMessageLink Response{ get; set;}
public void ComputeFlags()
{
}
public override void DeserializeBody(BinaryReader br)
{
channel = (TLAbsInputChannel)ObjectUtils.DeserializeObject(br);
id = br.ReadInt32();
}
public override void SerializeBody(BinaryWriter bw)
{
bw.Write(Constructor);
ObjectUtils.SerializeObject(channel,bw);
bw.Write(id);
}
public override void deserializeResponse(BinaryReader br)
{
Response = (TLExportedMessageLink)ObjectUtils.DeserializeObject(br);
}
}
}

View 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.Channels
{
[TLObject(176122811)]
public class TLRequestGetChannels : TLMethod
{
public override int Constructor
{
get
{
return 176122811;
}
}
public TLVector<TLAbsInputChannel> id {get;set;}
public Messages.TLChats Response{ get; set;}
public void ComputeFlags()
{
}
public override void DeserializeBody(BinaryReader br)
{
id = (TLVector<TLAbsInputChannel>)ObjectUtils.DeserializeVector<TLAbsInputChannel>(br);
}
public override void SerializeBody(BinaryWriter bw)
{
bw.Write(Constructor);
ObjectUtils.SerializeObject(id,bw);
}
public override void deserializeResponse(BinaryReader br)
{
Response = (Messages.TLChats)ObjectUtils.DeserializeObject(br);
}
}
}

Some files were not shown because too many files have changed in this diff Show more