Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions NetSdrClientApp/Networking/TcpClientWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

public event EventHandler<byte[]>? MessageReceived;

public TcpClientWrapper(string host, int port)

Check warning on line 25 in NetSdrClientApp/Networking/TcpClientWrapper.cs

View workflow job for this annotation

GitHub Actions / Sonar Check

Non-nullable field '_cts' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the field as nullable.
{
_host = host;
_port = port;
Expand Down Expand Up @@ -60,7 +60,7 @@
_stream?.Close();
_tcpClient?.Close();

_cts = null;

Check warning on line 63 in NetSdrClientApp/Networking/TcpClientWrapper.cs

View workflow job for this annotation

GitHub Actions / Sonar Check

Cannot convert null literal to non-nullable reference type.
_tcpClient = null;
_stream = null;
Console.WriteLine("Disconnected.");
Expand All @@ -84,18 +84,10 @@
}
}

public async Task SendMessageAsync(string str)
public Task SendMessageAsync(string str)
{
var data = Encoding.UTF8.GetBytes(str);
if (Connected && _stream != null && _stream.CanWrite)
{
Console.WriteLine($"Message sent: " + data.Select(b => Convert.ToString(b, toBase: 16)).Aggregate((l, r) => $"{l} {r}"));
await _stream.WriteAsync(data, 0, data.Length);
}
else
{
throw new InvalidOperationException("Not connected to a server.");
}
return SendMessageAsync(data);
}

private async Task StartListeningAsync()
Expand All @@ -117,7 +109,7 @@
}
}
}
catch (OperationCanceledException ex)

Check warning on line 112 in NetSdrClientApp/Networking/TcpClientWrapper.cs

View workflow job for this annotation

GitHub Actions / Sonar Check

The variable 'ex' is declared but never used
{
//empty
}
Expand All @@ -136,5 +128,4 @@
}
}
}

}
}
11 changes: 1 addition & 10 deletions NetSdrClientApp/Networking/UdpClientWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
Console.WriteLine($"Received from {result.RemoteEndPoint}");
}
}
catch (OperationCanceledException ex)

Check warning on line 38 in NetSdrClientApp/Networking/UdpClientWrapper.cs

View workflow job for this annotation

GitHub Actions / Sonar Check

The variable 'ex' is declared but never used
{
//empty
}
Expand All @@ -61,16 +61,7 @@

public void Exit()
{
try
{
_cts?.Cancel();
_udpClient?.Close();
Console.WriteLine("Stopped listening for UDP messages.");
}
catch (Exception ex)
{
Console.WriteLine($"Error while stopping: {ex.Message}");
}
StopListening();
}

public override int GetHashCode()
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ https://github.com/friezze/ReengineeringCourse/commit/2534516c319a38d4aecd5d70a4
![alt text](image-3.png)
Може здатися дивним що їх стало більше але скоріше за все це тому що пофіксився білдер через зміни в які я лив в мейн і мерджив в гілку але сонар аналізував пуши в мейн а тік злиття. Але у будьякому випадку 8 фіксед.

# 3
До
![alt text](image-4.png)
Після



Цей репозиторій використовується для курсу **реінжиніринг ПЗ**.
Мета — провести комплексний реінжиніринг спадкового коду NetSdrClient, включаючи рефакторинг архітектури, покращення якості коду, впровадження сучасних практик розробки та автоматизацію процесів контролю якості через CI/CD пайплайни.
Expand Down
Binary file added image-5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image-6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading