Commit graph

280 commits

Author SHA1 Message Date
Andres G. Aragoneses b55084d50d nugetUpload: fix version creation
Somehow for the previous commit hash, which had only numbers in its
short version (0122072), nuget failed with:
Run $date = get-date -format "yyyyMMdd-HHmm"
Attempting to build package from 'TgSharp.Core.csproj'.
Error NU5010: Version string specified for package reference '0.1.0-date.20200414-0908.git.0122072' is invalid.
File does not exist (TgSharp.0.1.0-date.20200414-0908.git.0122072.nupkg).

Now we remove the "." after "date" and "git" and use double-dash
to separate initial version from the sub-version.
2020-04-14 18:32:07 +08:00
Andres G. Aragoneses 012207251b Generator: allow running generator from TeleSharp.TL/ folder
Bear with me, the part of the code that traverses the path with ".."
subfolders is actually not needed, but whatever, I had already written
it.
2020-04-14 16:55:34 +08:00
Andres G. Aragoneses a85f0d8e11 Generator: make it work with Unix paths
It was hardcoding the Windows path separator so this could only
run on Windows before.
2020-04-14 15:58:11 +08:00
Andres G. Aragoneses 56448c6410 README.md: prefer OfType<>() LINQ method, it's shorter
Based on dfc89dc3ab
2020-04-14 06:46:44 +08:00
Andres G. Aragoneses 6b9fc62634 README.md: fix code snippets indentation and other things 2020-04-14 06:44:38 +08:00
Andres G. Aragoneses 292d92e4a2 Core: TelegramClient class hardening, adding readonly keywords 2020-04-12 23:29:58 +08:00
Andres G. Aragoneses 4d09ac711d
Merge pull request #7 from nblockchain/allowReconnecting
Core: allow reconnecting same TelegramClient instance
2020-04-12 23:06:54 +08:00
Andres G. Aragoneses 10632fed22 Generator: default to a schema filename in line to online resource
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.
2020-04-12 23:00:44 +08:00
Andres G. Aragoneses 6ff40930c1 Core: don't expose "reconnect" optional param in public API
It was only meant to be used internally.
2020-04-12 02:29:42 +08:00
solarin 94775cebd8 Core: allow reconnecting same TelegramClient instance
Fixes https://github.com/sochix/TLSharp/issues/930
2020-04-12 02:14:54 +08:00
solarin 874cfd07a2 Core: don't consider MediaOnly DCs at reconnect
Fixes https://github.com/sochix/TLSharp/issues/935

(This commit was brought from TLSharp [1] version 0.1.0.554.)

[1] 9a6e391cae
2020-04-12 02:02:45 +08:00
Andres G. Aragoneses e5a6991612 README.md: expand on FLOOD_WAIT error
Thanks to some inspiration by this comment:
https://github.com/sochix/TLSharp/issues/474#issuecomment-611422648
2020-04-12 01:57:27 +08:00
Andres G. Aragoneses 1601e33c1e README.md: update Roadmap 2020-04-11 16:32:38 +08:00
solarin 6d99916bc6 Added an IPv4/IPv6 toggle to TelegramClient constructor
Fixes https://github.com/sochix/TLSharp/issues/857

(This commit was brought from TLSharp [1] version 0.1.0.532.)

[1] c67801a6c9
2020-04-06 15:29:43 +08:00
Afshin Arani f40474f9e9 Remove unnecessary dependencies
(This commit was brought from TLSharp [1] version 0.1.0.524.)

[1] 6d2c77f5ef
2020-04-05 20:23:44 +08:00
Afshin Arani 3bde55ed1e Upgrade from .NET4.5 to .NET4.6
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.

(This commit was brought from TLSharp [1] version 0.1.0.522.)

[1] 709e5be7cc
2020-04-05 20:03:16 +08:00
Andres G. Aragoneses a73028f44e nuspec: fix warning
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'

(This commit was brought from TLSharp [1] version 0.1.0.521.)

[1] 6b35857923
2020-04-05 14:54:58 +08:00
Andres G. Aragoneses f27d0257f7 Add GitLabCI Linux pipeline
This pipeline doesn't come with Mono out-of-the-box like the GH-Actions
one, so then we need to install mono ourselves (and there are 3
different ways to do it).
2020-04-04 19:45:21 +08:00
Andres G. Aragoneses 913a5befe5 README.md: fix CI badge
Otherwise if there's a PR whose build is failing, it would show
a red badge here (but we only care about master branch).

Spotted & fix by @aarani
2020-04-03 20:21:29 +08:00
Andres G. Aragoneses bb2e485b91 README.md: fix couple of typos 2020-04-03 20:20:53 +08:00
Andres G. Aragoneses c59eba9023 nugetUpload: honor git tags as versions 2020-04-03 17:35:34 +08:00
Andres G. Aragoneses ba0715ed5e nugetUpload: refactor versioning 2020-04-03 16:21:12 +08:00
Andres G. Aragoneses 8cf57f7f27 README.md: update 2020-04-03 12:29:15 +08:00
Afshin Arani 66942979ab Add GithubActions workflow for nugetUpload 2020-04-02 21:37:33 +08:00
Andres G. Aragoneses 932a733197
Finish TLSharp -> TgSharp rename (#1) 2020-04-02 16:37:22 +08:00
Andres G. Aragoneses a876314ddc Fork(rename): TLSharp -> TgSharp
Now @aarani takes over as main contributor and the possible
receiver of donations, since sochix hasn't contributed in a
long time.
2020-04-02 15:55:12 +08:00
Afshin Arani f8b35dab61
GithubActions Workflow for crossplatform CI (#921)
AppVeyor only has Windows support on the free tier
2020-04-02 15:10:27 +08:00
emRzed 43f16e879e
Fix InvalidCastException in TLRequestGetStickerSet (#905)
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
2020-02-03 14:57:57 +08:00
Andres G. Aragoneses 90f9305dd6 style: more consistent naming removing underscores
There were less places with underscores in field names than
places without them, so we now are consistent with the most
abundant occurrence.
2020-01-31 14:39:19 +08:00
Andres G. Aragoneses c031fa4f6d
Merge pull request #903 from CheshireCaat/pr-branch
Improvements for async methods
2020-01-28 15:12:26 +08:00
CheshireCaat c5a2c816fc Improvements for async methods
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
2020-01-28 10:10:49 +03:00
Andres G. Aragoneses 1ccafe22a3
Merge pull request #901 from CheshireCaat/pr-sub
Code refactoring
2020-01-27 13:34:43 +08:00
CheshireCaat bdbaf76481 DataCenter refactoring
Remove unused private setter for properties
2020-01-26 21:29:41 +03:00
CheshireCaat d42a367cf4 TeleSharp.Generator refactoring
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
2020-01-26 21:29:40 +03:00
CheshireCaat 79cf25d257 Reformat MTProto.Serializers
Fix naming for string serializer
Fix naming for bytes serializer
Remove unused method - VectorToString
2020-01-26 02:12:43 +03:00
Andres G. Aragoneses dc8c20df63 Core: avoid some code repetition 2020-01-25 16:16:14 +08:00
CheshireCaat 7230b9b509 Requests refactoring (#900)
* Remove unused requests.
* Move PingRequest and AckRequest to TLSharp.Core.Network.Requests.
2020-01-25 13:04:50 +08:00
CheshireCaat 8729b7d85b Exceptions moved to separate folders (#899)
Exceptions from MtProtoSender.cs to TLSharp.Core/Network/Exceptions
Exceptions from TelegramClient.cs to TLSharp.Core/Exceptions
2020-01-25 02:28:37 +08:00
CheshireCaat 0a91487ea7 Add methods for working with usernames. (#897)
Added methods for working with usernames:

Check username (Validates a username and checks availability)
Update username (Changes username for the current user)
2020-01-23 15:11:24 +08:00
CheshireCaat c9ac0bab87 Add methods for working with contacts. (#896)
Added methods for working with contacts:

* Import contact list
* Delete contact list
* Delete one contact
2020-01-23 12:02:19 +08:00
dependabot[bot] 3c6f53be68 Bump DotNetZip from 1.9.3 to 1.11.0 in /TLSharp.Core (#885)
Bumps [DotNetZip](https://github.com/haf/DotNetZip.Semverd) from 1.9.3 to 1.11.0.
- [Release notes](https://github.com/haf/DotNetZip.Semverd/releases)
- [Commits](https://github.com/haf/DotNetZip.Semverd/commits)

(Security vulnerabilities happening in older versions than 1.11.0: https://snyk.io/vuln/nuget:dotnetzip )

Signed-off-by: dependabot[bot] <support@github.com>
2019-10-30 10:31:26 +08:00
Andres G. Aragoneses e4d0e97571 Add ability to set directory to store sessions
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 )
2019-10-05 12:41:50 +08:00
Felony 8a15feea7c Add Session getter-only property to TelegramClient
Add Session readonly field which lets the developer read session
properties like current logged-in user's Username et-al.

https://github.com/sochix/TLSharp/pull/875
2019-10-05 10:23:14 +08:00
Felony 4a663d89b3 Fix typo in Receive method declaration 2019-10-02 22:02:54 +08:00
Felony 460ec6fb32 Free TCP network stream
- Use single TCP network stream fore read and write

- Cleanup TCP stream on disposing as microsoft note : https://docs.microsoft.com/en-us/dotnet/api/system.net.sockets.tcpclient.getstream?view=netframework-4.8
2019-10-02 22:02:54 +08:00
Nicholas Rodine 0dd3992997 Added .idea/ directory (for JetBrains Rider) to .gitignore 2019-07-24 17:30:29 +08:00
Mike 00330c9bd0 Fix Issue #862 (#863)
Fix connection with IPv4 address. A regression introduced in 3224113e4c.
2019-07-12 07:35:26 +08:00
Nicholas Rodine 3224113e4c Modified TcpClient setup to work with IPv6 addresses, fixing #773. 2019-06-28 13:25:35 +08:00
Andres G. Aragoneses 6ce4eceaca Core: fix typo in commented logging code 2019-02-10 13:54:04 +01:00
Andres G. Aragoneses 60a3c62357 Core: avoid possible infinite loop if switching to same DC
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
2019-02-10 13:53:46 +01:00