Skip to content

Commit c53b63b

Browse files
committed
Refactor
1 parent baea25e commit c53b63b

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

src/Namotion.Shelly/ShellyWebSocketClient.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
namespace Namotion.Shelly;
1111

12-
public class ShellyWebSocketClient : ReconnectingWebSocket
12+
internal class ShellyWebSocketClient : ReconnectingWebSocket
1313
{
1414
private readonly ShellyDevice _device;
1515
private readonly ILogger _logger;
@@ -43,9 +43,8 @@ protected override Task HandleMessageAsync(string json, CancellationToken stoppi
4343
return Task.CompletedTask;
4444
}
4545

46-
if (jsonObject is not null &&
47-
jsonObject["method"] is JsonNode methodProperty &&
48-
methodProperty.GetValue<string>() is string method)
46+
if (jsonObject["method"] is { } methodProperty &&
47+
methodProperty.GetValue<string>() is { } method)
4948
{
5049
_logger.LogTrace("WebSocket message received: {Method}", method);
5150
switch (method)
@@ -90,8 +89,7 @@ protected override Task HandleMessageAsync(string json, CancellationToken stoppi
9089

9190
_logger.LogTrace("Unknown WebSocket message received: {Method}", method);
9291
}
93-
else if (jsonObject is not null &&
94-
jsonObject["result"] is JsonNode resultProperty)
92+
else if (jsonObject["result"] is { } resultProperty)
9593
{
9694
if (resultProperty["em:0"] is JsonObject em0Object)
9795
{

0 commit comments

Comments
 (0)