mirror of
https://github.com/sochix/TLSharp.git
synced 2026-04-09 16:35:11 +00:00
formatting code (ctrl + k + d)
This commit is contained in:
parent
d330f9614b
commit
504b63a6d7
38 changed files with 16805 additions and 16280 deletions
|
|
@ -4,36 +4,36 @@ using System.IO;
|
|||
|
||||
namespace TLSharp.Core.Requests
|
||||
{
|
||||
public class AckRequest : MTProtoRequest
|
||||
{
|
||||
private readonly List<ulong> _msgs;
|
||||
public AckRequest(List<ulong> msgs)
|
||||
{
|
||||
_msgs = msgs;
|
||||
}
|
||||
public class AckRequest : MTProtoRequest
|
||||
{
|
||||
private readonly List<ulong> _msgs;
|
||||
public AckRequest(List<ulong> msgs)
|
||||
{
|
||||
_msgs = msgs;
|
||||
}
|
||||
|
||||
public override void OnSend(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(0x62d6b459); // msgs_ack
|
||||
writer.Write(0x1cb5c415); // Vector
|
||||
writer.Write(_msgs.Count);
|
||||
foreach (ulong messageId in _msgs)
|
||||
{
|
||||
writer.Write(messageId);
|
||||
}
|
||||
}
|
||||
public override void OnSend(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(0x62d6b459); // msgs_ack
|
||||
writer.Write(0x1cb5c415); // Vector
|
||||
writer.Write(_msgs.Count);
|
||||
foreach (ulong messageId in _msgs)
|
||||
{
|
||||
writer.Write(messageId);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnResponse(BinaryReader reader)
|
||||
{
|
||||
//throw new NotImplementedException();
|
||||
}
|
||||
public override void OnResponse(BinaryReader reader)
|
||||
{
|
||||
//throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override void OnException(Exception exception)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
public override void OnException(Exception exception)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override bool Confirmed => false;
|
||||
public override bool Responded { get; }
|
||||
}
|
||||
public override bool Confirmed => false;
|
||||
public override bool Responded { get; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ namespace TLSharp.Core.Requests
|
|||
private InputUserContactConstructor _user;
|
||||
private string _title;
|
||||
|
||||
|
||||
|
||||
public Messages_statedMessageConstructor message;
|
||||
public AddChatUserRequest(int chatID, InputUserContactConstructor user)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,36 +4,36 @@ using TLSharp.Core.MTProto;
|
|||
|
||||
namespace TLSharp.Core.Requests
|
||||
{
|
||||
public class AuthCheckPhoneRequest : MTProtoRequest
|
||||
{
|
||||
private string _phoneNumber;
|
||||
public bool _phoneRegistered;
|
||||
private bool _phoneInvited;
|
||||
public class AuthCheckPhoneRequest : MTProtoRequest
|
||||
{
|
||||
private string _phoneNumber;
|
||||
public bool _phoneRegistered;
|
||||
private bool _phoneInvited;
|
||||
|
||||
public AuthCheckPhoneRequest(string phoneNumber)
|
||||
{
|
||||
_phoneNumber = phoneNumber;
|
||||
}
|
||||
public AuthCheckPhoneRequest(string phoneNumber)
|
||||
{
|
||||
_phoneNumber = phoneNumber;
|
||||
}
|
||||
|
||||
public override void OnSend(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(0x6fe51dfb);
|
||||
Serializers.String.write(writer, _phoneNumber);
|
||||
}
|
||||
public override void OnSend(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(0x6fe51dfb);
|
||||
Serializers.String.write(writer, _phoneNumber);
|
||||
}
|
||||
|
||||
public override void OnResponse(BinaryReader reader)
|
||||
{
|
||||
var dataCode = reader.ReadUInt32(); // #e300cc3b
|
||||
this._phoneRegistered = reader.ReadUInt32() == 0x997275b5;
|
||||
this._phoneInvited = reader.ReadUInt32() == 0x997275b5;
|
||||
}
|
||||
public override void OnResponse(BinaryReader reader)
|
||||
{
|
||||
var dataCode = reader.ReadUInt32(); // #e300cc3b
|
||||
this._phoneRegistered = reader.ReadUInt32() == 0x997275b5;
|
||||
this._phoneInvited = reader.ReadUInt32() == 0x997275b5;
|
||||
}
|
||||
|
||||
public override void OnException(Exception exception)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
public override void OnException(Exception exception)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override bool Confirmed => true;
|
||||
public override bool Responded { get; }
|
||||
}
|
||||
public override bool Confirmed => true;
|
||||
public override bool Responded { get; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,51 +4,51 @@ using TLSharp.Core.MTProto;
|
|||
|
||||
namespace TLSharp.Core.Requests
|
||||
{
|
||||
public class AuthSendCodeRequest : MTProtoRequest
|
||||
{
|
||||
private readonly string _phoneNumber;
|
||||
private readonly int _smsType;
|
||||
private readonly int _apiId;
|
||||
private readonly string _apiHash;
|
||||
private readonly string _langCode;
|
||||
public bool _phoneRegistered;
|
||||
public string _phoneCodeHash;
|
||||
public class AuthSendCodeRequest : MTProtoRequest
|
||||
{
|
||||
private readonly string _phoneNumber;
|
||||
private readonly int _smsType;
|
||||
private readonly int _apiId;
|
||||
private readonly string _apiHash;
|
||||
private readonly string _langCode;
|
||||
public bool _phoneRegistered;
|
||||
public string _phoneCodeHash;
|
||||
|
||||
public AuthSendCodeRequest(string phoneNumber, int smsType, int apiId, string apiHash, string langCode)
|
||||
{
|
||||
_phoneNumber = phoneNumber;
|
||||
_smsType = smsType;
|
||||
_apiId = apiId;
|
||||
_apiHash = apiHash;
|
||||
_langCode = langCode;
|
||||
}
|
||||
public AuthSendCodeRequest(string phoneNumber, int smsType, int apiId, string apiHash, string langCode)
|
||||
{
|
||||
_phoneNumber = phoneNumber;
|
||||
_smsType = smsType;
|
||||
_apiId = apiId;
|
||||
_apiHash = apiHash;
|
||||
_langCode = langCode;
|
||||
}
|
||||
|
||||
public override void OnSend(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(0x768d5f4d);
|
||||
Serializers.String.write(writer, _phoneNumber);
|
||||
writer.Write(_smsType);
|
||||
writer.Write(_apiId);
|
||||
Serializers.String.write(writer, _apiHash);
|
||||
Serializers.String.write(writer, _langCode);
|
||||
}
|
||||
public override void OnSend(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(0x768d5f4d);
|
||||
Serializers.String.write(writer, _phoneNumber);
|
||||
writer.Write(_smsType);
|
||||
writer.Write(_apiId);
|
||||
Serializers.String.write(writer, _apiHash);
|
||||
Serializers.String.write(writer, _langCode);
|
||||
}
|
||||
|
||||
public override void OnResponse(BinaryReader reader)
|
||||
{
|
||||
var boolTrue = 0x997275b5;
|
||||
var dataCode = reader.ReadUInt32(); // 0x2215bcbd
|
||||
_phoneRegistered = reader.ReadUInt32() == boolTrue;
|
||||
_phoneCodeHash = Serializers.String.read(reader);
|
||||
var sendCodeTimeout = reader.ReadInt32();
|
||||
var isPassword = reader.ReadUInt32() == boolTrue;
|
||||
}
|
||||
public override void OnResponse(BinaryReader reader)
|
||||
{
|
||||
var boolTrue = 0x997275b5;
|
||||
var dataCode = reader.ReadUInt32(); // 0x2215bcbd
|
||||
_phoneRegistered = reader.ReadUInt32() == boolTrue;
|
||||
_phoneCodeHash = Serializers.String.read(reader);
|
||||
var sendCodeTimeout = reader.ReadInt32();
|
||||
var isPassword = reader.ReadUInt32() == boolTrue;
|
||||
}
|
||||
|
||||
public override void OnException(Exception exception)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
public override void OnException(Exception exception)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override bool Confirmed => true;
|
||||
public override bool Responded { get; }
|
||||
}
|
||||
public override bool Confirmed => true;
|
||||
public override bool Responded { get; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,42 +4,42 @@ using TLSharp.Core.MTProto;
|
|||
|
||||
namespace TLSharp.Core.Requests
|
||||
{
|
||||
public class AuthSignInRequest : MTProtoRequest
|
||||
{
|
||||
private readonly string _phoneNumber;
|
||||
private readonly string _phoneCodeHash;
|
||||
private readonly string _code;
|
||||
public User user;
|
||||
public int SessionExpires;
|
||||
public class AuthSignInRequest : MTProtoRequest
|
||||
{
|
||||
private readonly string _phoneNumber;
|
||||
private readonly string _phoneCodeHash;
|
||||
private readonly string _code;
|
||||
public User user;
|
||||
public int SessionExpires;
|
||||
|
||||
public AuthSignInRequest(string phoneNumber, string phoneCodeHash, string code)
|
||||
{
|
||||
_phoneNumber = phoneNumber;
|
||||
_phoneCodeHash = phoneCodeHash;
|
||||
_code = code;
|
||||
}
|
||||
public AuthSignInRequest(string phoneNumber, string phoneCodeHash, string code)
|
||||
{
|
||||
_phoneNumber = phoneNumber;
|
||||
_phoneCodeHash = phoneCodeHash;
|
||||
_code = code;
|
||||
}
|
||||
|
||||
public override void OnSend(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(0xbcd51581);
|
||||
Serializers.String.write(writer, _phoneNumber);
|
||||
Serializers.String.write(writer, _phoneCodeHash);
|
||||
Serializers.String.write(writer, _code);
|
||||
}
|
||||
public override void OnSend(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(0xbcd51581);
|
||||
Serializers.String.write(writer, _phoneNumber);
|
||||
Serializers.String.write(writer, _phoneCodeHash);
|
||||
Serializers.String.write(writer, _code);
|
||||
}
|
||||
|
||||
public override void OnResponse(BinaryReader reader)
|
||||
{
|
||||
var dataCode = reader.ReadUInt32(); //0xf6b673a4
|
||||
var expires = reader.ReadInt32();
|
||||
user = TL.Parse<User>(reader);
|
||||
}
|
||||
public override void OnResponse(BinaryReader reader)
|
||||
{
|
||||
var dataCode = reader.ReadUInt32(); //0xf6b673a4
|
||||
var expires = reader.ReadInt32();
|
||||
user = TL.Parse<User>(reader);
|
||||
}
|
||||
|
||||
public override void OnException(Exception exception)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
public override void OnException(Exception exception)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override bool Confirmed => true;
|
||||
public override bool Responded { get; }
|
||||
}
|
||||
public override bool Confirmed => true;
|
||||
public override bool Responded { get; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ namespace TLSharp.Core.Requests
|
|||
private InputUserContactConstructor _user;
|
||||
private string _title;
|
||||
|
||||
|
||||
|
||||
public Messages_statedMessageConstructor message;
|
||||
public DeleteChatUserRequest(int chatID, InputUserContactConstructor user)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ namespace TLSharp.Core.Requests
|
|||
_max_id = max_id;
|
||||
_limit = limit;
|
||||
}
|
||||
|
||||
|
||||
public override void OnSend(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(0xeccf1df6);
|
||||
|
|
@ -30,7 +30,7 @@ namespace TLSharp.Core.Requests
|
|||
writer.Write(_max_id);
|
||||
writer.Write(_limit);
|
||||
}
|
||||
|
||||
|
||||
public override void OnResponse(BinaryReader reader)
|
||||
{
|
||||
bool dialogsSlice = reader.ReadUInt32() == 0x71e094f3; // else dialogs#15ba6c40
|
||||
|
|
|
|||
|
|
@ -28,11 +28,11 @@ namespace TLSharp.Core.Requests
|
|||
writer.Write(_offset);
|
||||
writer.Write(_limit);
|
||||
}
|
||||
|
||||
|
||||
public override void OnResponse(BinaryReader reader)
|
||||
{
|
||||
var code = reader.ReadUInt32(); // upload.file#96a18d5
|
||||
|
||||
|
||||
type = TL.Parse<storage_FileType>(reader);
|
||||
mtime = reader.ReadInt32();
|
||||
bytes = reader.ReadBytes(_limit);
|
||||
|
|
|
|||
|
|
@ -5,59 +5,59 @@ using TLSharp.Core.MTProto;
|
|||
|
||||
namespace TLSharp.Core.Requests
|
||||
{
|
||||
class GetHistoryRequest : MTProtoRequest
|
||||
{
|
||||
InputPeer _peer;
|
||||
int _offset;
|
||||
int _max_id;
|
||||
int _limit;
|
||||
class GetHistoryRequest : MTProtoRequest
|
||||
{
|
||||
InputPeer _peer;
|
||||
int _offset;
|
||||
int _max_id;
|
||||
int _limit;
|
||||
|
||||
public List<Message> messages;
|
||||
public List<Chat> chats;
|
||||
public List<User> users;
|
||||
public List<Message> messages;
|
||||
public List<Chat> chats;
|
||||
public List<User> users;
|
||||
|
||||
public GetHistoryRequest(InputPeer peer, int offset, int max_id, int limit)
|
||||
{
|
||||
_peer = peer;
|
||||
_offset = offset;
|
||||
_max_id = max_id;
|
||||
_limit = limit;
|
||||
}
|
||||
public GetHistoryRequest(InputPeer peer, int offset, int max_id, int limit)
|
||||
{
|
||||
_peer = peer;
|
||||
_offset = offset;
|
||||
_max_id = max_id;
|
||||
_limit = limit;
|
||||
}
|
||||
|
||||
public override void OnSend(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(0x92a1df2f);
|
||||
_peer.Write(writer);
|
||||
writer.Write(_offset);
|
||||
writer.Write(_max_id);
|
||||
writer.Write(_limit);
|
||||
}
|
||||
public override void OnSend(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(0x92a1df2f);
|
||||
_peer.Write(writer);
|
||||
writer.Write(_offset);
|
||||
writer.Write(_max_id);
|
||||
writer.Write(_limit);
|
||||
}
|
||||
|
||||
public override void OnResponse(BinaryReader reader)
|
||||
{
|
||||
bool messagesSlice = reader.ReadUInt32() == 0xb446ae3; // else messages#8c718e87
|
||||
public override void OnResponse(BinaryReader reader)
|
||||
{
|
||||
bool messagesSlice = reader.ReadUInt32() == 0xb446ae3; // else messages#8c718e87
|
||||
|
||||
if (messagesSlice) reader.ReadInt32(); // count
|
||||
if (messagesSlice) reader.ReadInt32(); // count
|
||||
|
||||
// messages
|
||||
var result = reader.ReadUInt32(); // vector#1cb5c415
|
||||
int messages_len = reader.ReadInt32();
|
||||
messages = new List<Message>(messages_len);
|
||||
for (var i = 0; i < messages_len; i++)
|
||||
{
|
||||
var msgEl = TL.Parse<Message>(reader);
|
||||
// messages
|
||||
var result = reader.ReadUInt32(); // vector#1cb5c415
|
||||
int messages_len = reader.ReadInt32();
|
||||
messages = new List<Message>(messages_len);
|
||||
for (var i = 0; i < messages_len; i++)
|
||||
{
|
||||
var msgEl = TL.Parse<Message>(reader);
|
||||
|
||||
messages.Add(msgEl);
|
||||
}
|
||||
messages.Add(msgEl);
|
||||
}
|
||||
|
||||
// chats
|
||||
reader.ReadUInt32();
|
||||
int chats_len = reader.ReadInt32();
|
||||
chats = new List<Chat>(chats_len);
|
||||
for (int i = 0; i < chats_len; i++)
|
||||
chats.Add(TL.Parse<Chat>(reader));
|
||||
// chats
|
||||
reader.ReadUInt32();
|
||||
int chats_len = reader.ReadInt32();
|
||||
chats = new List<Chat>(chats_len);
|
||||
for (int i = 0; i < chats_len; i++)
|
||||
chats.Add(TL.Parse<Chat>(reader));
|
||||
|
||||
/*
|
||||
/*
|
||||
// users
|
||||
reader.ReadUInt32();
|
||||
int users_len = reader.ReadInt32();
|
||||
|
|
@ -65,14 +65,14 @@ namespace TLSharp.Core.Requests
|
|||
for (int i = 0; i < users_len; i++)
|
||||
users.Add(TL.Parse<User>(reader));
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnException(Exception exception)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
public override void OnException(Exception exception)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override bool Confirmed => true;
|
||||
public override bool Responded { get; }
|
||||
}
|
||||
public override bool Confirmed => true;
|
||||
public override bool Responded { get; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,33 +4,33 @@ using TLSharp.Core.MTProto;
|
|||
|
||||
namespace TLSharp.Core.Requests
|
||||
{
|
||||
public class ImportByUserName : MTProtoRequest
|
||||
{
|
||||
private readonly string _userName;
|
||||
public int id { get; private set; }
|
||||
public ImportByUserName(string userName)
|
||||
{
|
||||
_userName = userName;
|
||||
}
|
||||
public class ImportByUserName : MTProtoRequest
|
||||
{
|
||||
private readonly string _userName;
|
||||
public int id { get; private set; }
|
||||
public ImportByUserName(string userName)
|
||||
{
|
||||
_userName = userName;
|
||||
}
|
||||
|
||||
public override void OnSend(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(0xBF0131C);
|
||||
Serializers.String.write(writer, _userName);
|
||||
}
|
||||
public override void OnSend(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(0xBF0131C);
|
||||
Serializers.String.write(writer, _userName);
|
||||
}
|
||||
|
||||
public override void OnResponse(BinaryReader reader)
|
||||
{
|
||||
var code = reader.ReadUInt32();
|
||||
id = reader.ReadInt32();
|
||||
}
|
||||
public override void OnResponse(BinaryReader reader)
|
||||
{
|
||||
var code = reader.ReadUInt32();
|
||||
id = reader.ReadInt32();
|
||||
}
|
||||
|
||||
public override void OnException(Exception exception)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
public override void OnException(Exception exception)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override bool Confirmed => true;
|
||||
public override bool Responded { get; }
|
||||
}
|
||||
public override bool Confirmed => true;
|
||||
public override bool Responded { get; }
|
||||
}
|
||||
}
|
||||
|
|
@ -5,58 +5,58 @@ using TLSharp.Core.MTProto;
|
|||
|
||||
namespace TLSharp.Core.Requests
|
||||
{
|
||||
public class ImportContactRequest : MTProtoRequest
|
||||
{
|
||||
private InputContact Contact { get; set; }
|
||||
private bool Replace { get; set; }
|
||||
public class ImportContactRequest : MTProtoRequest
|
||||
{
|
||||
private InputContact Contact { get; set; }
|
||||
private bool Replace { get; set; }
|
||||
|
||||
public List<ImportedContact> imported;
|
||||
public List<User> users;
|
||||
public List<ImportedContact> imported;
|
||||
public List<User> users;
|
||||
|
||||
public ImportContactRequest(InputContact contact, bool shouldReplace = true)
|
||||
{
|
||||
Contact = contact;
|
||||
Replace = shouldReplace;
|
||||
}
|
||||
|
||||
public override void OnSend(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(0xda30b32d);
|
||||
writer.Write(0x1cb5c415);
|
||||
writer.Write(1);
|
||||
Contact.Write(writer);
|
||||
writer.Write(Replace ? 0x997275b5 : 0xbc799737);
|
||||
}
|
||||
public ImportContactRequest(InputContact contact, bool shouldReplace = true)
|
||||
{
|
||||
Contact = contact;
|
||||
Replace = shouldReplace;
|
||||
}
|
||||
|
||||
public override void OnResponse(BinaryReader reader)
|
||||
{
|
||||
var code = reader.ReadUInt32();
|
||||
var result = reader.ReadInt32(); // vector code
|
||||
int imported_len = reader.ReadInt32();
|
||||
this.imported = new List<ImportedContact>(imported_len);
|
||||
for (int imported_index = 0; imported_index < imported_len; imported_index++)
|
||||
{
|
||||
ImportedContact imported_element;
|
||||
imported_element = TL.Parse<ImportedContact>(reader);
|
||||
this.imported.Add(imported_element);
|
||||
}
|
||||
reader.ReadInt32(); // vector code
|
||||
int users_len = reader.ReadInt32();
|
||||
this.users = new List<User>(users_len);
|
||||
for (int users_index = 0; users_index < users_len; users_index++)
|
||||
{
|
||||
User users_element;
|
||||
users_element = TL.Parse<User>(reader);
|
||||
this.users.Add(users_element);
|
||||
}
|
||||
}
|
||||
public override void OnSend(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(0xda30b32d);
|
||||
writer.Write(0x1cb5c415);
|
||||
writer.Write(1);
|
||||
Contact.Write(writer);
|
||||
writer.Write(Replace ? 0x997275b5 : 0xbc799737);
|
||||
}
|
||||
|
||||
public override void OnException(Exception exception)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
public override void OnResponse(BinaryReader reader)
|
||||
{
|
||||
var code = reader.ReadUInt32();
|
||||
var result = reader.ReadInt32(); // vector code
|
||||
int imported_len = reader.ReadInt32();
|
||||
this.imported = new List<ImportedContact>(imported_len);
|
||||
for (int imported_index = 0; imported_index < imported_len; imported_index++)
|
||||
{
|
||||
ImportedContact imported_element;
|
||||
imported_element = TL.Parse<ImportedContact>(reader);
|
||||
this.imported.Add(imported_element);
|
||||
}
|
||||
reader.ReadInt32(); // vector code
|
||||
int users_len = reader.ReadInt32();
|
||||
this.users = new List<User>(users_len);
|
||||
for (int users_index = 0; users_index < users_len; users_index++)
|
||||
{
|
||||
User users_element;
|
||||
users_element = TL.Parse<User>(reader);
|
||||
this.users.Add(users_element);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool Confirmed => true;
|
||||
public override bool Responded { get; }
|
||||
}
|
||||
public override void OnException(Exception exception)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override bool Confirmed => true;
|
||||
public override bool Responded { get; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,53 +4,53 @@ using TLSharp.Core.MTProto;
|
|||
|
||||
namespace TLSharp.Core.Requests
|
||||
{
|
||||
public class InitConnectionRequest : MTProtoRequest
|
||||
{
|
||||
private int _apiId;
|
||||
public ConfigConstructor ConfigConstructor { get; set; }
|
||||
public class InitConnectionRequest : MTProtoRequest
|
||||
{
|
||||
private int _apiId;
|
||||
public ConfigConstructor ConfigConstructor { get; set; }
|
||||
|
||||
public InitConnectionRequest(int apiId)
|
||||
{
|
||||
_apiId = apiId;
|
||||
}
|
||||
public InitConnectionRequest(int apiId)
|
||||
{
|
||||
_apiId = apiId;
|
||||
}
|
||||
|
||||
public override void OnSend(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(0xda9b0d0d);
|
||||
writer.Write(23);// invokeWithLayer23#1c900537
|
||||
writer.Write(0x69796de9); // initConnection
|
||||
writer.Write(_apiId); // api id
|
||||
Serializers.String.write(writer, "WinPhone Emulator"); // device model
|
||||
Serializers.String.write(writer, "WinPhone 8.0"); // system version
|
||||
Serializers.String.write(writer, "1.0-SNAPSHOT"); // app version
|
||||
Serializers.String.write(writer, "en"); // lang code
|
||||
public override void OnSend(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(0xda9b0d0d);
|
||||
writer.Write(23);// invokeWithLayer23#1c900537
|
||||
writer.Write(0x69796de9); // initConnection
|
||||
writer.Write(_apiId); // api id
|
||||
Serializers.String.write(writer, "WinPhone Emulator"); // device model
|
||||
Serializers.String.write(writer, "WinPhone 8.0"); // system version
|
||||
Serializers.String.write(writer, "1.0-SNAPSHOT"); // app version
|
||||
Serializers.String.write(writer, "en"); // lang code
|
||||
|
||||
writer.Write(0xc4f9186b); // help.getConfig
|
||||
}
|
||||
writer.Write(0xc4f9186b); // help.getConfig
|
||||
}
|
||||
|
||||
public override void OnResponse(BinaryReader reader)
|
||||
{
|
||||
uint code = reader.ReadUInt32();
|
||||
ConfigConstructor config = new ConfigConstructor();
|
||||
config.Read(reader);
|
||||
public override void OnResponse(BinaryReader reader)
|
||||
{
|
||||
uint code = reader.ReadUInt32();
|
||||
ConfigConstructor config = new ConfigConstructor();
|
||||
config.Read(reader);
|
||||
|
||||
ConfigConstructor = config;
|
||||
}
|
||||
ConfigConstructor = config;
|
||||
}
|
||||
|
||||
public override void OnException(Exception exception)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
public override void OnException(Exception exception)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override bool Responded
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
public override bool Responded
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public override void OnSendSuccess()
|
||||
{
|
||||
public override void OnSendSuccess()
|
||||
{
|
||||
|
||||
}
|
||||
public override bool Confirmed => true;
|
||||
}
|
||||
}
|
||||
public override bool Confirmed => true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,44 +3,44 @@ using System.IO;
|
|||
|
||||
namespace TLSharp.Core.Requests
|
||||
{
|
||||
public abstract class MTProtoRequest
|
||||
{
|
||||
public MTProtoRequest()
|
||||
{
|
||||
Sended = false;
|
||||
}
|
||||
public abstract class MTProtoRequest
|
||||
{
|
||||
public MTProtoRequest()
|
||||
{
|
||||
Sended = false;
|
||||
}
|
||||
|
||||
public long MessageId { get; set; }
|
||||
public int Sequence { get; set; }
|
||||
public long MessageId { get; set; }
|
||||
public int Sequence { get; set; }
|
||||
|
||||
public bool Dirty { get; set; }
|
||||
public bool Dirty { get; set; }
|
||||
|
||||
public bool Sended { get; private set; }
|
||||
public DateTime SendTime { get; private set; }
|
||||
public bool ConfirmReceived { get; set; }
|
||||
public abstract void OnSend(BinaryWriter writer);
|
||||
public abstract void OnResponse(BinaryReader reader);
|
||||
public abstract void OnException(Exception exception);
|
||||
public abstract bool Confirmed { get; }
|
||||
public abstract bool Responded { get; }
|
||||
public bool Sended { get; private set; }
|
||||
public DateTime SendTime { get; private set; }
|
||||
public bool ConfirmReceived { get; set; }
|
||||
public abstract void OnSend(BinaryWriter writer);
|
||||
public abstract void OnResponse(BinaryReader reader);
|
||||
public abstract void OnException(Exception exception);
|
||||
public abstract bool Confirmed { get; }
|
||||
public abstract bool Responded { get; }
|
||||
|
||||
public virtual void OnSendSuccess()
|
||||
{
|
||||
SendTime = DateTime.Now;
|
||||
Sended = true;
|
||||
}
|
||||
public virtual void OnSendSuccess()
|
||||
{
|
||||
SendTime = DateTime.Now;
|
||||
Sended = true;
|
||||
}
|
||||
|
||||
public virtual void OnConfirm()
|
||||
{
|
||||
ConfirmReceived = true;
|
||||
}
|
||||
public virtual void OnConfirm()
|
||||
{
|
||||
ConfirmReceived = true;
|
||||
}
|
||||
|
||||
public bool NeedResend
|
||||
{
|
||||
get
|
||||
{
|
||||
return Dirty || (Confirmed && !ConfirmReceived && DateTime.Now - SendTime > TimeSpan.FromSeconds(3));
|
||||
}
|
||||
}
|
||||
}
|
||||
public bool NeedResend
|
||||
{
|
||||
get
|
||||
{
|
||||
return Dirty || (Confirmed && !ConfirmReceived && DateTime.Now - SendTime > TimeSpan.FromSeconds(3));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ namespace TLSharp.Core.Requests
|
|||
this.inputPeer = inputPeer;
|
||||
this.inputMedia = inputMedia;
|
||||
}
|
||||
|
||||
|
||||
public override void OnSend(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(0xa3c85d76);
|
||||
|
|
@ -34,7 +34,7 @@ namespace TLSharp.Core.Requests
|
|||
|
||||
public override void OnResponse(BinaryReader reader)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
public override void OnException(Exception exception)
|
||||
|
|
|
|||
|
|
@ -5,42 +5,42 @@ using TLSharp.Core.Utils;
|
|||
|
||||
namespace TLSharp.Core.Requests
|
||||
{
|
||||
public class SendMessageRequest : MTProtoRequest
|
||||
{
|
||||
private InputPeer _peer;
|
||||
private string _message;
|
||||
public class SendMessageRequest : MTProtoRequest
|
||||
{
|
||||
private InputPeer _peer;
|
||||
private string _message;
|
||||
|
||||
public SendMessageRequest(InputPeer peer, string message)
|
||||
{
|
||||
_peer = peer;
|
||||
_message = message;
|
||||
}
|
||||
public SendMessageRequest(InputPeer peer, string message)
|
||||
{
|
||||
_peer = peer;
|
||||
_message = message;
|
||||
}
|
||||
|
||||
public override void OnSend(BinaryWriter writer)
|
||||
{
|
||||
long random_id = Helpers.GenerateRandomLong();
|
||||
writer.Write(0x4cde0aab);
|
||||
_peer.Write(writer);
|
||||
Serializers.String.write(writer, _message);
|
||||
writer.Write(random_id);
|
||||
}
|
||||
public override void OnSend(BinaryWriter writer)
|
||||
{
|
||||
long random_id = Helpers.GenerateRandomLong();
|
||||
writer.Write(0x4cde0aab);
|
||||
_peer.Write(writer);
|
||||
Serializers.String.write(writer, _message);
|
||||
writer.Write(random_id);
|
||||
}
|
||||
|
||||
public override void OnResponse(BinaryReader reader)
|
||||
{
|
||||
var code = reader.ReadUInt32();
|
||||
public override void OnResponse(BinaryReader reader)
|
||||
{
|
||||
var code = reader.ReadUInt32();
|
||||
|
||||
var id = reader.ReadInt32();
|
||||
var date = reader.ReadInt32();
|
||||
var pts = reader.ReadInt32();
|
||||
var seq = reader.ReadInt32();
|
||||
}
|
||||
var id = reader.ReadInt32();
|
||||
var date = reader.ReadInt32();
|
||||
var pts = reader.ReadInt32();
|
||||
var seq = reader.ReadInt32();
|
||||
}
|
||||
|
||||
public override void OnException(Exception exception)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
public override void OnException(Exception exception)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override bool Confirmed => true;
|
||||
public override bool Responded { get; }
|
||||
}
|
||||
public override bool Confirmed => true;
|
||||
public override bool Responded { get; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ namespace TLSharp.Core.Requests
|
|||
|
||||
if (code != 0xbc799737 && code != 0x997275b5)
|
||||
throw new InvalidOperationException($"Expected Tl Bool type");
|
||||
|
||||
|
||||
Done = code == 0x997275b5 ? true : false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue