Format the project with 'dotnet format' (#2551)

* Sync and Re-Format

* Fix Title string.

* Fix indentation.
This commit is contained in:
NaN
2023-02-13 14:45:59 -03:00
committed by GitHub
parent 71e9ecb21e
commit 257f246d1d
401 changed files with 3178 additions and 2671 deletions

View File

@@ -87,14 +87,17 @@ namespace Discord.Net.Udp
}
public async Task StopInternalAsync(bool isDisposing = false)
{
try { _stopCancelTokenSource.Cancel(false); } catch { }
try
{ _stopCancelTokenSource.Cancel(false); }
catch { }
if (!isDisposing)
await (_task ?? Task.Delay(0)).ConfigureAwait(false);
if (_udp != null)
{
try { _udp.Dispose(); }
try
{ _udp.Dispose(); }
catch { }
_udp = null;
}

View File

@@ -4,7 +4,7 @@ namespace Discord.Net.Udp
{
public static class DefaultUdpSocketProvider
{
public static readonly UdpSocketProvider Instance = () =>
public static readonly UdpSocketProvider Instance = () =>
{
try
{

View File

@@ -110,7 +110,8 @@ namespace Discord.Net.WebSockets
{
_isDisconnecting = true;
try { _disconnectTokenSource.Cancel(false); }
try
{ _disconnectTokenSource.Cancel(false); }
catch { }
if (_client != null)
@@ -118,10 +119,12 @@ namespace Discord.Net.WebSockets
if (!isDisposing)
{
var status = (WebSocketCloseStatus)closeCode;
try { await _client.CloseOutputAsync(status, "", new CancellationToken()); }
try
{ await _client.CloseOutputAsync(status, "", new CancellationToken()); }
catch { }
}
try { _client.Dispose(); }
try
{ _client.Dispose(); }
catch { }
_client = null;
@@ -176,7 +179,8 @@ namespace Discord.Net.WebSockets
}
try
{
if (_client == null) return;
if (_client == null)
return;
int frameCount = (int)Math.Ceiling((double)count / SendChunkSize);
@@ -223,7 +227,8 @@ namespace Discord.Net.WebSockets
stream.Write(buffer.Array, 0, socketResult.Count);
do
{
if (cancelToken.IsCancellationRequested) return;
if (cancelToken.IsCancellationRequested)
return;
socketResult = await _client.ReceiveAsync(buffer, cancelToken).ConfigureAwait(false);
stream.Write(buffer.Array, 0, socketResult.Count);
}