fix warnings/suggests
Some checks are pending
Dev build / build (push) Waiting to run

This commit is contained in:
Wizou 2026-02-03 02:34:33 +01:00
parent 0c5f589c54
commit c60c9cb7af
5 changed files with 7 additions and 5 deletions

View file

@ -3,7 +3,7 @@
[![NuGet prerelease](https://img.shields.io/nuget/vpre/WTelegramClient?color=C09030&label=dev+nuget)](https://www.nuget.org/packages/WTelegramClient/absoluteLatest)
[![Donate](https://img.shields.io/badge/Help_this_project:-Donate-ff4444)](https://buymeacoffee.com/wizou)
## *_Telegram Client API library written 100% in C# and .NET_*
## *Telegram Client API library written 100% in C# and .NET*
This library allows you to connect to Telegram and control a user programmatically (or a bot, but [WTelegramBot](https://www.nuget.org/packages/WTelegramBot) is much easier for that).
All the Telegram Client APIs (MTProto) are supported so you can do everything the user could do with a full Telegram GUI client.

View file

@ -899,8 +899,8 @@ namespace WTelegram
var mc = await this.Channels_GetChannels(new InputChannel(chatId, 0));
if (!mc.chats.TryGetValue(chatId, out chat))
throw new WTException($"Channel {chatId} not found");
else if (chats != null)
chats[chatId] = chat;
else
chats?[chatId] = chat;
}
}
else

View file

@ -391,7 +391,9 @@ namespace WTelegram
_reactorReconnects = 0;
if (_reactorReconnects == 0)
throw;
#pragma warning disable CA2016
await Task.Delay(5000);
#pragma warning restore CA2016
if (_networkStream == null) return; // Dispose has been called in-between
await ConnectAsync(); // start a new reactor after 5 secs
lock (_pendingRpcs) // retry all pending requests

View file

@ -75,7 +75,7 @@ namespace WTelegram
static class Convert
{
internal static string ToHexString(byte[] data) => BitConverter.ToString(data).Replace("-", "");
internal static byte[] FromHexString(string hex) => Enumerable.Range(0, hex.Length / 2).Select(i => System.Convert.ToByte(hex.Substring(i * 2, 2), 16)).ToArray();
internal static byte[] FromHexString(string hex) => [.. Enumerable.Range(0, hex.Length / 2).Select(i => System.Convert.ToByte(hex.Substring(i * 2, 2), 16))];
}
public class RandomNumberGenerator
{

View file

@ -28,7 +28,7 @@ $(ReleaseNotes)</Description>
<PackageTags>Telegram;MTProto;Client;Api;UserBot</PackageTags>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageReleaseNotes>$(ReleaseNotes)</PackageReleaseNotes>
<NoWarn>NETSDK1138;CS0419;CS1573;CS1591</NoWarn>
<NoWarn>NETSDK1138;CS0419;CS1573;CS1591;CA1850</NoWarn>
<DefineConstants>TRACE;OBFUSCATION;MTPG</DefineConstants>
<!--<IsAotCompatible Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net7.0'))">true</IsAotCompatible>-->
</PropertyGroup>