diff --git a/README.md b/README.md
index 45145c4..db4a8fa 100644
--- a/README.md
+++ b/README.md
@@ -1,9 +1,86 @@
TLSharp
-------------------------------
-_Unofficial_ Telegram (http://telegram.org) client library implemented in C#. Please refer to (https://github.com/sochix/TLSharp) for the original version and further documentation.
+
+[](https://gitter.im/TLSharp/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
+[](https://ci.appveyor.com/project/sochix/tlsharp)
+[](https://badge.fury.io/nu/TLSharp)
+
-# Sample code
+_Unofficial_ Telegram (http://telegram.org) client library implemented in C#. Latest TL scheme supported, thanks to Afshin Arani
+
+It's a perfect fit for any developer who would like to send data directly to Telegram users or write own custom Telegram client.
+
+:star2: If you :heart: library, please star it! :star2:
+
+# News
+* **JavaScript Telegram Client**
+
+ Hi everyone! I want to create JavaScript client for Telegram, it will have next features:
+
+ * send & receieve messages from users/groups/channels
+ * easy installation with npm or yarn
+ * latest Telegram Schema
+ * examples and documentation
+
+ If you like this idea, please leave your email [here](http://eepurl.com/cBXX8n).
+
+* **TLSharp GUI**
+
+ If you have difficulties with console or writing code, you can try [Telegram Tools](https://github.com/sochix/telegram-tools). It's a GUI for TLSharp.
+
+# Table of contents
+
+- [How do I add this to my project?](#how-do-i-add-this-to-my-project)
+- [Dependencies](#dependencies)
+- [Starter Guide](#starter-guide)
+ - [Quick configuration](#quick-configuration)
+ - [First requests](#first-requests)
+ - [Working with files](#working-with-files)
+- [Available Methods](#available-methods)
+- [Contributing](#contributing)
+- [FAQ](#faq)
+- [Donations](#donations)
+- [License](#license)
+
+# How do I add this to my project?
+
+Install via NuGet
+
+```
+ > Install-Package TLSharp
+```
+
+or build from source
+
+1. Clone TLSharp from GitHub
+1. Compile source with VS2015 or MonoDevelop
+1. Add reference to ```TLSharp.Core.dll``` to your awesome project.
+
+# Dependencies
+
+TLSharp has a few dependenices, most of functionality implemented from scratch.
+All dependencies listed in [package.conf file](https://github.com/sochix/TLSharp/blob/master/TLSharp.Core/packages.config).
+
+# Starter Guide
+
+## Quick Configuration
+Telegram API isn't that easy to start. You need to do some configuration first.
+
+1. Create a [developer account](https://my.telegram.org/) in Telegram.
+1. Goto [API development tools](https://my.telegram.org/apps) and copy **API_ID** and **API_HASH** from your account. You'll need it later.
+
+## First requests
+To start work, create an instance of TelegramClient and establish connection
+
+```csharp
+ var client = new TelegramClient(apiId, apiHash);
+ await client.ConnectAsync();
+```
+Now you can work with Telegram API, but ->
+> Only a small portion of the API methods are available to unauthorized users. ([full description](https://core.telegram.org/api/auth))
+
+For authentication you need to run following code
```csharp
using System;
using System.Threading.Tasks;
@@ -72,7 +149,7 @@ namespace TLSharpPOC
}
- var dialogs = (TLDialogs) await client.GetUserDialogsAsync();
+ var dialogs = await client.GetUserDialogsSliceAsync();
Console.WriteLine("Channels: ");
foreach (var channelObj in dialogs.Chats.OfType())
{
@@ -163,7 +240,7 @@ namespace TLSharpPOC
// -- Wait in a loop to handle incoming updates. No need to poll.
for (;;)
{
- await client.WaitEventAsync();
+ await client.WaitEventAsync(1000);
}
}
catch (Exception e)
@@ -254,6 +331,85 @@ namespace TLSharpPOC
```
+**What if you can't find needed method at the list?**
+
+Don't panic. You can call any method with help of `SendRequestAsync` function. For example, send user typing method:
+
+```csharp
+
+ //Create request
+ var req = new TLRequestSetTyping()
+ {
+ action = new TLSendMessageTypingAction(),
+ peer = peer
+ };
+
+ //run request, and deserialize response to Boolean
+ return await SendRequestAsync(req);
+```
+
+**Where you can find a list of requests and its params?**
+
+The only way is [Telegram API docs](https://core.telegram.org/methods). Yes, it's outdated. But there is no other source.
+Latest scheme in JSON format you can find [here](https://gist.github.com/aarani/b22b7cda024973dff68e1672794b0298)
+
+# Contributing
+
+Contributing is highly appreciated! Donations required
+
+## What things can I Implement (Project Roadmap)?
+
+### Release 1.0.0
+
+* [DONE] Add PHONE_MIGRATE handling
+* [DONE] Add FILE_MIGRATE handling
+* Add Updates handling
+* [DONE] Add NuGet package
+* [DONE] Add wrappers for media uploading and downloading
+* Store user session as JSON
+
+# FAQ
+
+#### What API layer is supported?
+The latest one - 66. Thanks to Afshin Arani for his TLGenerator
+
+#### I get a xxxMigrationException or a MIGRATE_X error!
+
+TLSharp library should automatically handle these errors. If you see such errors, please open a new Github issue with the details (include a stacktrace, etc.).
+
+#### I get an exception: System.IO.EndOfStreamException: Unable to read beyond the end of the stream. All test methos except that AuthenticationWorks and TestConnection return same error. I did every thing including setting api id and hash, and setting server address.-
+
+You should create a Telegram session. See [configuration guide](#sending-messages-set-up)
+
+#### Why do I get a FloodException/FLOOD_WAIT error?
+It's likely [Telegram restrictions](https://core.telegram.org/api/errors#420-flood), or a bug in TLSharp (if you feel it's the latter, please open a Github issue). You can know the time to wait by accessing the FloodException::TimeToWait property.
+
+#### Why does TLSharp lacks feature XXXX?
+
+Now TLSharp is basic realization of Telegram protocol, you can be a contributor or a sponsor to speed-up developemnt of any feature.
+
+#### Nothing helps
+Ask your question at gitter or create an issue in project bug tracker.
+
+**Attach following information**:
+
+* Full problem description and exception message
+* Stack-trace
+* Your code that runs in to this exception
+
+Without information listen above your issue will be closed.
+
+# Donations
+Thanks for donations! It's highly appreciated.
+
+
+List of donators:
+* [mtbitcoin](https://github.com/mtbitcoin)
+
+# Contributors
+* [Afshin Arani](http://aarani.ir) - TLGenerator, and a lot of other usefull things
+* [Knocte](https://github.com/knocte)
+
# License
**Please, provide link to an author when you using library**
diff --git a/TLSharp.Core/TelegramClient.cs b/TLSharp.Core/TelegramClient.cs
index 91fd283..abb9f45 100644
--- a/TLSharp.Core/TelegramClient.cs
+++ b/TLSharp.Core/TelegramClient.cs
@@ -329,6 +329,13 @@ public async Task GetUserDialogsAsync()
var peer = new TLInputPeerSelf();
return await SendRequestAsync(
new TLRequestGetDialogs() { OffsetDate = 0, OffsetPeer = peer, Limit = 100 });
+ }
+
+ public async Task GetUserDialogsSliceAsync()
+ {
+ var peer = new TLInputPeerSelf();
+ return await SendRequestAsync(
+ new TLRequestGetDialogs() { OffsetDate = 0, OffsetPeer = peer, Limit = 100 });
}
public async Task SendUploadedPhoto(TLAbsInputPeer peer, TLAbsInputFile file, string caption)
diff --git a/TLSharp.Core/packages.config b/TLSharp.Core/packages.config
index 518c7dc..4c898f4 100644
--- a/TLSharp.Core/packages.config
+++ b/TLSharp.Core/packages.config
@@ -1,5 +1,5 @@
-
+
\ No newline at end of file
diff --git a/TLSharp.sln b/TLSharp.sln
index 4f55f1b..699425b 100644
--- a/TLSharp.sln
+++ b/TLSharp.sln
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
-VisualStudioVersion = 14.0.24720.0
+VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TLSharp.Core", "TLSharp.Core\TLSharp.Core.csproj", "{400D2544-1CC6-4D8A-A62C-2292D9947A16}"
EndProject
@@ -15,6 +15,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TLSharp.Tests.VS", "TLSharp
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TLSharp.Tests.NUnit", "TLSharp.Tests.NUnit\TLSharp.Tests.NUnit.csproj", "{E90B705B-19FA-43BA-B952-69957976D12C}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Marjani.TLSharp.Sample", "Marjani.TLSharp.Sample\Marjani.TLSharp.Sample.csproj", "{12B33A23-9EAA-4A6F-A9DC-9D66CEB1C00C}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -45,6 +47,13 @@ Global
{E90B705B-19FA-43BA-B952-69957976D12C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E90B705B-19FA-43BA-B952-69957976D12C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E90B705B-19FA-43BA-B952-69957976D12C}.Release|Any CPU.Build.0 = Release|Any CPU
+ {12B33A23-9EAA-4A6F-A9DC-9D66CEB1C00C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {12B33A23-9EAA-4A6F-A9DC-9D66CEB1C00C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {12B33A23-9EAA-4A6F-A9DC-9D66CEB1C00C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {12B33A23-9EAA-4A6F-A9DC-9D66CEB1C00C}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
Policies = $0
@@ -81,7 +90,4 @@ Global
$2.inheritsScope = text/x-csharp
$2.scope = text/x-csharp
EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
EndGlobal