Just be safe, let's not wait until other part of the code saves the
session, and let's do it right here on the spot, where we know it
changes.
@Laituex was having a ErrCode=32 'msg_seqno too low' problem and this
is the second thing we suspected to be the culprit, because if there's
any issue (e.g. exception) that makes the session not be saved after
the sequence got incremented, then an old sequence would be used the
next time upon loading an old session file.
Even if you're not supposed to use multiple threads with TLSharp,
it might be worth it to try to make this sequence increment in
a thread-safe way. Race conditions are always bad even if you know
you are not supposed to use something in a certain way...
@Laituex was having a ErrCode=32 'msg_seqno too low' problem and this
is the first thing we looked at (even if he swore that he was not
using different threads to access the telegram network)
The schema is in https://core.telegram.org/schema/json so it's more
logical to expect the file to be named `json`, which is what would
happen if you download it with wget, for example.
Because we might use dependencies soon that require this framework.
And anyway these days the .NET world is mostly a hybrid between
.NETStandard/.NETCore libs and .NET4.6 ones, not older than that.
WARNING: NU5118: File 'D:\a\TLSharp\TLSharp\TLSharp.Core\bin\Debug\TLSharp.Core.dll' is not added because the package already contains file 'lib\net45\TLSharp.Core.dll'
When trying to SendRequest it was throwing an exception saying "cannot cast object of type TeleSharp.TL.TLStickerSet to TeleSharp.TL.Messages.TLStickerSet"
Fixes https://github.com/sochix/TLSharp/issues/826
Added CancellationToken with default value to all async methods in TLSharp.Core
Added ConfigureAwait(false) to all async methods in TLSharp.Core
SendRequestAsync replaced to SendAuthenticatedRequestAsync in methods that need auth
Private modifier in SendAuthenticatedRequestAsync changed to internal
Based on PR created by @IaRuslan
Fix naming for models properties (Use JsonProperty instead)
Move models to separate folder
Rename models
Remove unused references in Program.cs
Use string instead of String
Added methods for working with usernames:
Check username (Validates a username and checks availability)
Update username (Changes username for the current user)
Now user can set directory to store sessions somewhere else
other than the folder where the program's executable is.
(Based on patch from Felony <onyfel@gmail.com> contributed
in https://github.com/sochix/TLSharp/pull/874 )
People are reporting that under some circumstances, an infinite
loop could happen when TLSharp tries to handle a reconnection to
a different DC, if the DC instructed to be used is the same as
the one that was used in the last connection.
Not sure how could this happen (although the analysis present in
this github issue [1] might help understand it), but this commit
helps to make TLSharp fail fast (with an exception) instead of an
infinite loop from now on, which will help avoiding people file
issues such as [2] and [3] and instead maybe file a proper bug
report easier to understand, to try to fix the underlying root
cause.
[1] https://github.com/sochix/TLSharp/issues/719
[2] https://github.com/sochix/TLSharp/issues/803
[3] https://github.com/sochix/TLSharp/issues/839