diff --git a/README.md b/README.md index bb5847a..3983a5d 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [![Support Chat](https://img.shields.io/badge/Chat_with_us-on_Telegram-0088cc)](https://t.me/WTelegramClient) # WTelegramClient -### _Telegram client library written 100% in C# and .NET Core_ +### _Telegram client library written 100% in C# and .NET Standard_ ## How to use @@ -111,7 +111,7 @@ I've added several useful converters or implicit cast to various API object so t Beyond the TL async methods, the Client class offers a few other methods to simplify the sending of files, medias or messages. -For the moment, this library requires .NET 5.0 minimum. +This library works best with **.NET 5.0** and is also available for **.NET Standard 2.0** (.NET Framework 4.6.1 & .NET Core 2.0) # Development status The library is usable for most scenarios including (sequential or parallel) automated steps based on API requests/responses, or real-time monitoring of incoming Updates/messages. Secret chats have not been tested yet. @@ -128,4 +128,5 @@ Here are the main expected developments: - [x] Support MTProto 2.0 - [x] Support users with 2FA enabled - [x] Support main service messages +- [x] Support older .NET Core/Frameworks - [ ] Support secret chats end-to-end encryption & PFS diff --git a/src/Compat.cs b/src/Compat.cs index 23bdb6c..704ed4a 100644 --- a/src/Compat.cs +++ b/src/Compat.cs @@ -10,10 +10,8 @@ namespace WTelegram static class Compat { #if NETCOREAPP2_1_OR_GREATER - internal static IPEndPoint IPEndPoint_Parse(string addr) - => IPEndPoint.Parse(addr); - internal static BigInteger BigEndianInteger(byte[] value) - => new(value, true, true); + internal static IPEndPoint IPEndPoint_Parse(string addr) => IPEndPoint.Parse(addr); + internal static BigInteger BigEndianInteger(byte[] value) => new(value, true, true); #else internal static BigInteger BigEndianInteger(byte[] value) { diff --git a/src/Generator.cs b/src/Generator.cs index 850f100..ba0eb72 100644 --- a/src/Generator.cs +++ b/src/Generator.cs @@ -30,9 +30,9 @@ namespace WTelegram using var http = new HttpClient(); var html = await http.GetStringAsync("https://core.telegram.org/api/layers"); currentLayer = int.Parse(Regex.Match(html, @"#layer-(\d+)").Groups[1].Value); - await File.WriteAllBytesAsync("TL.MTProto.json", await http.GetByteArrayAsync("https://core.telegram.org/schema/mtproto-json")); - await File.WriteAllBytesAsync("TL.Schema.json", await http.GetByteArrayAsync("https://core.telegram.org/schema/json")); - await File.WriteAllBytesAsync("TL.Secret.json", await http.GetByteArrayAsync("https://core.telegram.org/schema/end-to-end-json")); + File.WriteAllBytes("TL.MTProto.json", await http.GetByteArrayAsync("https://core.telegram.org/schema/mtproto-json")); + File.WriteAllBytes("TL.Schema.json", await http.GetByteArrayAsync("https://core.telegram.org/schema/json")); + File.WriteAllBytes("TL.Secret.json", await http.GetByteArrayAsync("https://core.telegram.org/schema/end-to-end-json")); #endif FromJson("TL.MTProto.json", "TL.MTProto.cs", @"TL.Table.cs"); FromJson("TL.Schema.json", "TL.Schema.cs", @"TL.Table.cs");