diff --git a/src/Client.cs b/src/Client.cs
index 144ef92..b353962 100644
--- a/src/Client.cs
+++ b/src/Client.cs
@@ -42,7 +42,7 @@ namespace WTelegram
/// Welcome to WTelegramClient! 😀
/// Config callback, is queried for: api_id, api_hash, session_pathname
/// Handler for Telegram updates messages that are not replies to RPC API calls
- public Client(Func configProvider = null, Func updateHandler = null)
+ public Client(Func configProvider = null, Func updateHandler = null)
{
_config = configProvider ?? DefaultConfigOrAsk;
_updateHandler = updateHandler;
@@ -291,7 +291,7 @@ namespace WTelegram
return payload;
}
- internal async Task RecvInternalAsync(CancellationToken ct)
+ internal async Task RecvAsync(CancellationToken ct)
{
var data = await RecvFrameAsync(ct);
if (data.Length == 4 && data[3] == 0xFF)
@@ -551,7 +551,7 @@ namespace WTelegram
{
while (!ct.IsCancellationRequested)
{
- var obj = await RecvInternalAsync(ct);
+ var obj = await RecvAsync(ct);
if (obj == null) continue; // ignored message :|
await HandleMessageAsync(obj);
}
@@ -613,7 +613,7 @@ namespace WTelegram
_ = Task.Run(() => tcs.SetException(new ApplicationException($"BadMsgNotification {badMsgNotification.error_code}")));
}
else if (_updateHandler != null)
- await _updateHandler?.Invoke(obj);
+ await _updateHandler.Invoke(obj);
}
break;
default:
@@ -627,7 +627,7 @@ namespace WTelegram
}
}
if (_updateHandler != null)
- await _updateHandler?.Invoke(obj);
+ await _updateHandler.Invoke(obj);
break;
}
@@ -637,7 +637,7 @@ namespace WTelegram
if (tcs != null)
_ = Task.Run(() => tcs.SetResult(result));
else if (_updateHandler != null)
- await _updateHandler?.Invoke(obj);
+ await _updateHandler.Invoke(obj);
}
}
@@ -719,7 +719,7 @@ namespace WTelegram
{
var waitUntil = DateTime.UtcNow.AddSeconds(3);
if (signUpRequired.terms_of_service != null && _updateHandler != null)
- await _updateHandler?.Invoke(signUpRequired.terms_of_service); // give caller the possibility to read and accept TOS
+ await _updateHandler.Invoke(signUpRequired.terms_of_service); // give caller the possibility to read and accept TOS
var first_name = Config("first_name");
var last_name = Config("last_name");
var wait = waitUntil - DateTime.UtcNow;
diff --git a/src/Compat.cs b/src/Compat.cs
index f249169..7710da9 100644
--- a/src/Compat.cs
+++ b/src/Compat.cs
@@ -87,3 +87,22 @@ namespace WTelegram
#endif
}
}
+
+#if NETSTANDARD2_0
+namespace System.Runtime.CompilerServices
+{
+ internal static class RuntimeHelpers
+ {
+ public static T[] GetSubArray(T[] array, Range range)
+ {
+ if (array == null) throw new ArgumentNullException();
+ var (offset, length) = range.GetOffsetAndLength(array.Length);
+ if (length == 0) return Array.Empty();
+ var dest = typeof(T).IsValueType || typeof(T[]) == array.GetType() ? new T[length]
+ : (T[])Array.CreateInstance(array.GetType().GetElementType()!, length);
+ Array.Copy(array, offset, dest, 0, length);
+ return dest;
+ }
+ }
+}
+#endif
\ No newline at end of file
diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj
index 0ec45d5..5eb4691 100644
--- a/src/WTelegramClient.csproj
+++ b/src/WTelegramClient.csproj
@@ -50,10 +50,6 @@
-
- all
- runtime; build; native; contentfiles; analyzers; buildtransitive
-