mirror of
https://github.com/wiz0u/WTelegramClient.git
synced 2025-12-06 06:52:01 +01:00
Fix warning: The predefined type "RuntimeHelpers" is defined in multiple assemblies
This commit is contained in:
parent
4174b21a83
commit
3701ba6f72
|
|
@ -291,7 +291,7 @@ namespace WTelegram
|
||||||
return payload;
|
return payload;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal async Task<ITLObject> RecvInternalAsync(CancellationToken ct)
|
internal async Task<ITLObject> RecvAsync(CancellationToken ct)
|
||||||
{
|
{
|
||||||
var data = await RecvFrameAsync(ct);
|
var data = await RecvFrameAsync(ct);
|
||||||
if (data.Length == 4 && data[3] == 0xFF)
|
if (data.Length == 4 && data[3] == 0xFF)
|
||||||
|
|
@ -551,7 +551,7 @@ namespace WTelegram
|
||||||
{
|
{
|
||||||
while (!ct.IsCancellationRequested)
|
while (!ct.IsCancellationRequested)
|
||||||
{
|
{
|
||||||
var obj = await RecvInternalAsync(ct);
|
var obj = await RecvAsync(ct);
|
||||||
if (obj == null) continue; // ignored message :|
|
if (obj == null) continue; // ignored message :|
|
||||||
await HandleMessageAsync(obj);
|
await HandleMessageAsync(obj);
|
||||||
}
|
}
|
||||||
|
|
@ -613,7 +613,7 @@ namespace WTelegram
|
||||||
_ = Task.Run(() => tcs.SetException(new ApplicationException($"BadMsgNotification {badMsgNotification.error_code}")));
|
_ = Task.Run(() => tcs.SetException(new ApplicationException($"BadMsgNotification {badMsgNotification.error_code}")));
|
||||||
}
|
}
|
||||||
else if (_updateHandler != null)
|
else if (_updateHandler != null)
|
||||||
await _updateHandler?.Invoke(obj);
|
await _updateHandler.Invoke(obj);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
@ -627,7 +627,7 @@ namespace WTelegram
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (_updateHandler != null)
|
if (_updateHandler != null)
|
||||||
await _updateHandler?.Invoke(obj);
|
await _updateHandler.Invoke(obj);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -637,7 +637,7 @@ namespace WTelegram
|
||||||
if (tcs != null)
|
if (tcs != null)
|
||||||
_ = Task.Run(() => tcs.SetResult(result));
|
_ = Task.Run(() => tcs.SetResult(result));
|
||||||
else if (_updateHandler != null)
|
else if (_updateHandler != null)
|
||||||
await _updateHandler?.Invoke(obj);
|
await _updateHandler.Invoke(obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -719,7 +719,7 @@ namespace WTelegram
|
||||||
{
|
{
|
||||||
var waitUntil = DateTime.UtcNow.AddSeconds(3);
|
var waitUntil = DateTime.UtcNow.AddSeconds(3);
|
||||||
if (signUpRequired.terms_of_service != null && _updateHandler != null)
|
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 first_name = Config("first_name");
|
||||||
var last_name = Config("last_name");
|
var last_name = Config("last_name");
|
||||||
var wait = waitUntil - DateTime.UtcNow;
|
var wait = waitUntil - DateTime.UtcNow;
|
||||||
|
|
|
||||||
|
|
@ -87,3 +87,22 @@ namespace WTelegram
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if NETSTANDARD2_0
|
||||||
|
namespace System.Runtime.CompilerServices
|
||||||
|
{
|
||||||
|
internal static class RuntimeHelpers
|
||||||
|
{
|
||||||
|
public static T[] GetSubArray<T>(T[] array, Range range)
|
||||||
|
{
|
||||||
|
if (array == null) throw new ArgumentNullException();
|
||||||
|
var (offset, length) = range.GetOffsetAndLength(array.Length);
|
||||||
|
if (length == 0) return Array.Empty<T>();
|
||||||
|
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
|
||||||
|
|
@ -50,10 +50,6 @@
|
||||||
<PackageReference Include="System.Formats.Asn1" Version="5.0.0" />
|
<PackageReference Include="System.Formats.Asn1" Version="5.0.0" />
|
||||||
<PackageReference Include="System.Memory" Version="4.5.4" />
|
<PackageReference Include="System.Memory" Version="4.5.4" />
|
||||||
<PackageReference Include="System.Text.Json" Version="5.0.2" />
|
<PackageReference Include="System.Text.Json" Version="5.0.2" />
|
||||||
<PackageReference Include="TA.System.Runtime.CompilerServices.RuntimeHelpers.GetSubArray" Version="1.0.1">
|
|
||||||
<PrivateAssets>all</PrivateAssets>
|
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
|
||||||
</PackageReference>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue