mirror of
https://github.com/sochix/TLSharp.git
synced 2025-12-06 08:02:00 +01:00
Cleaned Codes and Removed UnUsed Usings
This commit is contained in:
parent
133b9fdf6c
commit
341f7320dc
|
|
@ -34,4 +34,4 @@ namespace TLSharp.Core.Auth
|
|||
return step3Response;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -93,4 +93,4 @@ namespace TLSharp.Core.Auth
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -114,7 +114,6 @@ namespace TLSharp.Core.Auth
|
|||
}
|
||||
*/
|
||||
|
||||
|
||||
byte[] serverNonceFromServer = responseReader.ReadBytes(16);
|
||||
|
||||
// TODO: !
|
||||
|
|
@ -139,4 +138,4 @@ namespace TLSharp.Core.Auth
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -11,7 +11,6 @@ namespace TLSharp.Core.Auth
|
|||
{
|
||||
public AuthKey AuthKey { get; set; }
|
||||
public int TimeOffset { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class Step3_CompleteDHExchange
|
||||
|
|
@ -143,7 +142,6 @@ namespace TLSharp.Core.Auth
|
|||
{ // dh_gen_ok
|
||||
//logger.debug("dh_gen_ok");
|
||||
|
||||
|
||||
byte[] nonceFromServer = responseReader.ReadBytes(16);
|
||||
// TODO
|
||||
/*
|
||||
|
|
@ -191,7 +189,6 @@ namespace TLSharp.Core.Auth
|
|||
else if (code == 0x46dc1fb9)
|
||||
{ // dh_gen_retry
|
||||
throw new NotImplementedException("dh_gen_retry");
|
||||
|
||||
}
|
||||
else if (code == 0xa69dae02)
|
||||
{
|
||||
|
|
@ -206,4 +203,4 @@ namespace TLSharp.Core.Auth
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -147,7 +147,6 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
|
||||
public static byte[] EncryptIGE(byte[] originPlaintext, byte[] key, byte[] iv)
|
||||
{
|
||||
|
||||
byte[] plaintext;
|
||||
using (MemoryStream plaintextBuffer = new MemoryStream(originPlaintext.Length + 40))
|
||||
{
|
||||
|
|
@ -216,17 +215,15 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
result[i] = (byte)(buffer1[i] ^ buffer2[i]);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// AES engine implementation
|
||||
|
||||
public class AesEngine
|
||||
{
|
||||
// The S box
|
||||
private const uint m1 = 0x80808080;
|
||||
|
||||
private const uint m2 = 0x7f7f7f7f;
|
||||
private const uint m3 = 0x0000001b;
|
||||
private const int BLOCK_SIZE = 16;
|
||||
|
|
@ -576,7 +573,8 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
{
|
||||
EncryptBlock(WorkingKey);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
DecryptBlock(WorkingKey);
|
||||
}
|
||||
|
||||
|
|
@ -713,7 +711,6 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
internal sealed class Pack
|
||||
{
|
||||
private Pack()
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
private byte[] key;
|
||||
private ulong keyId;
|
||||
private ulong auxHash;
|
||||
|
||||
public AuthKey(BigInteger gab)
|
||||
{
|
||||
key = gab.ToByteArrayUnsigned();
|
||||
|
|
@ -84,4 +85,4 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
return string.Format("(Key: {0}, KeyId: {1}, AuxHash: {2})", key, keyId, auxHash);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -8,6 +8,7 @@ using System.Text;
|
|||
namespace TLSharp.Core.MTProto.Crypto
|
||||
{
|
||||
#if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT)
|
||||
|
||||
[Serializable]
|
||||
#endif
|
||||
public class BigInteger
|
||||
|
|
@ -183,21 +184,24 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
// this.sign = 0;
|
||||
this.magnitude = ZeroMagnitude;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
this.sign = signum;
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
this.magnitude = mag;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
// strip leading 0 words
|
||||
this.magnitude = new int[mag.Length - i];
|
||||
Array.Copy(mag, i, this.magnitude, 0, this.magnitude.Length);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
this.sign = signum;
|
||||
this.magnitude = mag;
|
||||
}
|
||||
|
|
@ -230,6 +234,7 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
r = radix2;
|
||||
rE = radix2E;
|
||||
break;
|
||||
|
||||
case 10:
|
||||
// This style seems to handle spaces and minus sign already (our processing redundant?)
|
||||
style = NumberStyles.Integer;
|
||||
|
|
@ -237,6 +242,7 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
r = radix10;
|
||||
rE = radix10E;
|
||||
break;
|
||||
|
||||
case 16:
|
||||
// TODO Should this be HexNumber?
|
||||
style = NumberStyles.AllowHexSpecifier;
|
||||
|
|
@ -244,11 +250,11 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
r = radix16;
|
||||
rE = radix16E;
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new FormatException("Only bases 2, 10, or 16 allowed");
|
||||
}
|
||||
|
||||
|
||||
int index = 0;
|
||||
sign = 1;
|
||||
|
||||
|
|
@ -283,7 +289,6 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
|
||||
BigInteger b = Zero;
|
||||
|
||||
|
||||
int next = index + chunk;
|
||||
|
||||
if (next <= str.Length)
|
||||
|
|
@ -304,9 +309,11 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
// TODO Parse 64 bits at a time
|
||||
b = b.ShiftLeft(1);
|
||||
break;
|
||||
|
||||
case 16:
|
||||
b = b.ShiftLeft(64);
|
||||
break;
|
||||
|
||||
default:
|
||||
b = b.Multiply(rE);
|
||||
break;
|
||||
|
|
@ -340,13 +347,15 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
{
|
||||
b = b.ShiftLeft(s.Length << 2);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
b = b.Multiply(r.Pow(s.Length));
|
||||
}
|
||||
|
||||
b = b.Add(bi);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
b = bi;
|
||||
}
|
||||
}
|
||||
|
|
@ -396,7 +405,8 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
{
|
||||
this.magnitude = One.magnitude;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
int numBytes = end - iBval;
|
||||
byte[] inverse = new byte[numBytes];
|
||||
|
||||
|
|
@ -418,7 +428,8 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
this.magnitude = MakeMagnitude(inverse, 0, inverse.Length);
|
||||
}
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
// strip leading zero bytes and return magnitude bytes
|
||||
this.magnitude = MakeMagnitude(bytes, offset, length);
|
||||
this.sign = this.magnitude.Length > 0 ? 1 : 0;
|
||||
|
|
@ -503,7 +514,8 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
//this.sign = 0;
|
||||
this.magnitude = ZeroMagnitude;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
// copy bytes
|
||||
this.magnitude = MakeMagnitude(bytes, offset, length);
|
||||
this.sign = this.magnitude.Length < 1 ? 0 : sign;
|
||||
|
|
@ -565,7 +577,7 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
int xBits = BitsPerByte * nBytes - bitLength;
|
||||
byte mask = rndMask[xBits];
|
||||
|
||||
for (;;)
|
||||
for (; ; )
|
||||
{
|
||||
random.NextBytes(b);
|
||||
|
||||
|
|
@ -612,6 +624,7 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
/**
|
||||
* return a = a + b - b preserved.
|
||||
*/
|
||||
|
||||
private static int[] AddMagnitudes(
|
||||
int[] a,
|
||||
int[] b)
|
||||
|
|
@ -666,7 +679,8 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
big = magToAdd;
|
||||
small = this.magnitude;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
big = this.magnitude;
|
||||
small = magToAdd;
|
||||
}
|
||||
|
|
@ -684,7 +698,8 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
bigCopy = new int[big.Length + 1];
|
||||
big.CopyTo(bigCopy, 1);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
bigCopy = (int[])big.Clone();
|
||||
}
|
||||
|
||||
|
|
@ -767,7 +782,8 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
// TODO Optimise this case
|
||||
nBits = Not().BitCount;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
int sum = 0;
|
||||
for (int i = 0; i < magnitude.Length; i++)
|
||||
{
|
||||
|
|
@ -802,7 +818,7 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
int indx,
|
||||
int[] mag)
|
||||
{
|
||||
for (;;)
|
||||
for (; ; )
|
||||
{
|
||||
if (indx >= mag.Length)
|
||||
return 0;
|
||||
|
|
@ -903,6 +919,7 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
* unsigned comparison on two arrays - note the arrays may
|
||||
* start with leading zeros.
|
||||
*/
|
||||
|
||||
private static int CompareTo(
|
||||
int xIndx,
|
||||
int[] x,
|
||||
|
|
@ -962,6 +979,7 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
* return z = x / y - done in place (z value preserved, x contains the
|
||||
* remainder)
|
||||
*/
|
||||
|
||||
private int[] Divide(
|
||||
int[] x,
|
||||
int[] y)
|
||||
|
|
@ -1004,7 +1022,8 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
c = ShiftLeft(y, shift);
|
||||
cBitLength += shift;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
iCount = new int[] { 1 };
|
||||
|
||||
int len = y.Length - yStart;
|
||||
|
|
@ -1014,7 +1033,7 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
|
||||
count = new int[iCount.Length];
|
||||
|
||||
for (;;)
|
||||
for (; ; )
|
||||
{
|
||||
if (cBitLength < xBitLength
|
||||
|| CompareNoLeadingZeroes(xStart, x, cStart, c) >= 0)
|
||||
|
|
@ -1060,7 +1079,8 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
--cBitLength;
|
||||
ShiftRightOneInPlace(iCountStart, iCount);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
ShiftRightInPlace(cStart, c, shift);
|
||||
cBitLength -= shift;
|
||||
ShiftRightInPlace(iCountStart, iCount, shift);
|
||||
|
|
@ -1078,7 +1098,8 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
count = new int[1];
|
||||
}
|
||||
|
||||
|
|
@ -1133,7 +1154,8 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
biggies[0] = val.sign == this.sign ? quotient : quotient.Negate();
|
||||
biggies[1] = new BigInteger(this.sign, remainder, true);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
int[] remainder = (int[])this.magnitude.Clone();
|
||||
int[] quotient = Divide(remainder, val.magnitude);
|
||||
|
||||
|
|
@ -1234,6 +1256,7 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
* probability of 1 - (1/2)**certainty.
|
||||
* <p>From Knuth Vol 2, pg 395.</p>
|
||||
*/
|
||||
|
||||
public bool IsProbablePrime(
|
||||
int certainty)
|
||||
{
|
||||
|
|
@ -1259,7 +1282,6 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
Debug.Assert(CompareTo(Two) > 0);
|
||||
Debug.Assert(TestBit(0));
|
||||
|
||||
|
||||
// Try to reduce the penalty for really small numbers
|
||||
int numLists = System.Math.Min(BitLength - 1, primeLists.Length);
|
||||
|
||||
|
|
@ -1280,14 +1302,12 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// TODO Special case for < 10^16 (RabinMiller fixed list)
|
||||
// if (BitLength < 30)
|
||||
// {
|
||||
// RabinMiller against 2, 3, 5, 7, 11, 13, 23 is sufficient
|
||||
// }
|
||||
|
||||
|
||||
// TODO Is it worth trying to create a hybrid of these two?
|
||||
return RabinMillerTest(certainty, random);
|
||||
// return SolovayStrassenTest(certainty, random);
|
||||
|
|
@ -1453,7 +1473,8 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
v = ((long)magnitude[magnitude.Length - 2] << 32)
|
||||
| (magnitude[magnitude.Length - 1] & IMASK);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
v = (magnitude[magnitude.Length - 1] & IMASK);
|
||||
}
|
||||
|
||||
|
|
@ -1561,6 +1582,7 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
* @param u2Out the return object for the u2 value
|
||||
* @return The greatest common divisor of a and b
|
||||
*/
|
||||
|
||||
private static BigInteger ExtEuclid(
|
||||
BigInteger a,
|
||||
BigInteger b,
|
||||
|
|
@ -1663,7 +1685,8 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
zVal = new int[m.magnitude.Length];
|
||||
magnitude.CopyTo(zVal, zVal.Length - magnitude.Length);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
//
|
||||
// in normal practice we'll never see this...
|
||||
//
|
||||
|
|
@ -1713,7 +1736,8 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
// be almost as heavy as a Montgomery mulitply.
|
||||
MultiplyMonty(yAccum, yVal, yVal, m.magnitude, mQ);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
Square(yAccum, yVal);
|
||||
Remainder(yAccum, m.magnitude);
|
||||
Array.Copy(yAccum, yAccum.Length - yVal.Length, yVal, 0, yVal.Length);
|
||||
|
|
@ -1727,7 +1751,8 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
{
|
||||
MultiplyMonty(yAccum, yVal, zVal, m.magnitude, mQ);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
Multiply(yAccum, yVal, zVal);
|
||||
Remainder(yAccum, m.magnitude);
|
||||
Array.Copy(yAccum, yAccum.Length - yVal.Length, yVal, 0,
|
||||
|
|
@ -1745,7 +1770,8 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
{
|
||||
MultiplyMonty(yAccum, yVal, yVal, m.magnitude, mQ);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
Square(yAccum, yVal);
|
||||
Remainder(yAccum, m.magnitude);
|
||||
Array.Copy(yAccum, yAccum.Length - yVal.Length, yVal, 0, yVal.Length);
|
||||
|
|
@ -1773,6 +1799,7 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
/**
|
||||
* return w with w = x * x - w is assumed to have enough space.
|
||||
*/
|
||||
|
||||
private static int[] Square(
|
||||
int[] w,
|
||||
int[] x)
|
||||
|
|
@ -1817,7 +1844,8 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
{
|
||||
w[wBase] = (int)(uint)(c >> 32);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
Debug.Assert((uint)(c >> 32) == 0);
|
||||
}
|
||||
wBase += i;
|
||||
|
|
@ -1835,7 +1863,8 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
{
|
||||
w[wBase] = (int)(uint)(u2 + (u1 >> 32) + (ulong)(uint)w[wBase]);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
Debug.Assert((uint)(u2 + (u1 >> 32)) == 0);
|
||||
}
|
||||
|
||||
|
|
@ -1845,6 +1874,7 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
/**
|
||||
* return x with x = y * z - x is assumed to have enough space.
|
||||
*/
|
||||
|
||||
private static int[] Multiply(
|
||||
int[] x,
|
||||
int[] y,
|
||||
|
|
@ -1857,7 +1887,7 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
|
||||
int xBase = x.Length - y.Length;
|
||||
|
||||
for (;;)
|
||||
for (; ; )
|
||||
{
|
||||
long a = z[--i] & IMASK;
|
||||
long val = 0;
|
||||
|
|
@ -1879,7 +1909,8 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
{
|
||||
x[xBase] = (int)val;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
Debug.Assert(val == 0);
|
||||
}
|
||||
break;
|
||||
|
|
@ -1949,6 +1980,7 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
/**
|
||||
* Calculate mQuote = -m^(-1) mod b with b = 2^32 (32 = word size)
|
||||
*/
|
||||
|
||||
private long GetMQuote()
|
||||
{
|
||||
Debug.Assert(this.sign > 0);
|
||||
|
|
@ -1982,6 +2014,7 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
* <br/>
|
||||
* NOTE: the indices of x, y, m, a different in HAC and in Java
|
||||
*/
|
||||
|
||||
private static void MultiplyMonty(
|
||||
int[] a,
|
||||
int[] x,
|
||||
|
|
@ -2086,7 +2119,8 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
{
|
||||
Square(res, this.magnitude);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
Multiply(res, this.magnitude, val.magnitude);
|
||||
}
|
||||
|
||||
|
|
@ -2144,7 +2178,7 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
BigInteger y = One;
|
||||
BigInteger z = this;
|
||||
|
||||
for (;;)
|
||||
for (; ; )
|
||||
{
|
||||
if ((exp & 0x1) == 1)
|
||||
{
|
||||
|
|
@ -2183,6 +2217,7 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
/**
|
||||
* return x = x % y - done in place (y value preserved)
|
||||
*/
|
||||
|
||||
private int[] Remainder(
|
||||
int[] x,
|
||||
int[] y)
|
||||
|
|
@ -2218,13 +2253,14 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
cBitLength += shift;
|
||||
Debug.Assert(c[0] != 0);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
int len = y.Length - yStart;
|
||||
c = new int[len];
|
||||
Array.Copy(y, yStart, c, 0, len);
|
||||
}
|
||||
|
||||
for (;;)
|
||||
for (; ; )
|
||||
{
|
||||
if (cBitLength < xBitLength
|
||||
|| CompareNoLeadingZeroes(xStart, x, cStart, c) >= 0)
|
||||
|
|
@ -2268,7 +2304,8 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
ShiftRightOneInPlace(cStart, c);
|
||||
--cBitLength;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
ShiftRightInPlace(cStart, c, shift);
|
||||
cBitLength -= shift;
|
||||
}
|
||||
|
|
@ -2326,7 +2363,8 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
// TODO Move before small values branch above?
|
||||
result = LastNBits(n.Abs().BitLength - 1);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
result = (int[])this.magnitude.Clone();
|
||||
result = Remainder(result, n.magnitude);
|
||||
}
|
||||
|
|
@ -2358,6 +2396,7 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
/**
|
||||
* do a left shift - this returns a new array.
|
||||
*/
|
||||
|
||||
private static int[] ShiftLeft(
|
||||
int[] mag,
|
||||
int n)
|
||||
|
|
@ -2372,7 +2411,8 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
newMag = new int[magLen + nInts];
|
||||
mag.CopyTo(newMag, 0);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
int i = 0;
|
||||
int nBits2 = 32 - nBits;
|
||||
int highBits = (int)((uint)mag[0] >> nBits2);
|
||||
|
|
@ -2382,7 +2422,8 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
newMag = new int[magLen + nInts + 1];
|
||||
newMag[i++] = highBits;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
newMag = new int[magLen + nInts];
|
||||
}
|
||||
|
||||
|
|
@ -2433,6 +2474,7 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
/**
|
||||
* do a right shift - this does it in place.
|
||||
*/
|
||||
|
||||
private static void ShiftRightInPlace(
|
||||
int start,
|
||||
int[] mag,
|
||||
|
|
@ -2476,6 +2518,7 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
/**
|
||||
* do a right shift by one - this does it in place.
|
||||
*/
|
||||
|
||||
private static void ShiftRightOneInPlace(
|
||||
int start,
|
||||
int[] mag)
|
||||
|
|
@ -2521,7 +2564,8 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
{
|
||||
Array.Copy(this.magnitude, 0, res, 0, res.Length);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
int numBits2 = 32 - numBits;
|
||||
|
||||
int magPos = this.magnitude.Length - 1 - numInts;
|
||||
|
|
@ -2549,6 +2593,7 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
/**
|
||||
* returns x = x - y - we assume x is >= y
|
||||
*/
|
||||
|
||||
private static int[] Subtract(
|
||||
int xStart,
|
||||
int[] x,
|
||||
|
|
@ -2605,7 +2650,8 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
bigun = n;
|
||||
lilun = this;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
bigun = this;
|
||||
lilun = n;
|
||||
}
|
||||
|
|
@ -2728,6 +2774,7 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
case 10:
|
||||
case 16:
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new FormatException("Only bases 2, 10, 16 are allowed");
|
||||
}
|
||||
|
|
@ -2761,7 +2808,8 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
sb.Append(TestBit(i) ? '1' : '0');
|
||||
}
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
// This is algorithm 1a from chapter 4.4 in Seminumerical Algorithms, slow but it works
|
||||
IList S = new List<object>();
|
||||
BigInteger bs = ValueOf(radix);
|
||||
|
|
@ -2782,7 +2830,8 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
{
|
||||
S.Add("0");
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
// see how to interact with different bases
|
||||
S.Add(b.magnitude[0].ToString("d"));
|
||||
}
|
||||
|
|
@ -2871,12 +2920,16 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
{
|
||||
case 0:
|
||||
return Zero;
|
||||
|
||||
case 1:
|
||||
return One;
|
||||
|
||||
case 2:
|
||||
return Two;
|
||||
|
||||
case 3:
|
||||
return Three;
|
||||
|
||||
case 10:
|
||||
return Ten;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Ionic.Crc;
|
||||
|
||||
namespace TLSharp.Core.MTProto.Crypto
|
||||
{
|
||||
|
|
@ -117,4 +112,4 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -40,9 +40,11 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
return string.Format("P: {0}, Q: {1}", p, q);
|
||||
}
|
||||
}
|
||||
|
||||
public class Factorizator
|
||||
{
|
||||
public static Random random = new Random();
|
||||
|
||||
public static long findSmallMultiplierLopatin(long what)
|
||||
{
|
||||
long g = 0;
|
||||
|
|
@ -109,7 +111,8 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
{
|
||||
a -= b;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
b -= a;
|
||||
}
|
||||
}
|
||||
|
|
@ -124,15 +127,13 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
long divisor = findSmallMultiplierLopatin(pqlong);
|
||||
return new FactorizedPair(BigInteger.ValueOf(divisor), BigInteger.ValueOf(pqlong / divisor));
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
// TODO: port pollard factorization
|
||||
throw new InvalidOperationException("pq too long; TODO: port the pollard algo");
|
||||
// logger.error("pq too long; TODO: port the pollard algo");
|
||||
// return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -17,6 +17,7 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
*
|
||||
* @return the size, in bytes, of the digest produced by this message digest.
|
||||
*/
|
||||
|
||||
int GetDigestSize();
|
||||
|
||||
/**
|
||||
|
|
@ -24,6 +25,7 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
*
|
||||
* @return the size, in bytes, of the internal buffer used by this digest.
|
||||
*/
|
||||
|
||||
int GetByteLength();
|
||||
|
||||
/**
|
||||
|
|
@ -31,6 +33,7 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
*
|
||||
* @param inByte the input byte to be entered.
|
||||
*/
|
||||
|
||||
void Update(byte input);
|
||||
|
||||
/**
|
||||
|
|
@ -40,6 +43,7 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
* @param inOff the offset into the byte array where the data starts.
|
||||
* @param len the length of the data.
|
||||
*/
|
||||
|
||||
void BlockUpdate(byte[] input, int inOff, int length);
|
||||
|
||||
/**
|
||||
|
|
@ -49,17 +53,18 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
* @param output the array the digest is to be copied into.
|
||||
* @param outOff the offset into the out array the digest is to start at.
|
||||
*/
|
||||
|
||||
int DoFinal(byte[] output, int outOff);
|
||||
|
||||
/**
|
||||
* reset the digest back to it's initial state.
|
||||
*/
|
||||
|
||||
void Reset();
|
||||
}
|
||||
|
||||
public class MD5
|
||||
{
|
||||
|
||||
public static string GetMd5String(string data)
|
||||
{
|
||||
return BitConverter.ToString(GetMd5Bytes(Encoding.UTF8.GetBytes(data))).Replace("-", "").ToLower();
|
||||
|
|
@ -184,7 +189,9 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
}
|
||||
|
||||
public abstract string AlgorithmName { get; }
|
||||
|
||||
public abstract int GetDigestSize();
|
||||
|
||||
public abstract int DoFinal(byte[] output, int outOff);
|
||||
|
||||
public void Finish()
|
||||
|
|
@ -202,7 +209,9 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
}
|
||||
|
||||
internal abstract void ProcessWord(byte[] input, int inOff);
|
||||
|
||||
internal abstract void ProcessLength(long bitLength);
|
||||
|
||||
internal abstract void ProcessBlock();
|
||||
}
|
||||
|
||||
|
|
@ -215,6 +224,7 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
// round 1 left rotates
|
||||
//
|
||||
private static readonly int S11 = 7;
|
||||
|
||||
private static readonly int S12 = 12;
|
||||
private static readonly int S13 = 17;
|
||||
private static readonly int S14 = 22;
|
||||
|
|
@ -223,6 +233,7 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
// round 2 left rotates
|
||||
//
|
||||
private static readonly int S21 = 5;
|
||||
|
||||
private static readonly int S22 = 9;
|
||||
private static readonly int S23 = 14;
|
||||
private static readonly int S24 = 20;
|
||||
|
|
@ -231,6 +242,7 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
// round 3 left rotates
|
||||
//
|
||||
private static readonly int S31 = 4;
|
||||
|
||||
private static readonly int S32 = 11;
|
||||
private static readonly int S33 = 16;
|
||||
private static readonly int S34 = 23;
|
||||
|
|
@ -239,6 +251,7 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
// round 4 left rotates
|
||||
//
|
||||
private static readonly int S41 = 6;
|
||||
|
||||
private static readonly int S42 = 10;
|
||||
private static readonly int S43 = 15;
|
||||
private static readonly int S44 = 21;
|
||||
|
|
|
|||
|
|
@ -5,10 +5,8 @@ using System.Security.Cryptography;
|
|||
|
||||
namespace TLSharp.Core.MTProto.Crypto
|
||||
{
|
||||
|
||||
class RSAServerKey
|
||||
internal class RSAServerKey
|
||||
{
|
||||
|
||||
private string fingerprint;
|
||||
private BigInteger m;
|
||||
private BigInteger e;
|
||||
|
|
@ -22,7 +20,6 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
|
||||
public byte[] Encrypt(byte[] data, int offset, int length)
|
||||
{
|
||||
|
||||
using (MemoryStream buffer = new MemoryStream(255))
|
||||
using (BinaryWriter writer = new BinaryWriter(buffer))
|
||||
{
|
||||
|
|
@ -46,7 +43,8 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
{
|
||||
return ciphertext;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
byte[] paddedCiphertext = new byte[256];
|
||||
int padding = 256 - ciphertext.Length;
|
||||
for (int i = 0; i < padding; i++)
|
||||
|
|
@ -57,9 +55,9 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
return paddedCiphertext;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class RSA
|
||||
{
|
||||
private static readonly Dictionary<string, RSAServerKey> serverKeys = new Dictionary<string, RSAServerKey>() {
|
||||
|
|
@ -79,5 +77,4 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
return key.Encrypt(data, offset, length);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TLSharp.Core.MTProto.Crypto
|
||||
{
|
||||
|
|
@ -56,6 +53,7 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
return salts.Count;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: get actual salt and other...
|
||||
}
|
||||
|
||||
|
|
@ -91,4 +89,4 @@ namespace TLSharp.Core.MTProto.Crypto
|
|||
get { return salts; }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -6,7 +6,6 @@ namespace TLSharp.Core.MTProto
|
|||
{
|
||||
public class Serializers
|
||||
{
|
||||
|
||||
public static class Bytes
|
||||
{
|
||||
public static byte[] read(BinaryReader binaryReader)
|
||||
|
|
@ -18,7 +17,8 @@ namespace TLSharp.Core.MTProto
|
|||
len = binaryReader.ReadByte() | (binaryReader.ReadByte() << 8) | (binaryReader.ReadByte() << 16);
|
||||
padding = len % 4;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
len = firstByte;
|
||||
padding = (len + 1) % 4;
|
||||
}
|
||||
|
|
@ -47,7 +47,8 @@ namespace TLSharp.Core.MTProto
|
|||
binaryWriter.Write((byte)data.Length);
|
||||
binaryWriter.Write(data);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
padding = (data.Length) % 4;
|
||||
if (padding != 0)
|
||||
{
|
||||
|
|
@ -61,7 +62,6 @@ namespace TLSharp.Core.MTProto
|
|||
binaryWriter.Write(data);
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < padding; i++)
|
||||
{
|
||||
binaryWriter.Write((byte)0);
|
||||
|
|
@ -95,4 +95,4 @@ namespace TLSharp.Core.MTProto
|
|||
return "[" + System.String.Join(", ", tokens) + "]";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -71,7 +71,5 @@ namespace TLSharp.Core.Network
|
|||
lastMessageId = newMessageId;
|
||||
return newMessageId;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,12 +1,9 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Ionic.Zlib;
|
||||
using TLSharp.Core.MTProto;
|
||||
using TLSharp.Core.MTProto.Crypto;
|
||||
using TLSharp.Core.Requests;
|
||||
|
|
@ -54,7 +51,6 @@ namespace TLSharp.Core.Network
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
using (var memory = new MemoryStream())
|
||||
using (var writer = new BinaryWriter(memory))
|
||||
{
|
||||
|
|
@ -177,36 +173,47 @@ namespace TLSharp.Core.Network
|
|||
case 0x73f1f8dc: // container
|
||||
//logger.debug("MSG container");
|
||||
return HandleContainer(messageId, sequence, messageReader, request);
|
||||
|
||||
case 0x7abe77ec: // ping
|
||||
//logger.debug("MSG ping");
|
||||
return HandlePing(messageId, sequence, messageReader);
|
||||
|
||||
case 0x347773c5: // pong
|
||||
//logger.debug("MSG pong");
|
||||
return HandlePong(messageId, sequence, messageReader, request);
|
||||
|
||||
case 0xae500895: // future_salts
|
||||
//logger.debug("MSG future_salts");
|
||||
return HandleFutureSalts(messageId, sequence, messageReader);
|
||||
|
||||
case 0x9ec20908: // new_session_created
|
||||
//logger.debug("MSG new_session_created");
|
||||
return HandleNewSessionCreated(messageId, sequence, messageReader);
|
||||
|
||||
case 0x62d6b459: // msgs_ack
|
||||
//logger.debug("MSG msds_ack");
|
||||
return HandleMsgsAck(messageId, sequence, messageReader);
|
||||
|
||||
case 0xedab447b: // bad_server_salt
|
||||
//logger.debug("MSG bad_server_salt");
|
||||
return HandleBadServerSalt(messageId, sequence, messageReader, request);
|
||||
|
||||
case 0xa7eff811: // bad_msg_notification
|
||||
//logger.debug("MSG bad_msg_notification");
|
||||
return HandleBadMsgNotification(messageId, sequence, messageReader);
|
||||
|
||||
case 0x276d3ec6: // msg_detailed_info
|
||||
//logger.debug("MSG msg_detailed_info");
|
||||
return HandleMsgDetailedInfo(messageId, sequence, messageReader);
|
||||
|
||||
case 0xf35c6d01: // rpc_result
|
||||
//logger.debug("MSG rpc_result");
|
||||
return HandleRpcResult(messageId, sequence, messageReader, request);
|
||||
|
||||
case 0x3072cfa1: // gzip_packed
|
||||
//logger.debug("MSG gzip_packed");
|
||||
return HandleGzipPacked(messageId, sequence, messageReader, request);
|
||||
|
||||
case 0xe317af7e:
|
||||
case 0xd3f45784:
|
||||
case 0x2b2fbd4e:
|
||||
|
|
@ -214,6 +221,7 @@ namespace TLSharp.Core.Network
|
|||
case 0x725b04c3:
|
||||
case 0x74ae4240:
|
||||
return HandleUpdate(messageId, sequence, messageReader);
|
||||
|
||||
default:
|
||||
//logger.debug("unknown message: {0}", code);
|
||||
return false;
|
||||
|
|
@ -317,7 +325,6 @@ namespace TLSharp.Core.Network
|
|||
{
|
||||
throw new InvalidOperationException(errorMessage);
|
||||
}
|
||||
|
||||
}
|
||||
else if (innerCode == 0x3072cfa1)
|
||||
{
|
||||
|
|
@ -341,7 +348,6 @@ namespace TLSharp.Core.Network
|
|||
}
|
||||
catch (ZlibException ex)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -389,7 +395,6 @@ namespace TLSharp.Core.Network
|
|||
throw new InvalidOperationException("incorrect server salt (in this case, the bad_server_salt response is received with the correct salt, and the message is to be re-sent with it)");
|
||||
case 64:
|
||||
throw new InvalidOperationException("invalid container");
|
||||
|
||||
}
|
||||
throw new NotImplementedException("This should never happens");
|
||||
/*
|
||||
|
|
@ -432,7 +437,6 @@ namespace TLSharp.Core.Network
|
|||
}
|
||||
*/
|
||||
|
||||
|
||||
//MTProtoRequest request = runningRequests[badMsgId];
|
||||
//request.OnException(new MTProtoBadServerSaltException(salt));
|
||||
|
||||
|
|
@ -542,7 +546,7 @@ namespace TLSharp.Core.Network
|
|||
private const string REPORT_MESSAGE =
|
||||
" See: https://github.com/sochix/TLSharp#i-get-a-xxxmigrationexception-or-a-migrate_x-error";
|
||||
|
||||
protected DataCenterMigrationException(string msg, int dc) : base (msg + REPORT_MESSAGE)
|
||||
protected DataCenterMigrationException(string msg, int dc) : base(msg + REPORT_MESSAGE)
|
||||
{
|
||||
DC = dc;
|
||||
}
|
||||
|
|
@ -551,7 +555,7 @@ namespace TLSharp.Core.Network
|
|||
internal class PhoneMigrationException : DataCenterMigrationException
|
||||
{
|
||||
internal PhoneMigrationException(int dc)
|
||||
: base ($"Phone number registered to a different DC: {dc}.", dc)
|
||||
: base($"Phone number registered to a different DC: {dc}.", dc)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
@ -559,7 +563,7 @@ namespace TLSharp.Core.Network
|
|||
internal class FileMigrationException : DataCenterMigrationException
|
||||
{
|
||||
internal FileMigrationException(int dc)
|
||||
: base ($"File located on a different DC: {dc}.", dc)
|
||||
: base($"File located on a different DC: {dc}.", dc)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using Ionic.Crc;
|
||||
|
||||
namespace TLSharp.Core.Network
|
||||
{
|
||||
|
|
@ -26,9 +25,9 @@ namespace TLSharp.Core.Network
|
|||
{
|
||||
// https://core.telegram.org/mtproto#tcp-transport
|
||||
/*
|
||||
4 length bytes are added at the front
|
||||
4 length bytes are added at the front
|
||||
(to include the length, the sequence number, and CRC32; always divisible by 4)
|
||||
and 4 bytes with the packet sequence number within this TCP connection
|
||||
and 4 bytes with the packet sequence number within this TCP connection
|
||||
(the first packet sent is numbered 0, the next one 1, etc.),
|
||||
and 4 CRC32 bytes at the end (length, sequence number, and payload together).
|
||||
*/
|
||||
|
|
@ -83,4 +82,4 @@ namespace TLSharp.Core.Network
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -92,13 +92,12 @@ namespace TLSharp.Core.Network
|
|||
{
|
||||
return this._tcpClient.Connected;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (_tcpClient.Connected)
|
||||
_tcpClient.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +1,7 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// 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.Core")]
|
||||
|
|
@ -14,8 +13,8 @@ using System.Runtime.InteropServices;
|
|||
[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
|
||||
// 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)]
|
||||
|
||||
|
|
@ -25,12 +24,12 @@ using System.Runtime.InteropServices;
|
|||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// 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")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using TeleSharp.TL;
|
||||
|
||||
namespace TLSharp.Core.Requests
|
||||
{
|
||||
|
|
@ -46,4 +45,4 @@ namespace TLSharp.Core.Requests
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using TeleSharp.TL;
|
||||
using TLSharp.Core.Utils;
|
||||
|
||||
namespace TLSharp.Core.Requests
|
||||
|
|
@ -36,4 +34,4 @@ namespace TLSharp.Core.Requests
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -9,6 +9,7 @@ namespace TLSharp.Core
|
|||
public interface ISessionStore
|
||||
{
|
||||
void Save(Session session);
|
||||
|
||||
Session Load(string sessionUserId);
|
||||
}
|
||||
|
||||
|
|
@ -43,7 +44,6 @@ namespace TLSharp.Core
|
|||
{
|
||||
public void Save(Session session)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Session Load(string sessionUserId)
|
||||
|
|
@ -54,9 +54,9 @@ namespace TLSharp.Core
|
|||
|
||||
public class Session
|
||||
{
|
||||
private const string defaultConnectionAddress = "149.154.175.100";//"149.154.167.50";
|
||||
private const string defaultConnectionAddress = "149.154.175.100";//"149.154.167.50";
|
||||
|
||||
private const int defaultConnectionPort = 443;
|
||||
private const int defaultConnectionPort = 443;
|
||||
|
||||
public string SessionUserId { get; set; }
|
||||
public string ServerAddress { get; set; }
|
||||
|
|
@ -190,4 +190,4 @@ namespace TLSharp.Core
|
|||
return newMessageId;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,170 +1,170 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TeleSharp.TL;
|
||||
using TeleSharp.TL.Account;
|
||||
using TeleSharp.TL.Auth;
|
||||
using TeleSharp.TL.Contacts;
|
||||
using TeleSharp.TL.Help;
|
||||
using TeleSharp.TL.Messages;
|
||||
using TeleSharp.TL.Upload;
|
||||
using TLSharp.Core.Auth;
|
||||
using TLSharp.Core.MTProto.Crypto;
|
||||
using TLSharp.Core.Network;
|
||||
using TLSharp.Core.Utils;
|
||||
using TLAuthorization = TeleSharp.TL.Auth.TLAuthorization;
|
||||
|
||||
namespace TLSharp.Core
|
||||
{
|
||||
public class TelegramClient : IDisposable
|
||||
{
|
||||
private MtProtoSender _sender;
|
||||
private AuthKey _key;
|
||||
private TcpTransport _transport;
|
||||
private string _apiHash = "";
|
||||
private int _apiId = 0;
|
||||
private Session _session;
|
||||
private List<TLDcOption> dcOptions;
|
||||
private TcpClientConnectionHandler _handler;
|
||||
|
||||
public TelegramClient(int apiId, string apiHash,
|
||||
ISessionStore store = null, string sessionUserId = "session", TcpClientConnectionHandler handler = null)
|
||||
{
|
||||
if (apiId == default(int))
|
||||
throw new MissingApiConfigurationException("API_ID");
|
||||
if (string.IsNullOrEmpty(apiHash))
|
||||
throw new MissingApiConfigurationException("API_HASH");
|
||||
|
||||
if (store == null)
|
||||
store = new FileSessionStore();
|
||||
|
||||
TLContext.Init();
|
||||
_apiHash = apiHash;
|
||||
_apiId = apiId;
|
||||
_handler = handler;
|
||||
|
||||
_session = Session.TryLoadOrCreateNew(store, sessionUserId);
|
||||
_transport = new TcpTransport(_session.ServerAddress, _session.Port, _handler);
|
||||
}
|
||||
|
||||
public async Task<bool> ConnectAsync(bool reconnect = false)
|
||||
{
|
||||
if (_session.AuthKey == null || reconnect)
|
||||
{
|
||||
var result = await Authenticator.DoAuthentication(_transport);
|
||||
_session.AuthKey = result.AuthKey;
|
||||
_session.TimeOffset = result.TimeOffset;
|
||||
}
|
||||
|
||||
_sender = new MtProtoSender(_transport, _session);
|
||||
|
||||
//set-up layer
|
||||
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 = 66, query = request };
|
||||
await _sender.Send(invokewithLayer);
|
||||
await _sender.Receive(invokewithLayer);
|
||||
|
||||
dcOptions = ((TLConfig)invokewithLayer.Response).dc_options.lists;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private async Task ReconnectToDcAsync(int dcId)
|
||||
{
|
||||
if (dcOptions == null || !dcOptions.Any())
|
||||
throw new InvalidOperationException($"Can't reconnect. Establish initial connection first.");
|
||||
|
||||
var dc = dcOptions.First(d => d.id == dcId);
|
||||
|
||||
_transport = new TcpTransport(dc.ip_address, dc.port, _handler);
|
||||
_session.ServerAddress = dc.ip_address;
|
||||
_session.Port = dc.port;
|
||||
|
||||
await ConnectAsync(true);
|
||||
}
|
||||
|
||||
public bool IsUserAuthorized()
|
||||
{
|
||||
return _session.TLUser != null;
|
||||
}
|
||||
|
||||
public async Task<bool> IsPhoneRegisteredAsync(string phoneNumber)
|
||||
{
|
||||
if (String.IsNullOrWhiteSpace(phoneNumber))
|
||||
throw new ArgumentNullException(nameof(phoneNumber));
|
||||
|
||||
if (_sender == null)
|
||||
throw new InvalidOperationException("Not connected!");
|
||||
|
||||
var authCheckPhoneRequest = new TLRequestCheckPhone() { phone_number = phoneNumber };
|
||||
var completed = false;
|
||||
while(!completed)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _sender.Send(authCheckPhoneRequest);
|
||||
await _sender.Receive(authCheckPhoneRequest);
|
||||
completed = true;
|
||||
}
|
||||
catch(PhoneMigrationException e)
|
||||
{
|
||||
await ReconnectToDcAsync(e.DC);
|
||||
}
|
||||
}
|
||||
return authCheckPhoneRequest.Response.phone_registered;
|
||||
}
|
||||
|
||||
public async Task<string> SendCodeRequestAsync(string phoneNumber)
|
||||
{
|
||||
if (String.IsNullOrWhiteSpace(phoneNumber))
|
||||
throw new ArgumentNullException(nameof(phoneNumber));
|
||||
|
||||
var completed = false;
|
||||
|
||||
TLRequestSendCode request = null;
|
||||
|
||||
while (!completed)
|
||||
{
|
||||
request = new TLRequestSendCode() { phone_number = phoneNumber, api_id = _apiId, api_hash = _apiHash };
|
||||
try
|
||||
{
|
||||
await _sender.Send(request);
|
||||
await _sender.Receive(request);
|
||||
|
||||
completed = true;
|
||||
}
|
||||
catch (PhoneMigrationException ex)
|
||||
{
|
||||
await ReconnectToDcAsync(ex.DC);
|
||||
}
|
||||
}
|
||||
|
||||
return request.Response.phone_code_hash;
|
||||
}
|
||||
|
||||
public async Task<TLUser> MakeAuthAsync(string phoneNumber, string phoneCodeHash, string code)
|
||||
{
|
||||
if (String.IsNullOrWhiteSpace(phoneNumber))
|
||||
throw new ArgumentNullException(nameof(phoneNumber));
|
||||
|
||||
if (String.IsNullOrWhiteSpace(phoneCodeHash))
|
||||
throw new ArgumentNullException(nameof(phoneCodeHash));
|
||||
|
||||
if (String.IsNullOrWhiteSpace(code))
|
||||
throw new ArgumentNullException(nameof(code));
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TeleSharp.TL;
|
||||
using TeleSharp.TL.Account;
|
||||
using TeleSharp.TL.Auth;
|
||||
using TeleSharp.TL.Contacts;
|
||||
using TeleSharp.TL.Help;
|
||||
using TeleSharp.TL.Messages;
|
||||
using TeleSharp.TL.Upload;
|
||||
using TLSharp.Core.Auth;
|
||||
using TLSharp.Core.MTProto.Crypto;
|
||||
using TLSharp.Core.Network;
|
||||
using TLSharp.Core.Utils;
|
||||
using TLAuthorization = TeleSharp.TL.Auth.TLAuthorization;
|
||||
|
||||
namespace TLSharp.Core
|
||||
{
|
||||
public class TelegramClient : IDisposable
|
||||
{
|
||||
private MtProtoSender _sender;
|
||||
private AuthKey _key;
|
||||
private TcpTransport _transport;
|
||||
private string _apiHash = "";
|
||||
private int _apiId = 0;
|
||||
private Session _session;
|
||||
private List<TLDcOption> dcOptions;
|
||||
private TcpClientConnectionHandler _handler;
|
||||
|
||||
public TelegramClient(int apiId, string apiHash,
|
||||
ISessionStore store = null, string sessionUserId = "session", TcpClientConnectionHandler handler = null)
|
||||
{
|
||||
if (apiId == default(int))
|
||||
throw new MissingApiConfigurationException("API_ID");
|
||||
if (string.IsNullOrEmpty(apiHash))
|
||||
throw new MissingApiConfigurationException("API_HASH");
|
||||
|
||||
if (store == null)
|
||||
store = new FileSessionStore();
|
||||
|
||||
TLContext.Init();
|
||||
_apiHash = apiHash;
|
||||
_apiId = apiId;
|
||||
_handler = handler;
|
||||
|
||||
_session = Session.TryLoadOrCreateNew(store, sessionUserId);
|
||||
_transport = new TcpTransport(_session.ServerAddress, _session.Port, _handler);
|
||||
}
|
||||
|
||||
public async Task<bool> ConnectAsync(bool reconnect = false)
|
||||
{
|
||||
if (_session.AuthKey == null || reconnect)
|
||||
{
|
||||
var result = await Authenticator.DoAuthentication(_transport);
|
||||
_session.AuthKey = result.AuthKey;
|
||||
_session.TimeOffset = result.TimeOffset;
|
||||
}
|
||||
|
||||
_sender = new MtProtoSender(_transport, _session);
|
||||
|
||||
//set-up layer
|
||||
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 = 66, query = request };
|
||||
await _sender.Send(invokewithLayer);
|
||||
await _sender.Receive(invokewithLayer);
|
||||
|
||||
dcOptions = ((TLConfig)invokewithLayer.Response).dc_options.lists;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private async Task ReconnectToDcAsync(int dcId)
|
||||
{
|
||||
if (dcOptions == null || !dcOptions.Any())
|
||||
throw new InvalidOperationException($"Can't reconnect. Establish initial connection first.");
|
||||
|
||||
var dc = dcOptions.First(d => d.id == dcId);
|
||||
|
||||
_transport = new TcpTransport(dc.ip_address, dc.port, _handler);
|
||||
_session.ServerAddress = dc.ip_address;
|
||||
_session.Port = dc.port;
|
||||
|
||||
await ConnectAsync(true);
|
||||
}
|
||||
|
||||
public bool IsUserAuthorized()
|
||||
{
|
||||
return _session.TLUser != null;
|
||||
}
|
||||
|
||||
public async Task<bool> IsPhoneRegisteredAsync(string phoneNumber)
|
||||
{
|
||||
if (String.IsNullOrWhiteSpace(phoneNumber))
|
||||
throw new ArgumentNullException(nameof(phoneNumber));
|
||||
|
||||
if (_sender == null)
|
||||
throw new InvalidOperationException("Not connected!");
|
||||
|
||||
var authCheckPhoneRequest = new TLRequestCheckPhone() { phone_number = phoneNumber };
|
||||
var completed = false;
|
||||
while (!completed)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _sender.Send(authCheckPhoneRequest);
|
||||
await _sender.Receive(authCheckPhoneRequest);
|
||||
completed = true;
|
||||
}
|
||||
catch (PhoneMigrationException e)
|
||||
{
|
||||
await ReconnectToDcAsync(e.DC);
|
||||
}
|
||||
}
|
||||
return authCheckPhoneRequest.Response.phone_registered;
|
||||
}
|
||||
|
||||
public async Task<string> SendCodeRequestAsync(string phoneNumber)
|
||||
{
|
||||
if (String.IsNullOrWhiteSpace(phoneNumber))
|
||||
throw new ArgumentNullException(nameof(phoneNumber));
|
||||
|
||||
var completed = false;
|
||||
|
||||
TLRequestSendCode request = null;
|
||||
|
||||
while (!completed)
|
||||
{
|
||||
request = new TLRequestSendCode() { phone_number = phoneNumber, api_id = _apiId, api_hash = _apiHash };
|
||||
try
|
||||
{
|
||||
await _sender.Send(request);
|
||||
await _sender.Receive(request);
|
||||
|
||||
completed = true;
|
||||
}
|
||||
catch (PhoneMigrationException ex)
|
||||
{
|
||||
await ReconnectToDcAsync(ex.DC);
|
||||
}
|
||||
}
|
||||
|
||||
return request.Response.phone_code_hash;
|
||||
}
|
||||
|
||||
public async Task<TLUser> MakeAuthAsync(string phoneNumber, string phoneCodeHash, string code)
|
||||
{
|
||||
if (String.IsNullOrWhiteSpace(phoneNumber))
|
||||
throw new ArgumentNullException(nameof(phoneNumber));
|
||||
|
||||
if (String.IsNullOrWhiteSpace(phoneCodeHash))
|
||||
throw new ArgumentNullException(nameof(phoneCodeHash));
|
||||
|
||||
if (String.IsNullOrWhiteSpace(code))
|
||||
throw new ArgumentNullException(nameof(code));
|
||||
|
||||
var request = new TLRequestSignIn() { phone_number = phoneNumber, phone_code_hash = phoneCodeHash, phone_code = code };
|
||||
|
||||
var completed = false;
|
||||
|
|
@ -181,176 +181,176 @@ namespace TLSharp.Core
|
|||
{
|
||||
await ReconnectToDcAsync(e.DC);
|
||||
}
|
||||
}
|
||||
|
||||
OnUserAuthenticated(((TLUser)request.Response.user));
|
||||
|
||||
return ((TLUser)request.Response.user);
|
||||
}
|
||||
public async Task<TLPassword> GetPasswordSetting()
|
||||
{
|
||||
var request = new TLRequestGetPassword();
|
||||
|
||||
await _sender.Send(request);
|
||||
await _sender.Receive(request);
|
||||
|
||||
return ((TLPassword)request.Response);
|
||||
}
|
||||
|
||||
public async Task<TLUser> MakeAuthWithPasswordAsync(TLPassword password, string password_str)
|
||||
{
|
||||
|
||||
byte[] password_bytes = Encoding.UTF8.GetBytes(password_str);
|
||||
IEnumerable<byte> rv = password.current_salt.Concat(password_bytes).Concat(password.current_salt);
|
||||
|
||||
SHA256Managed hashstring = new SHA256Managed();
|
||||
var password_hash = hashstring.ComputeHash(rv.ToArray());
|
||||
|
||||
var request = new TLRequestCheckPassword() { password_hash = password_hash };
|
||||
await _sender.Send(request);
|
||||
await _sender.Receive(request);
|
||||
|
||||
OnUserAuthenticated(((TLUser)request.Response.user));
|
||||
|
||||
return ((TLUser)request.Response.user);
|
||||
}
|
||||
|
||||
public async Task<TLUser> SignUpAsync(string phoneNumber, string phoneCodeHash, string code, string firstName, string lastName)
|
||||
{
|
||||
var request = new TLRequestSignUp() { phone_number = phoneNumber, phone_code = code, phone_code_hash = phoneCodeHash, first_name = firstName, last_name = lastName };
|
||||
await _sender.Send(request);
|
||||
await _sender.Receive(request);
|
||||
|
||||
OnUserAuthenticated(((TLUser)request.Response.user));
|
||||
|
||||
return ((TLUser)request.Response.user);
|
||||
}
|
||||
public async Task<T> SendRequestAsync<T>(TLMethod methodToExecute)
|
||||
{
|
||||
await _sender.Send(methodToExecute);
|
||||
await _sender.Receive(methodToExecute);
|
||||
|
||||
var result = methodToExecute.GetType().GetProperty("Response").GetValue(methodToExecute);
|
||||
|
||||
return (T)result;
|
||||
}
|
||||
|
||||
public async Task<TLContacts> GetContactsAsync()
|
||||
{
|
||||
if (!IsUserAuthorized())
|
||||
throw new InvalidOperationException("Authorize user first!");
|
||||
|
||||
var req = new TLRequestGetContacts() { hash = "" };
|
||||
|
||||
return await SendRequestAsync<TLContacts>(req);
|
||||
}
|
||||
|
||||
public async Task<TLAbsUpdates> SendMessageAsync(TLAbsInputPeer peer, string message)
|
||||
{
|
||||
if (!IsUserAuthorized())
|
||||
throw new InvalidOperationException("Authorize user first!");
|
||||
|
||||
return await SendRequestAsync<TLAbsUpdates>(
|
||||
new TLRequestSendMessage()
|
||||
{
|
||||
peer = peer,
|
||||
message = message,
|
||||
random_id = Helpers.GenerateRandomLong()
|
||||
});
|
||||
}
|
||||
|
||||
public async Task<Boolean> SendTypingAsync(TLAbsInputPeer peer)
|
||||
{
|
||||
var req = new TLRequestSetTyping()
|
||||
{
|
||||
action = new TLSendMessageTypingAction(),
|
||||
peer = peer
|
||||
};
|
||||
return await SendRequestAsync<Boolean>(req);
|
||||
}
|
||||
|
||||
public async Task<TLAbsDialogs> GetUserDialogsAsync()
|
||||
{
|
||||
var peer = new TLInputPeerSelf();
|
||||
return await SendRequestAsync<TLAbsDialogs>(
|
||||
new TLRequestGetDialogs() { offset_date = 0, offset_peer = peer, limit = 100 });
|
||||
}
|
||||
|
||||
public async Task<TLAbsUpdates> SendUploadedPhoto(TLAbsInputPeer peer, TLAbsInputFile file, string caption)
|
||||
{
|
||||
return await SendRequestAsync<TLAbsUpdates>(new TLRequestSendMedia()
|
||||
{
|
||||
random_id = Helpers.GenerateRandomLong(),
|
||||
background = false,
|
||||
clear_draft = false,
|
||||
media = new TLInputMediaUploadedPhoto() { file = file, caption = caption },
|
||||
peer = peer
|
||||
});
|
||||
}
|
||||
|
||||
public async Task<TLAbsUpdates> SendUploadedDocument(
|
||||
TLAbsInputPeer peer, TLAbsInputFile file, string caption, string mimeType, TLVector<TLAbsDocumentAttribute> attributes)
|
||||
{
|
||||
return await SendRequestAsync<TLAbsUpdates>(new TLRequestSendMedia()
|
||||
{
|
||||
random_id = Helpers.GenerateRandomLong(),
|
||||
background = false,
|
||||
clear_draft = false,
|
||||
media = new TLInputMediaUploadedDocument()
|
||||
{
|
||||
file = file,
|
||||
caption = caption,
|
||||
mime_type = mimeType,
|
||||
attributes = attributes
|
||||
},
|
||||
peer = peer
|
||||
});
|
||||
}
|
||||
|
||||
public async Task<TLFile> GetFile(TLAbsInputFileLocation location, int filePartSize, int offset = 0)
|
||||
{
|
||||
TLFile result = null;
|
||||
try
|
||||
{
|
||||
result = await SendRequestAsync<TLFile>(new TLRequestGetFile()
|
||||
{
|
||||
location = location,
|
||||
limit = filePartSize,
|
||||
offset = offset
|
||||
});
|
||||
}
|
||||
catch (FileMigrationException ex)
|
||||
{
|
||||
var exportedAuth = await SendRequestAsync<TLExportedAuthorization>(new TLRequestExportAuthorization() { dc_id = ex.DC });
|
||||
|
||||
var authKey = _session.AuthKey;
|
||||
var timeOffset = _session.TimeOffset;
|
||||
var serverAddress = _session.ServerAddress;
|
||||
var serverPort = _session.Port;
|
||||
|
||||
await ReconnectToDcAsync(ex.DC);
|
||||
var auth = await SendRequestAsync<TLAuthorization>(new TLRequestImportAuthorization
|
||||
{
|
||||
bytes = exportedAuth.bytes,
|
||||
id = exportedAuth.id
|
||||
});
|
||||
result = await GetFile(location, filePartSize, offset);
|
||||
|
||||
_session.AuthKey = authKey;
|
||||
_session.TimeOffset = timeOffset;
|
||||
_transport = new TcpTransport(serverAddress, serverPort);
|
||||
_session.ServerAddress = serverAddress;
|
||||
_session.Port = serverPort;
|
||||
await ConnectAsync();
|
||||
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task SendPingAsync()
|
||||
{
|
||||
await _sender.SendPingAsync();
|
||||
}
|
||||
|
||||
OnUserAuthenticated(((TLUser)request.Response.user));
|
||||
|
||||
return ((TLUser)request.Response.user);
|
||||
}
|
||||
|
||||
public async Task<TLPassword> GetPasswordSetting()
|
||||
{
|
||||
var request = new TLRequestGetPassword();
|
||||
|
||||
await _sender.Send(request);
|
||||
await _sender.Receive(request);
|
||||
|
||||
return ((TLPassword)request.Response);
|
||||
}
|
||||
|
||||
public async Task<TLUser> MakeAuthWithPasswordAsync(TLPassword password, string password_str)
|
||||
{
|
||||
byte[] password_bytes = Encoding.UTF8.GetBytes(password_str);
|
||||
IEnumerable<byte> rv = password.current_salt.Concat(password_bytes).Concat(password.current_salt);
|
||||
|
||||
SHA256Managed hashstring = new SHA256Managed();
|
||||
var password_hash = hashstring.ComputeHash(rv.ToArray());
|
||||
|
||||
var request = new TLRequestCheckPassword() { password_hash = password_hash };
|
||||
await _sender.Send(request);
|
||||
await _sender.Receive(request);
|
||||
|
||||
OnUserAuthenticated(((TLUser)request.Response.user));
|
||||
|
||||
return ((TLUser)request.Response.user);
|
||||
}
|
||||
|
||||
public async Task<TLUser> SignUpAsync(string phoneNumber, string phoneCodeHash, string code, string firstName, string lastName)
|
||||
{
|
||||
var request = new TLRequestSignUp() { phone_number = phoneNumber, phone_code = code, phone_code_hash = phoneCodeHash, first_name = firstName, last_name = lastName };
|
||||
await _sender.Send(request);
|
||||
await _sender.Receive(request);
|
||||
|
||||
OnUserAuthenticated(((TLUser)request.Response.user));
|
||||
|
||||
return ((TLUser)request.Response.user);
|
||||
}
|
||||
|
||||
public async Task<T> SendRequestAsync<T>(TLMethod methodToExecute)
|
||||
{
|
||||
await _sender.Send(methodToExecute);
|
||||
await _sender.Receive(methodToExecute);
|
||||
|
||||
var result = methodToExecute.GetType().GetProperty("Response").GetValue(methodToExecute);
|
||||
|
||||
return (T)result;
|
||||
}
|
||||
|
||||
public async Task<TLContacts> GetContactsAsync()
|
||||
{
|
||||
if (!IsUserAuthorized())
|
||||
throw new InvalidOperationException("Authorize user first!");
|
||||
|
||||
var req = new TLRequestGetContacts() { hash = "" };
|
||||
|
||||
return await SendRequestAsync<TLContacts>(req);
|
||||
}
|
||||
|
||||
public async Task<TLAbsUpdates> SendMessageAsync(TLAbsInputPeer peer, string message)
|
||||
{
|
||||
if (!IsUserAuthorized())
|
||||
throw new InvalidOperationException("Authorize user first!");
|
||||
|
||||
return await SendRequestAsync<TLAbsUpdates>(
|
||||
new TLRequestSendMessage()
|
||||
{
|
||||
peer = peer,
|
||||
message = message,
|
||||
random_id = Helpers.GenerateRandomLong()
|
||||
});
|
||||
}
|
||||
|
||||
public async Task<Boolean> SendTypingAsync(TLAbsInputPeer peer)
|
||||
{
|
||||
var req = new TLRequestSetTyping()
|
||||
{
|
||||
action = new TLSendMessageTypingAction(),
|
||||
peer = peer
|
||||
};
|
||||
return await SendRequestAsync<Boolean>(req);
|
||||
}
|
||||
|
||||
public async Task<TLAbsDialogs> GetUserDialogsAsync()
|
||||
{
|
||||
var peer = new TLInputPeerSelf();
|
||||
return await SendRequestAsync<TLAbsDialogs>(
|
||||
new TLRequestGetDialogs() { offset_date = 0, offset_peer = peer, limit = 100 });
|
||||
}
|
||||
|
||||
public async Task<TLAbsUpdates> SendUploadedPhoto(TLAbsInputPeer peer, TLAbsInputFile file, string caption)
|
||||
{
|
||||
return await SendRequestAsync<TLAbsUpdates>(new TLRequestSendMedia()
|
||||
{
|
||||
random_id = Helpers.GenerateRandomLong(),
|
||||
background = false,
|
||||
clear_draft = false,
|
||||
media = new TLInputMediaUploadedPhoto() { file = file, caption = caption },
|
||||
peer = peer
|
||||
});
|
||||
}
|
||||
|
||||
public async Task<TLAbsUpdates> SendUploadedDocument(
|
||||
TLAbsInputPeer peer, TLAbsInputFile file, string caption, string mimeType, TLVector<TLAbsDocumentAttribute> attributes)
|
||||
{
|
||||
return await SendRequestAsync<TLAbsUpdates>(new TLRequestSendMedia()
|
||||
{
|
||||
random_id = Helpers.GenerateRandomLong(),
|
||||
background = false,
|
||||
clear_draft = false,
|
||||
media = new TLInputMediaUploadedDocument()
|
||||
{
|
||||
file = file,
|
||||
caption = caption,
|
||||
mime_type = mimeType,
|
||||
attributes = attributes
|
||||
},
|
||||
peer = peer
|
||||
});
|
||||
}
|
||||
|
||||
public async Task<TLFile> GetFile(TLAbsInputFileLocation location, int filePartSize, int offset = 0)
|
||||
{
|
||||
TLFile result = null;
|
||||
try
|
||||
{
|
||||
result = await SendRequestAsync<TLFile>(new TLRequestGetFile()
|
||||
{
|
||||
location = location,
|
||||
limit = filePartSize,
|
||||
offset = offset
|
||||
});
|
||||
}
|
||||
catch (FileMigrationException ex)
|
||||
{
|
||||
var exportedAuth = await SendRequestAsync<TLExportedAuthorization>(new TLRequestExportAuthorization() { dc_id = ex.DC });
|
||||
|
||||
var authKey = _session.AuthKey;
|
||||
var timeOffset = _session.TimeOffset;
|
||||
var serverAddress = _session.ServerAddress;
|
||||
var serverPort = _session.Port;
|
||||
|
||||
await ReconnectToDcAsync(ex.DC);
|
||||
var auth = await SendRequestAsync<TLAuthorization>(new TLRequestImportAuthorization
|
||||
{
|
||||
bytes = exportedAuth.bytes,
|
||||
id = exportedAuth.id
|
||||
});
|
||||
result = await GetFile(location, filePartSize, offset);
|
||||
|
||||
_session.AuthKey = authKey;
|
||||
_session.TimeOffset = timeOffset;
|
||||
_transport = new TcpTransport(serverAddress, serverPort);
|
||||
_session.ServerAddress = serverAddress;
|
||||
_session.Port = serverPort;
|
||||
await ConnectAsync();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task SendPingAsync()
|
||||
{
|
||||
await _sender.SendPingAsync();
|
||||
}
|
||||
|
||||
public async Task<TLAbsMessages> GetHistoryAsync(TLAbsInputPeer peer, int offset, int max_id, int limit)
|
||||
|
|
@ -366,31 +366,31 @@ namespace TLSharp.Core
|
|||
limit = limit
|
||||
};
|
||||
return await SendRequestAsync<TLAbsMessages>(req);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Serch user or chat. API: contacts.search#11f812d8 q:string limit:int = contacts.Found;
|
||||
/// </summary>
|
||||
/// <param name="q">User or chat name</param>
|
||||
/// <param name="limit">Max result count</param>
|
||||
/// <returns></returns>
|
||||
public async Task<TLFound> SearchUserAsync(string q, int limit = 10)
|
||||
{
|
||||
var r = new TeleSharp.TL.Contacts.TLRequestSearch
|
||||
{
|
||||
q = q,
|
||||
limit = limit
|
||||
};
|
||||
|
||||
return await SendRequestAsync<TLFound>(r);
|
||||
}
|
||||
|
||||
private void OnUserAuthenticated(TLUser TLUser)
|
||||
{
|
||||
_session.TLUser = TLUser;
|
||||
_session.SessionExpires = int.MaxValue;
|
||||
|
||||
_session.Save();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Serch user or chat. API: contacts.search#11f812d8 q:string limit:int = contacts.Found;
|
||||
/// </summary>
|
||||
/// <param name="q">User or chat name</param>
|
||||
/// <param name="limit">Max result count</param>
|
||||
/// <returns></returns>
|
||||
public async Task<TLFound> SearchUserAsync(string q, int limit = 10)
|
||||
{
|
||||
var r = new TeleSharp.TL.Contacts.TLRequestSearch
|
||||
{
|
||||
q = q,
|
||||
limit = limit
|
||||
};
|
||||
|
||||
return await SendRequestAsync<TLFound>(r);
|
||||
}
|
||||
|
||||
private void OnUserAuthenticated(TLUser TLUser)
|
||||
{
|
||||
_session.TLUser = TLUser;
|
||||
_session.SessionExpires = int.MaxValue;
|
||||
|
||||
_session.Save();
|
||||
}
|
||||
|
||||
public bool IsConnected
|
||||
|
|
@ -403,32 +403,37 @@ namespace TLSharp.Core
|
|||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (_transport != null)
|
||||
{
|
||||
_transport.Dispose();
|
||||
_transport = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class MissingApiConfigurationException : Exception
|
||||
{
|
||||
public const string InfoUrl = "https://github.com/sochix/TLSharp#quick-configuration";
|
||||
|
||||
internal MissingApiConfigurationException(string invalidParamName) :
|
||||
base($"Your {invalidParamName} setting is missing. Adjust the configuration first, see {InfoUrl}")
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class InvalidPhoneCodeException : Exception
|
||||
{
|
||||
internal InvalidPhoneCodeException(string msg) : base(msg) { }
|
||||
}
|
||||
public class CloudPasswordNeededException : Exception
|
||||
{
|
||||
internal CloudPasswordNeededException(string msg) : base(msg) { }
|
||||
}
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
if (_transport != null)
|
||||
{
|
||||
_transport.Dispose();
|
||||
_transport = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class MissingApiConfigurationException : Exception
|
||||
{
|
||||
public const string InfoUrl = "https://github.com/sochix/TLSharp#quick-configuration";
|
||||
|
||||
internal MissingApiConfigurationException(string invalidParamName) :
|
||||
base($"Your {invalidParamName} setting is missing. Adjust the configuration first, see {InfoUrl}")
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class InvalidPhoneCodeException : Exception
|
||||
{
|
||||
internal InvalidPhoneCodeException(string msg) : base(msg)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class CloudPasswordNeededException : Exception
|
||||
{
|
||||
internal CloudPasswordNeededException(string msg) : base(msg)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -93,4 +93,4 @@ namespace TLSharp.Core.Utils
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
|
@ -132,4 +131,4 @@ namespace TLSharp.Core.Utils
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +1,4 @@
|
|||
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using NUnit.Framework;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TLSharp.Tests
|
||||
{
|
||||
|
|
@ -82,4 +78,4 @@ namespace TLSharp.Tests
|
|||
await base.SendMessageByUserNameTest();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +1,7 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// 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.VS")]
|
||||
|
|
@ -14,8 +13,8 @@ using System.Runtime.InteropServices;
|
|||
[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
|
||||
// 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)]
|
||||
|
||||
|
|
@ -25,12 +24,12 @@ using System.Runtime.InteropServices;
|
|||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// 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")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
|
|
@ -1,8 +1,6 @@
|
|||
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace TLSharp.Tests
|
||||
{
|
||||
[TestClass]
|
||||
|
|
@ -13,7 +11,7 @@ namespace TLSharp.Tests
|
|||
{
|
||||
base.Init(o => Assert.IsNotNull(o), b => Assert.IsTrue(b));
|
||||
}
|
||||
|
||||
|
||||
[TestMethod]
|
||||
public override async Task AuthUser()
|
||||
{
|
||||
|
|
@ -67,6 +65,7 @@ namespace TLSharp.Tests
|
|||
{
|
||||
await base.CheckPhones();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[Ignore]
|
||||
public override async Task FloodExceptionShouldNotCauseCannotReadPackageLengthError()
|
||||
|
|
@ -80,4 +79,4 @@ namespace TLSharp.Tests
|
|||
await base.SendMessageByUserNameTest();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +1,7 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// 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")]
|
||||
|
|
@ -14,8 +13,8 @@ using System.Runtime.InteropServices;
|
|||
[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
|
||||
// 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)]
|
||||
|
||||
|
|
@ -25,12 +24,12 @@ using System.Runtime.InteropServices;
|
|||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// 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")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
|
|
@ -1,5 +1,4 @@
|
|||
|
||||
using System;
|
||||
using System;
|
||||
using System.Configuration;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
|
|
@ -11,7 +10,6 @@ using TeleSharp.TL;
|
|||
using TeleSharp.TL.Messages;
|
||||
using TLSharp.Core;
|
||||
using TLSharp.Core.Network;
|
||||
using TLSharp.Core.Requests;
|
||||
using TLSharp.Core.Utils;
|
||||
|
||||
namespace TLSharp.Tests
|
||||
|
|
@ -38,7 +36,7 @@ namespace TLSharp.Tests
|
|||
|
||||
private int ApiId { get; set; }
|
||||
|
||||
class Assert
|
||||
private class Assert
|
||||
{
|
||||
static internal void IsNotNull(object obj)
|
||||
{
|
||||
|
|
@ -143,7 +141,7 @@ namespace TLSharp.Tests
|
|||
var password = await client.GetPasswordSetting();
|
||||
var password_str = PasswordToAuthenticate;
|
||||
|
||||
user = await client.MakeAuthWithPasswordAsync(password,password_str);
|
||||
user = await client.MakeAuthWithPasswordAsync(password, password_str);
|
||||
}
|
||||
catch (InvalidPhoneCodeException ex)
|
||||
{
|
||||
|
|
@ -191,7 +189,7 @@ namespace TLSharp.Tests
|
|||
|
||||
await client.ConnectAsync();
|
||||
|
||||
var dialogs = (TLDialogs) await client.GetUserDialogsAsync();
|
||||
var dialogs = (TLDialogs)await client.GetUserDialogsAsync();
|
||||
var chat = dialogs.chats.lists
|
||||
.OfType<TLChannel>()
|
||||
.FirstOrDefault(c => c.title == "TestGroup");
|
||||
|
|
@ -268,7 +266,7 @@ namespace TLSharp.Tests
|
|||
version = document.version
|
||||
},
|
||||
document.size);
|
||||
|
||||
|
||||
Assert.IsTrue(resFile.bytes.Length > 0);
|
||||
}
|
||||
|
||||
|
|
@ -283,9 +281,9 @@ namespace TLSharp.Tests
|
|||
var user = result.users.lists
|
||||
.OfType<TLUser>()
|
||||
.FirstOrDefault(x => x.id == 5880094);
|
||||
|
||||
|
||||
var photo = ((TLUserProfilePhoto)user.photo);
|
||||
var photoLocation = (TLFileLocation) photo.photo_big;
|
||||
var photoLocation = (TLFileLocation)photo.photo_big;
|
||||
|
||||
var resFile = await client.GetFile(new TLInputFileLocation()
|
||||
{
|
||||
|
|
@ -294,7 +292,7 @@ namespace TLSharp.Tests
|
|||
volume_id = photoLocation.volume_id
|
||||
}, 1024);
|
||||
|
||||
var res = await client.GetUserDialogsAsync();
|
||||
var res = await client.GetUserDialogsAsync();
|
||||
|
||||
Assert.IsTrue(resFile.bytes.Length > 0);
|
||||
}
|
||||
|
|
@ -377,4 +375,4 @@ namespace TLSharp.Tests
|
|||
await client.SendMessageAsync(new TLInputPeerUser() { user_id = user.id }, "TEST");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -5,11 +5,11 @@
|
|||
<add key="ApiId" value="" />
|
||||
<add key="NumberToAuthenticate" value="" />
|
||||
<add key="CodeToAuthenticate" value="" />
|
||||
<add key="PasswordToAuthenticate" value=""/>
|
||||
<add key="NotRegisteredNumberToSignUp" value=""/>
|
||||
<add key="NumberToSendMessage" value=""/>
|
||||
<add key="UserNameToSendMessage" value=""/>
|
||||
<add key="NumberToGetUserFull" value=""/>
|
||||
<add key="NumberToAddToChat" value=""/>
|
||||
<add key="PasswordToAuthenticate" value="" />
|
||||
<add key="NotRegisteredNumberToSignUp" value="" />
|
||||
<add key="NumberToSendMessage" value="" />
|
||||
<add key="UserNameToSendMessage" value="" />
|
||||
<add key="NumberToGetUserFull" value="" />
|
||||
<add key="NumberToAddToChat" value="" />
|
||||
</appSettings>
|
||||
</configuration>
|
||||
</configuration>
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
||||
</startup>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
||||
</startup>
|
||||
</configuration>
|
||||
|
|
@ -1,36 +1,38 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json.Schema;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace TeleSharp.Generator
|
||||
{
|
||||
class Method
|
||||
internal 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; }
|
||||
|
||||
public string type { get; set; }
|
||||
}
|
||||
class Param
|
||||
|
||||
internal class Param
|
||||
{
|
||||
public string name { get; set; }
|
||||
public string type { get; set; }
|
||||
}
|
||||
class Constructor
|
||||
|
||||
internal 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
|
||||
|
||||
internal class Schema
|
||||
{
|
||||
public List<Constructor> constructors { get; set; }
|
||||
public List<Method> methods { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,24 +1,18 @@
|
|||
using Newtonsoft.Json;
|
||||
using System;
|
||||
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
|
||||
internal 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)
|
||||
{
|
||||
private 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" });
|
||||
private static List<String> interfacesList = new List<string>();
|
||||
private static List<String> classesList = new List<string>();
|
||||
|
||||
private static void Main(string[] args)
|
||||
{
|
||||
string AbsStyle = File.ReadAllText("ConstructorAbs.tmp");
|
||||
string NormalStyle = File.ReadAllText("Constructor.tmp");
|
||||
string MethodStyle = File.ReadAllText("Method.tmp");
|
||||
|
|
@ -68,6 +62,7 @@ namespace TeleSharp.Generator
|
|||
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);
|
||||
|
|
@ -75,16 +70,22 @@ namespace TeleSharp.Generator
|
|||
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
|
||||
|
||||
#endregion About Class
|
||||
|
||||
#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
|
||||
|
||||
#endregion Fields
|
||||
|
||||
#region ComputeFlagFunc
|
||||
|
||||
if (!c.Params.Any(x => x.name == "flags")) temp = temp.Replace("/* COMPUTE */", "");
|
||||
else
|
||||
{
|
||||
|
|
@ -102,8 +103,11 @@ namespace TeleSharp.Generator
|
|||
}
|
||||
temp = temp.Replace("/* COMPUTE */", compute);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#endregion ComputeFlagFunc
|
||||
|
||||
#region SerializeFunc
|
||||
|
||||
var serialize = "";
|
||||
|
||||
if (c.Params.Any(x => x.name == "flags")) serialize += "ComputeFlags();" + Environment.NewLine + "bw.Write(flags);" + Environment.NewLine;
|
||||
|
|
@ -112,8 +116,11 @@ namespace TeleSharp.Generator
|
|||
serialize += WriteWriteCode(p) + Environment.NewLine;
|
||||
}
|
||||
temp = temp.Replace("/* SERIALIZE */", serialize);
|
||||
#endregion
|
||||
|
||||
#endregion SerializeFunc
|
||||
|
||||
#region DeSerializeFunc
|
||||
|
||||
var deserialize = "";
|
||||
|
||||
foreach (var p in c.Params)
|
||||
|
|
@ -121,7 +128,9 @@ namespace TeleSharp.Generator
|
|||
deserialize += WriteReadCode(p) + Environment.NewLine;
|
||||
}
|
||||
temp = temp.Replace("/* DESERIALIZE */", deserialize);
|
||||
#endregion
|
||||
|
||||
#endregion DeSerializeFunc
|
||||
|
||||
writer.Write(temp);
|
||||
writer.Close();
|
||||
classFile.Close();
|
||||
|
|
@ -134,6 +143,7 @@ namespace TeleSharp.Generator
|
|||
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);
|
||||
|
|
@ -141,8 +151,11 @@ namespace TeleSharp.Generator
|
|||
temp = temp.Replace("/* PARENT */", "TLMethod");
|
||||
temp = temp.Replace("/*Constructor*/", c.id.ToString());
|
||||
temp = temp.Replace("/* NAME */", GetNameofClass(c.method, false, true));
|
||||
#endregion
|
||||
|
||||
#endregion About Class
|
||||
|
||||
#region Fields
|
||||
|
||||
string fields = "";
|
||||
foreach (var tmp in c.Params)
|
||||
{
|
||||
|
|
@ -150,8 +163,11 @@ namespace TeleSharp.Generator
|
|||
}
|
||||
fields += $" public {CheckForFlagBase(c.type, GetTypeName(c.type))} Response" + "{ get; set;}" + Environment.NewLine;
|
||||
temp = temp.Replace("/* PARAMS */", fields);
|
||||
#endregion
|
||||
|
||||
#endregion Fields
|
||||
|
||||
#region ComputeFlagFunc
|
||||
|
||||
if (!c.Params.Any(x => x.name == "flags")) temp = temp.Replace("/* COMPUTE */", "");
|
||||
else
|
||||
{
|
||||
|
|
@ -169,8 +185,11 @@ namespace TeleSharp.Generator
|
|||
}
|
||||
temp = temp.Replace("/* COMPUTE */", compute);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#endregion ComputeFlagFunc
|
||||
|
||||
#region SerializeFunc
|
||||
|
||||
var serialize = "";
|
||||
|
||||
if (c.Params.Any(x => x.name == "flags")) serialize += "ComputeFlags();" + Environment.NewLine + "bw.Write(flags);" + Environment.NewLine;
|
||||
|
|
@ -179,8 +198,11 @@ namespace TeleSharp.Generator
|
|||
serialize += WriteWriteCode(p) + Environment.NewLine;
|
||||
}
|
||||
temp = temp.Replace("/* SERIALIZE */", serialize);
|
||||
#endregion
|
||||
|
||||
#endregion SerializeFunc
|
||||
|
||||
#region DeSerializeFunc
|
||||
|
||||
var deserialize = "";
|
||||
|
||||
foreach (var p in c.Params)
|
||||
|
|
@ -188,19 +210,25 @@ namespace TeleSharp.Generator
|
|||
deserialize += WriteReadCode(p) + Environment.NewLine;
|
||||
}
|
||||
temp = temp.Replace("/* DESERIALIZE */", deserialize);
|
||||
#endregion
|
||||
|
||||
#endregion DeSerializeFunc
|
||||
|
||||
#region DeSerializeRespFunc
|
||||
|
||||
var deserializeResp = "";
|
||||
Param p2 = new Param() { name = "Response", type = c.type };
|
||||
deserializeResp += WriteReadCode(p2) + Environment.NewLine;
|
||||
temp = temp.Replace("/* DESERIALIZEResp */", deserializeResp);
|
||||
#endregion
|
||||
|
||||
#endregion DeSerializeRespFunc
|
||||
|
||||
writer.Write(temp);
|
||||
writer.Close();
|
||||
classFile.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static string FormatName(string input)
|
||||
{
|
||||
if (String.IsNullOrEmpty(input))
|
||||
|
|
@ -217,11 +245,13 @@ namespace TeleSharp.Generator
|
|||
}
|
||||
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)
|
||||
|
|
@ -243,18 +273,22 @@ namespace TeleSharp.Generator
|
|||
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)
|
||||
|
|
@ -262,6 +296,7 @@ namespace TeleSharp.Generator
|
|||
else
|
||||
return "TeleSharp.TL";
|
||||
}
|
||||
|
||||
public static string CheckForFlagBase(string type, string result)
|
||||
{
|
||||
if (type.IndexOf('?') == -1)
|
||||
|
|
@ -274,6 +309,7 @@ namespace TeleSharp.Generator
|
|||
else return result;
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetTypeName(string type)
|
||||
{
|
||||
switch (type.ToLower())
|
||||
|
|
@ -281,21 +317,29 @@ namespace TeleSharp.Generator
|
|||
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";
|
||||
}
|
||||
|
|
@ -306,10 +350,8 @@ namespace TeleSharp.Generator
|
|||
if (type.ToLower().Contains("inputcontact"))
|
||||
return "TLInputPhoneContact";
|
||||
|
||||
|
||||
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()))
|
||||
|
|
@ -330,9 +372,8 @@ namespace TeleSharp.Generator
|
|||
{
|
||||
return GetTypeName(type.Split('?')[1]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static string LookTypeInLists(string src)
|
||||
{
|
||||
if (interfacesList.Any(x => x.ToLower() == src.ToLower()))
|
||||
|
|
@ -342,6 +383,7 @@ namespace TeleSharp.Generator
|
|||
else
|
||||
return src;
|
||||
}
|
||||
|
||||
public static string WriteWriteCode(Param p, bool flag = false)
|
||||
{
|
||||
switch (p.type.ToLower())
|
||||
|
|
@ -377,6 +419,7 @@ namespace TeleSharp.Generator
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static string WriteReadCode(Param p)
|
||||
{
|
||||
switch (p.type.ToLower())
|
||||
|
|
@ -419,6 +462,7 @@ namespace TeleSharp.Generator
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static FileStream MakeFile(string path)
|
||||
{
|
||||
if (!Directory.Exists(Path.GetDirectoryName(path)))
|
||||
|
|
@ -428,5 +472,4 @@ namespace TeleSharp.Generator
|
|||
return File.OpenWrite(path);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,8 +1,7 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// 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")]
|
||||
|
|
@ -14,8 +13,8 @@ using System.Runtime.InteropServices;
|
|||
[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
|
||||
// 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)]
|
||||
|
||||
|
|
@ -25,12 +24,12 @@ using System.Runtime.InteropServices;
|
|||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// 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")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
|
|
@ -1,11 +1,6 @@
|
|||
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
|
||||
|
|
@ -14,12 +9,13 @@ namespace TeleSharp.TL
|
|||
{
|
||||
int Constructor = reader.ReadInt32();
|
||||
object obj;
|
||||
Type t =null;
|
||||
try {
|
||||
Type t = null;
|
||||
try
|
||||
{
|
||||
t = TLContext.getType(Constructor);
|
||||
obj = Activator.CreateInstance(t);
|
||||
}
|
||||
catch(Exception ex)
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new InvalidDataException("Constructor Invalid Or Context.Init Not Called !", ex);
|
||||
}
|
||||
|
|
@ -35,10 +31,12 @@ namespace TeleSharp.TL
|
|||
}
|
||||
else throw new NotImplementedException("Weird Type : " + t.Namespace + " | " + t.Name);
|
||||
}
|
||||
public static void SerializeObject(object obj,BinaryWriter writer)
|
||||
|
||||
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");
|
||||
|
|
@ -47,4 +45,4 @@ namespace TeleSharp.TL
|
|||
return t;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +1,7 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// 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")]
|
||||
|
|
@ -14,8 +13,8 @@ using System.Runtime.InteropServices;
|
|||
[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
|
||||
// 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)]
|
||||
|
||||
|
|
@ -25,12 +24,12 @@ using System.Runtime.InteropServices;
|
|||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// 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")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
|
|
@ -1,13 +1,6 @@
|
|||
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
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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)]
|
||||
|
|
@ -20,23 +15,19 @@ namespace TeleSharp.TL.Account
|
|||
|
||||
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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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)]
|
||||
|
|
@ -21,17 +16,14 @@ namespace TeleSharp.TL.Account
|
|||
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)
|
||||
|
|
@ -39,7 +31,6 @@ namespace TeleSharp.TL.Account
|
|||
bw.Write(Constructor);
|
||||
BytesUtil.Serialize(new_salt, bw);
|
||||
StringUtil.Serialize(email_unconfirmed_pattern, bw);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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)]
|
||||
|
|
@ -24,10 +19,8 @@ namespace TeleSharp.TL.Account
|
|||
public bool has_recovery { get; set; }
|
||||
public string email_unconfirmed_pattern { get; set; }
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
|
|
@ -37,7 +30,6 @@ namespace TeleSharp.TL.Account
|
|||
hint = StringUtil.Deserialize(br);
|
||||
has_recovery = BoolUtil.Deserialize(br);
|
||||
email_unconfirmed_pattern = StringUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
|
|
@ -48,7 +40,6 @@ namespace TeleSharp.TL.Account
|
|||
StringUtil.Serialize(hint, bw);
|
||||
BoolUtil.Serialize(has_recovery, bw);
|
||||
StringUtil.Serialize(email_unconfirmed_pattern, bw);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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)]
|
||||
|
|
@ -24,7 +19,6 @@ namespace TeleSharp.TL.Account
|
|||
public string hint { get; set; }
|
||||
public string email { get; set; }
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
flags = 0;
|
||||
|
|
@ -32,7 +26,6 @@ namespace TeleSharp.TL.Account
|
|||
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)
|
||||
|
|
@ -57,8 +50,6 @@ namespace TeleSharp.TL.Account
|
|||
email = StringUtil.Deserialize(br);
|
||||
else
|
||||
email = null;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
|
|
@ -74,7 +65,6 @@ namespace TeleSharp.TL.Account
|
|||
StringUtil.Serialize(hint, bw);
|
||||
if ((flags & 2) != 0)
|
||||
StringUtil.Serialize(email, bw);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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)]
|
||||
|
|
@ -20,23 +15,19 @@ namespace TeleSharp.TL.Account
|
|||
|
||||
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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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)]
|
||||
|
|
@ -21,17 +16,14 @@ namespace TeleSharp.TL.Account
|
|||
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)
|
||||
|
|
@ -39,7 +31,6 @@ namespace TeleSharp.TL.Account
|
|||
bw.Write(Constructor);
|
||||
ObjectUtils.SerializeObject(rules, bw);
|
||||
ObjectUtils.SerializeObject(users, bw);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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)]
|
||||
|
|
@ -23,10 +18,8 @@ namespace TeleSharp.TL.Account
|
|||
public string phone_code { get; set; }
|
||||
public TLAbsUser Response { get; set; }
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
|
|
@ -34,7 +27,6 @@ namespace TeleSharp.TL.Account
|
|||
phone_number = StringUtil.Deserialize(br);
|
||||
phone_code_hash = StringUtil.Deserialize(br);
|
||||
phone_code = StringUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
|
|
@ -43,12 +35,11 @@ namespace TeleSharp.TL.Account
|
|||
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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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)]
|
||||
|
|
@ -21,28 +16,24 @@ namespace TeleSharp.TL.Account
|
|||
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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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(1596029123)]
|
||||
|
|
@ -22,17 +17,14 @@ namespace TeleSharp.TL.Account
|
|||
public string phone_code { get; set; }
|
||||
public bool Response { get; set; }
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
phone_code_hash = StringUtil.Deserialize(br);
|
||||
phone_code = StringUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
|
|
@ -40,12 +32,11 @@ namespace TeleSharp.TL.Account
|
|||
bw.Write(Constructor);
|
||||
StringUtil.Serialize(phone_code_hash, bw);
|
||||
StringUtil.Serialize(phone_code, bw);
|
||||
|
||||
}
|
||||
|
||||
public override void deserializeResponse(BinaryReader br)
|
||||
{
|
||||
Response = BoolUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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)]
|
||||
|
|
@ -21,28 +16,24 @@ namespace TeleSharp.TL.Account
|
|||
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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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)]
|
||||
|
|
@ -20,26 +15,22 @@ namespace TeleSharp.TL.Account
|
|||
|
||||
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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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)]
|
||||
|
|
@ -20,26 +15,22 @@ namespace TeleSharp.TL.Account
|
|||
|
||||
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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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)]
|
||||
|
|
@ -21,28 +16,24 @@ namespace TeleSharp.TL.Account
|
|||
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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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)]
|
||||
|
|
@ -20,26 +15,22 @@ namespace TeleSharp.TL.Account
|
|||
|
||||
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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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)]
|
||||
|
|
@ -21,28 +16,24 @@ namespace TeleSharp.TL.Account
|
|||
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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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)]
|
||||
|
|
@ -21,28 +16,24 @@ namespace TeleSharp.TL.Account
|
|||
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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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(1250046590)]
|
||||
|
|
@ -22,17 +17,14 @@ namespace TeleSharp.TL.Account
|
|||
public int period { get; set; }
|
||||
public Account.TLTmpPassword Response { get; set; }
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
password_hash = BytesUtil.Deserialize(br);
|
||||
period = br.ReadInt32();
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
|
|
@ -40,12 +32,11 @@ namespace TeleSharp.TL.Account
|
|||
bw.Write(Constructor);
|
||||
BytesUtil.Serialize(password_hash, bw);
|
||||
bw.Write(period);
|
||||
|
||||
}
|
||||
|
||||
public override void deserializeResponse(BinaryReader br)
|
||||
{
|
||||
Response = (Account.TLTmpPassword)ObjectUtils.DeserializeObject(br);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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)]
|
||||
|
|
@ -20,26 +15,22 @@ namespace TeleSharp.TL.Account
|
|||
|
||||
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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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)]
|
||||
|
|
@ -22,17 +17,14 @@ namespace TeleSharp.TL.Account
|
|||
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)
|
||||
|
|
@ -40,12 +32,11 @@ namespace TeleSharp.TL.Account
|
|||
bw.Write(Constructor);
|
||||
bw.Write(token_type);
|
||||
StringUtil.Serialize(token, bw);
|
||||
|
||||
}
|
||||
|
||||
public override void deserializeResponse(BinaryReader br)
|
||||
{
|
||||
Response = BoolUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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)]
|
||||
|
|
@ -22,17 +17,14 @@ namespace TeleSharp.TL.Account
|
|||
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)
|
||||
|
|
@ -40,12 +32,11 @@ namespace TeleSharp.TL.Account
|
|||
bw.Write(Constructor);
|
||||
ObjectUtils.SerializeObject(peer, bw);
|
||||
ObjectUtils.SerializeObject(reason, bw);
|
||||
|
||||
}
|
||||
|
||||
public override void deserializeResponse(BinaryReader br)
|
||||
{
|
||||
Response = BoolUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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)]
|
||||
|
|
@ -21,28 +16,24 @@ namespace TeleSharp.TL.Account
|
|||
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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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)]
|
||||
|
|
@ -20,26 +15,22 @@ namespace TeleSharp.TL.Account
|
|||
|
||||
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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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)]
|
||||
|
|
@ -24,13 +19,11 @@ namespace TeleSharp.TL.Account
|
|||
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)
|
||||
|
|
@ -42,8 +35,6 @@ namespace TeleSharp.TL.Account
|
|||
current_number = BoolUtil.Deserialize(br);
|
||||
else
|
||||
current_number = null;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
|
|
@ -55,12 +46,11 @@ namespace TeleSharp.TL.Account
|
|||
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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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(353818557)]
|
||||
|
|
@ -24,13 +19,11 @@ namespace TeleSharp.TL.Account
|
|||
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)
|
||||
|
|
@ -42,8 +35,6 @@ namespace TeleSharp.TL.Account
|
|||
current_number = BoolUtil.Deserialize(br);
|
||||
else
|
||||
current_number = null;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
|
|
@ -55,12 +46,11 @@ namespace TeleSharp.TL.Account
|
|||
StringUtil.Serialize(hash, bw);
|
||||
if ((flags & 1) != 0)
|
||||
BoolUtil.Serialize(current_number.Value, bw);
|
||||
|
||||
}
|
||||
|
||||
public override void deserializeResponse(BinaryReader br)
|
||||
{
|
||||
Response = (Auth.TLSentCode)ObjectUtils.DeserializeObject(br);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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)]
|
||||
|
|
@ -21,28 +16,24 @@ namespace TeleSharp.TL.Account
|
|||
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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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)]
|
||||
|
|
@ -22,17 +17,14 @@ namespace TeleSharp.TL.Account
|
|||
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)
|
||||
|
|
@ -40,12 +32,11 @@ namespace TeleSharp.TL.Account
|
|||
bw.Write(Constructor);
|
||||
ObjectUtils.SerializeObject(key, bw);
|
||||
ObjectUtils.SerializeObject(rules, bw);
|
||||
|
||||
}
|
||||
|
||||
public override void deserializeResponse(BinaryReader br)
|
||||
{
|
||||
Response = (Account.TLPrivacyRules)ObjectUtils.DeserializeObject(br);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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)]
|
||||
|
|
@ -22,17 +17,14 @@ namespace TeleSharp.TL.Account
|
|||
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)
|
||||
|
|
@ -40,12 +32,11 @@ namespace TeleSharp.TL.Account
|
|||
bw.Write(Constructor);
|
||||
bw.Write(token_type);
|
||||
StringUtil.Serialize(token, bw);
|
||||
|
||||
}
|
||||
|
||||
public override void deserializeResponse(BinaryReader br)
|
||||
{
|
||||
Response = BoolUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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)]
|
||||
|
|
@ -21,28 +16,24 @@ namespace TeleSharp.TL.Account
|
|||
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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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)]
|
||||
|
|
@ -22,17 +17,14 @@ namespace TeleSharp.TL.Account
|
|||
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)
|
||||
|
|
@ -40,12 +32,11 @@ namespace TeleSharp.TL.Account
|
|||
bw.Write(Constructor);
|
||||
ObjectUtils.SerializeObject(peer, bw);
|
||||
ObjectUtils.SerializeObject(settings, bw);
|
||||
|
||||
}
|
||||
|
||||
public override void deserializeResponse(BinaryReader br)
|
||||
{
|
||||
Response = BoolUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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)]
|
||||
|
|
@ -22,17 +17,14 @@ namespace TeleSharp.TL.Account
|
|||
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)
|
||||
|
|
@ -40,12 +32,11 @@ namespace TeleSharp.TL.Account
|
|||
bw.Write(Constructor);
|
||||
BytesUtil.Serialize(current_password_hash, bw);
|
||||
ObjectUtils.SerializeObject(new_settings, bw);
|
||||
|
||||
}
|
||||
|
||||
public override void deserializeResponse(BinaryReader br)
|
||||
{
|
||||
Response = BoolUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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)]
|
||||
|
|
@ -24,14 +19,12 @@ namespace TeleSharp.TL.Account
|
|||
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)
|
||||
|
|
@ -51,8 +44,6 @@ namespace TeleSharp.TL.Account
|
|||
about = StringUtil.Deserialize(br);
|
||||
else
|
||||
about = null;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
|
|
@ -66,12 +57,11 @@ namespace TeleSharp.TL.Account
|
|||
StringUtil.Serialize(last_name, bw);
|
||||
if ((flags & 4) != 0)
|
||||
StringUtil.Serialize(about, bw);
|
||||
|
||||
}
|
||||
|
||||
public override void deserializeResponse(BinaryReader br)
|
||||
{
|
||||
Response = (TLAbsUser)ObjectUtils.DeserializeObject(br);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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)]
|
||||
|
|
@ -21,28 +16,24 @@ namespace TeleSharp.TL.Account
|
|||
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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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)]
|
||||
|
|
@ -21,28 +16,24 @@ namespace TeleSharp.TL.Account
|
|||
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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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(-614138572)]
|
||||
|
|
@ -21,17 +16,14 @@ namespace TeleSharp.TL.Account
|
|||
public byte[] tmp_password { get; set; }
|
||||
public int valid_until { get; set; }
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
tmp_password = BytesUtil.Deserialize(br);
|
||||
valid_until = br.ReadInt32();
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
|
|
@ -39,7 +31,6 @@ namespace TeleSharp.TL.Account
|
|||
bw.Write(Constructor);
|
||||
BytesUtil.Serialize(tmp_password, bw);
|
||||
bw.Write(valid_until);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,13 +1,6 @@
|
|||
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
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,13 +1,6 @@
|
|||
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
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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(-855308010)]
|
||||
|
|
@ -22,12 +17,10 @@ namespace TeleSharp.TL.Auth
|
|||
public int? tmp_sessions { get; set; }
|
||||
public TLAbsUser user { get; set; }
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
flags = 0;
|
||||
flags = tmp_sessions != null ? (flags | 1) : (flags & ~1);
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
|
|
@ -39,7 +32,6 @@ namespace TeleSharp.TL.Auth
|
|||
tmp_sessions = null;
|
||||
|
||||
user = (TLAbsUser)ObjectUtils.DeserializeObject(br);
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
|
|
@ -50,7 +42,6 @@ namespace TeleSharp.TL.Auth
|
|||
if ((flags & 1) != 0)
|
||||
bw.Write(tmp_sessions.Value);
|
||||
ObjectUtils.SerializeObject(user, bw);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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)]
|
||||
|
|
@ -20,23 +15,19 @@ namespace TeleSharp.TL.Auth
|
|||
|
||||
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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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)]
|
||||
|
|
@ -18,22 +13,17 @@ namespace TeleSharp.TL.Auth
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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)]
|
||||
|
|
@ -18,22 +13,17 @@ namespace TeleSharp.TL.Auth
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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)]
|
||||
|
|
@ -18,22 +13,17 @@ namespace TeleSharp.TL.Auth
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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)]
|
||||
|
|
@ -21,17 +16,14 @@ namespace TeleSharp.TL.Auth
|
|||
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)
|
||||
|
|
@ -39,7 +31,6 @@ namespace TeleSharp.TL.Auth
|
|||
bw.Write(Constructor);
|
||||
bw.Write(id);
|
||||
BytesUtil.Serialize(bytes, bw);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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)]
|
||||
|
|
@ -20,23 +15,19 @@ namespace TeleSharp.TL.Auth
|
|||
|
||||
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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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)]
|
||||
|
|
@ -24,10 +19,8 @@ namespace TeleSharp.TL.Auth
|
|||
public byte[] encrypted_message { get; set; }
|
||||
public bool Response { get; set; }
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
|
|
@ -36,7 +29,6 @@ namespace TeleSharp.TL.Auth
|
|||
nonce = br.ReadInt64();
|
||||
expires_at = br.ReadInt32();
|
||||
encrypted_message = BytesUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
|
|
@ -46,12 +38,11 @@ namespace TeleSharp.TL.Auth
|
|||
bw.Write(nonce);
|
||||
bw.Write(expires_at);
|
||||
BytesUtil.Serialize(encrypted_message, bw);
|
||||
|
||||
}
|
||||
|
||||
public override void deserializeResponse(BinaryReader br)
|
||||
{
|
||||
Response = BoolUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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)]
|
||||
|
|
@ -22,17 +17,14 @@ namespace TeleSharp.TL.Auth
|
|||
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)
|
||||
|
|
@ -40,12 +32,11 @@ namespace TeleSharp.TL.Auth
|
|||
bw.Write(Constructor);
|
||||
StringUtil.Serialize(phone_number, bw);
|
||||
StringUtil.Serialize(phone_code_hash, bw);
|
||||
|
||||
}
|
||||
|
||||
public override void deserializeResponse(BinaryReader br)
|
||||
{
|
||||
Response = BoolUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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)]
|
||||
|
|
@ -21,28 +16,24 @@ namespace TeleSharp.TL.Auth
|
|||
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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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)]
|
||||
|
|
@ -21,28 +16,24 @@ namespace TeleSharp.TL.Auth
|
|||
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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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(-1907842680)]
|
||||
|
|
@ -21,28 +16,24 @@ namespace TeleSharp.TL.Auth
|
|||
public TLVector<long> except_auth_keys { get; set; }
|
||||
public bool Response { get; set; }
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
{
|
||||
except_auth_keys = (TLVector<long>)ObjectUtils.DeserializeVector<long>(br);
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Constructor);
|
||||
ObjectUtils.SerializeObject(except_auth_keys, bw);
|
||||
|
||||
}
|
||||
|
||||
public override void deserializeResponse(BinaryReader br)
|
||||
{
|
||||
Response = BoolUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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)]
|
||||
|
|
@ -21,28 +16,24 @@ namespace TeleSharp.TL.Auth
|
|||
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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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)]
|
||||
|
|
@ -22,17 +17,14 @@ namespace TeleSharp.TL.Auth
|
|||
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)
|
||||
|
|
@ -40,12 +32,11 @@ namespace TeleSharp.TL.Auth
|
|||
bw.Write(Constructor);
|
||||
bw.Write(id);
|
||||
BytesUtil.Serialize(bytes, bw);
|
||||
|
||||
}
|
||||
|
||||
public override void deserializeResponse(BinaryReader br)
|
||||
{
|
||||
Response = (Auth.TLAuthorization)ObjectUtils.DeserializeObject(br);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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)]
|
||||
|
|
@ -24,11 +19,9 @@ namespace TeleSharp.TL.Auth
|
|||
public string bot_auth_token { get; set; }
|
||||
public Auth.TLAuthorization Response { get; set; }
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
flags = 0;
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
|
|
@ -37,7 +30,6 @@ namespace TeleSharp.TL.Auth
|
|||
api_id = br.ReadInt32();
|
||||
api_hash = StringUtil.Deserialize(br);
|
||||
bot_auth_token = StringUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
|
|
@ -48,12 +40,11 @@ namespace TeleSharp.TL.Auth
|
|||
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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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)]
|
||||
|
|
@ -20,26 +15,22 @@ namespace TeleSharp.TL.Auth
|
|||
|
||||
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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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)]
|
||||
|
|
@ -21,28 +16,24 @@ namespace TeleSharp.TL.Auth
|
|||
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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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)]
|
||||
|
|
@ -20,26 +15,22 @@ namespace TeleSharp.TL.Auth
|
|||
|
||||
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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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)]
|
||||
|
|
@ -22,17 +17,14 @@ namespace TeleSharp.TL.Auth
|
|||
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)
|
||||
|
|
@ -40,12 +32,11 @@ namespace TeleSharp.TL.Auth
|
|||
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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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)]
|
||||
|
|
@ -20,26 +15,22 @@ namespace TeleSharp.TL.Auth
|
|||
|
||||
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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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)]
|
||||
|
|
@ -26,13 +21,11 @@ namespace TeleSharp.TL.Auth
|
|||
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)
|
||||
|
|
@ -47,7 +40,6 @@ namespace TeleSharp.TL.Auth
|
|||
|
||||
api_id = br.ReadInt32();
|
||||
api_hash = StringUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
|
|
@ -61,12 +53,11 @@ namespace TeleSharp.TL.Auth
|
|||
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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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)]
|
||||
|
|
@ -22,17 +17,14 @@ namespace TeleSharp.TL.Auth
|
|||
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)
|
||||
|
|
@ -40,12 +32,11 @@ namespace TeleSharp.TL.Auth
|
|||
bw.Write(Constructor);
|
||||
ObjectUtils.SerializeObject(phone_numbers, bw);
|
||||
StringUtil.Serialize(message, bw);
|
||||
|
||||
}
|
||||
|
||||
public override void deserializeResponse(BinaryReader br)
|
||||
{
|
||||
Response = BoolUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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)]
|
||||
|
|
@ -23,10 +18,8 @@ namespace TeleSharp.TL.Auth
|
|||
public string phone_code { get; set; }
|
||||
public Auth.TLAuthorization Response { get; set; }
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
|
|
@ -34,7 +27,6 @@ namespace TeleSharp.TL.Auth
|
|||
phone_number = StringUtil.Deserialize(br);
|
||||
phone_code_hash = StringUtil.Deserialize(br);
|
||||
phone_code = StringUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
|
|
@ -43,12 +35,11 @@ namespace TeleSharp.TL.Auth
|
|||
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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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)]
|
||||
|
|
@ -25,10 +20,8 @@ namespace TeleSharp.TL.Auth
|
|||
public string last_name { get; set; }
|
||||
public Auth.TLAuthorization Response { get; set; }
|
||||
|
||||
|
||||
public void ComputeFlags()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void DeserializeBody(BinaryReader br)
|
||||
|
|
@ -38,7 +31,6 @@ namespace TeleSharp.TL.Auth
|
|||
phone_code = StringUtil.Deserialize(br);
|
||||
first_name = StringUtil.Deserialize(br);
|
||||
last_name = StringUtil.Deserialize(br);
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
|
|
@ -49,12 +41,11 @@ namespace TeleSharp.TL.Auth
|
|||
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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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)]
|
||||
|
|
@ -25,14 +20,12 @@ namespace TeleSharp.TL.Auth
|
|||
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)
|
||||
|
|
@ -50,8 +43,6 @@ namespace TeleSharp.TL.Auth
|
|||
timeout = br.ReadInt32();
|
||||
else
|
||||
timeout = null;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public override void SerializeBody(BinaryWriter bw)
|
||||
|
|
@ -66,7 +57,6 @@ namespace TeleSharp.TL.Auth
|
|||
ObjectUtils.SerializeObject(next_type, bw);
|
||||
if ((flags & 4) != 0)
|
||||
bw.Write(timeout.Value);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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)]
|
||||
|
|
@ -20,23 +15,19 @@ namespace TeleSharp.TL.Auth
|
|||
|
||||
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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
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)]
|
||||
|
|
@ -20,23 +15,19 @@ namespace TeleSharp.TL.Auth
|
|||
|
||||
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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue