mirror of
https://github.com/sochix/TLSharp.git
synced 2026-04-07 15:36:23 +00:00
Redesign Everything
This commit is contained in:
parent
b5472c6cd7
commit
6af7c66a81
710 changed files with 32932 additions and 302 deletions
46
TeleSharp.TL/TLMethod.cs
Normal file
46
TeleSharp.TL/TLMethod.cs
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
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 abstract class TLMethod : TLObject
|
||||
{
|
||||
|
||||
public abstract void deserializeResponse(BinaryReader stream);
|
||||
#region MTPROTO
|
||||
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 virtual bool Confirmed { get; } = true;
|
||||
public virtual bool Responded { get; } = false;
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue