mirror of
https://github.com/sochix/TLSharp.git
synced 2026-01-03 07:19:57 +01:00
[Core] Drop unused files
This commit is contained in:
parent
fee6aba931
commit
9fe43b52f9
|
|
@ -1,48 +0,0 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using TLSharp.Core.MTProto;
|
||||
using TeleSharp.TL;
|
||||
namespace TLSharp.Core.Requests
|
||||
{
|
||||
public class AuthSendCodeRequest : MTProtoRequest
|
||||
{
|
||||
|
||||
public bool _phoneRegistered;
|
||||
public string _phoneCodeHash;
|
||||
public SendCodeArgs args=new SendCodeArgs();
|
||||
public AuthSendCodeRequest(string phoneNumber, int smsType, int apiId, string apiHash, string langCode)
|
||||
{
|
||||
|
||||
args.phone_number = phoneNumber;
|
||||
args.api_id = apiId;
|
||||
args.api_hash = apiHash;
|
||||
args.allow_flashcall = false;
|
||||
args.current_number = true;
|
||||
}
|
||||
|
||||
public override void OnSend(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(0x86AEF0EC);
|
||||
writer.Write(0);
|
||||
Serializers.String.write(writer, args.phone_number);
|
||||
writer.Write(args.api_id.Value);
|
||||
Serializers.String.write(writer, args.api_hash);
|
||||
}
|
||||
|
||||
public override void OnResponse(BinaryReader reader)
|
||||
{
|
||||
|
||||
var s = Deserializer.Deserialize(typeof(SentCode), reader);
|
||||
_phoneRegistered = ((SentCode)s).phone_registered;
|
||||
_phoneCodeHash = ((SentCode)s).phone_code_hash;
|
||||
}
|
||||
|
||||
public override void OnException(Exception exception)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override bool Confirmed => true;
|
||||
public override bool Responded { get; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using TeleSharp.TL;
|
||||
namespace TLSharp.Core.Requests
|
||||
{
|
||||
public class AuthSignInRequest : MTProtoRequest
|
||||
{
|
||||
private SignInArgs args = new SignInArgs();
|
||||
public User user;
|
||||
public int SessionExpires;
|
||||
|
||||
public AuthSignInRequest(string phoneNumber, string phoneCodeHash, string code)
|
||||
{
|
||||
args.phone_number = phoneNumber;
|
||||
args.phone_code_hash = phoneCodeHash;
|
||||
args.phone_code = code;
|
||||
}
|
||||
|
||||
public override void OnSend(BinaryWriter writer)
|
||||
{
|
||||
Serializer.Serialize(args, typeof(SignInArgs), writer);
|
||||
}
|
||||
|
||||
public override void OnResponse(BinaryReader reader)
|
||||
{
|
||||
var auth = (Authorization)Deserializer.Deserialize(typeof(Authorization), reader);
|
||||
user = auth.user;
|
||||
}
|
||||
|
||||
public override void OnException(Exception exception)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override bool Confirmed => true;
|
||||
public override bool Responded { get; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using TeleSharp.TL;
|
||||
namespace TLSharp.Core.Requests
|
||||
{
|
||||
public class DownloadFileRequest : MTProtoRequest
|
||||
{
|
||||
private GetFileArgs args = new GetFileArgs();
|
||||
public TeleSharp.TL.File file;
|
||||
|
||||
public DownloadFileRequest(InputFileLocation loc,int offset=0,int limit=0)
|
||||
{
|
||||
args.location = loc;
|
||||
args.offset = offset;
|
||||
args.limit = limit;
|
||||
}
|
||||
|
||||
public override void OnSend(BinaryWriter writer)
|
||||
{
|
||||
Serializer.Serialize(args, typeof(InputFileLocation), writer);
|
||||
}
|
||||
|
||||
public override void OnResponse(BinaryReader reader)
|
||||
{
|
||||
file = (TeleSharp.TL.File)Deserializer.Deserialize(typeof(TeleSharp.TL.File), reader);
|
||||
}
|
||||
|
||||
public override void OnException(Exception exception)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override bool Confirmed => true;
|
||||
public override bool Responded { get; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using TeleSharp.TL;
|
||||
using TLSharp.Core.MTProto;
|
||||
|
||||
namespace TLSharp.Core.Requests
|
||||
{
|
||||
public class InitConnectionRequest : MTProtoRequest
|
||||
{
|
||||
public InvokeWithLayerArgs invokeWithLayer { get; set; }
|
||||
public InitConnectionArgs initConn { get; set; }
|
||||
public GetConfigArgs getConfig { get; set; }
|
||||
public TeleSharp.TL.Config Configs { get; set; }
|
||||
|
||||
public InitConnectionRequest(int apiId)
|
||||
{
|
||||
invokeWithLayer = new InvokeWithLayerArgs();
|
||||
initConn = new InitConnectionArgs();
|
||||
invokeWithLayer.layer = 53;
|
||||
initConn.api_id = apiId;
|
||||
initConn.app_version = "1.0-SNAPSHOT";
|
||||
initConn.lang_code = "en";
|
||||
initConn.system_version = "WinPhone 8.0";
|
||||
initConn.device_model = "WinPhone Emulator";
|
||||
initConn.query = new GetConfigArgs();
|
||||
invokeWithLayer.query = initConn;
|
||||
}
|
||||
|
||||
public override void OnSend(BinaryWriter writer)
|
||||
{
|
||||
Serializer.Serialize(invokeWithLayer, invokeWithLayer.GetType(), writer);
|
||||
}
|
||||
|
||||
|
||||
public override void OnResponse(BinaryReader reader)
|
||||
{
|
||||
Configs = (TeleSharp.TL.Config)Deserializer.Deserialize(typeof(TeleSharp.TL.Config), reader);
|
||||
}
|
||||
|
||||
public override void OnException(Exception exception)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override bool Responded
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public override void OnSendSuccess()
|
||||
{
|
||||
|
||||
}
|
||||
public override bool Confirmed => true;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace TLSharp.Core.Requests
|
||||
{
|
||||
public abstract class MTProtoRequest
|
||||
{
|
||||
public MTProtoRequest()
|
||||
{
|
||||
Sended = false;
|
||||
}
|
||||
|
||||
public long MessageId { get; set; }
|
||||
public int Sequence { 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 virtual void OnSendSuccess()
|
||||
{
|
||||
SendTime = DateTime.Now;
|
||||
Sended = true;
|
||||
}
|
||||
|
||||
public virtual void OnConfirm()
|
||||
{
|
||||
ConfirmReceived = true;
|
||||
}
|
||||
|
||||
public bool NeedResend
|
||||
{
|
||||
get
|
||||
{
|
||||
return Dirty || (Confirmed && !ConfirmReceived && DateTime.Now - SendTime > TimeSpan.FromSeconds(3));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue