mirror of
https://github.com/sochix/TLSharp.git
synced 2026-04-06 06:55:06 +00:00
Requests refactoring (#900)
* Remove unused requests. * Move PingRequest and AckRequest to TLSharp.Core.Network.Requests.
This commit is contained in:
parent
8729b7d85b
commit
7230b9b509
10 changed files with 9 additions and 235 deletions
|
|
@ -11,7 +11,7 @@ using TLSharp.Core.Exceptions;
|
|||
using TLSharp.Core.MTProto;
|
||||
using TLSharp.Core.MTProto.Crypto;
|
||||
using TLSharp.Core.Network.Exceptions;
|
||||
using TLSharp.Core.Requests;
|
||||
using TLSharp.Core.Network.Requests;
|
||||
using TLSharp.Core.Utils;
|
||||
|
||||
namespace TLSharp.Core.Network
|
||||
|
|
|
|||
50
TLSharp.Core/Network/Requests/AckRequest.cs
Normal file
50
TLSharp.Core/Network/Requests/AckRequest.cs
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using TeleSharp.TL;
|
||||
|
||||
namespace TLSharp.Core.Network.Requests
|
||||
{
|
||||
public class AckRequest : TLMethod
|
||||
{
|
||||
private readonly List<ulong> _msgs;
|
||||
|
||||
public AckRequest(List<ulong> msgs)
|
||||
{
|
||||
_msgs = msgs;
|
||||
}
|
||||
|
||||
public override void SerializeBody(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 DeserializeBody(BinaryReader reader)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override void DeserializeResponse(BinaryReader stream)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override bool Confirmed => false;
|
||||
|
||||
public override bool Responded { get; }
|
||||
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return 0x62d6b459;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
38
TLSharp.Core/Network/Requests/PingRequest.cs
Normal file
38
TLSharp.Core/Network/Requests/PingRequest.cs
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using TeleSharp.TL;
|
||||
using TLSharp.Core.Utils;
|
||||
|
||||
namespace TLSharp.Core.Network.Requests
|
||||
{
|
||||
public class PingRequest : TLMethod
|
||||
{
|
||||
public PingRequest()
|
||||
{
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(Constructor);
|
||||
writer.Write(Helpers.GenerateRandomLong());
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader reader)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override void DeserializeResponse(BinaryReader stream)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override int Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return 0x7abe77ec;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue