mirror of
https://github.com/Stone-Red-Code/HyperbolicDownloader.git
synced 2026-09-07 07:46:22 +02:00
Code cleanup
This commit is contained in:
@@ -3,32 +3,31 @@ using System.Net.Sockets;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace HyperbolicDownloaderApi
|
||||
namespace HyperbolicDownloaderApi.Networking;
|
||||
|
||||
internal class MessageRecivedEventArgs<T> : EventArgs
|
||||
{
|
||||
internal class MessageRecivedEventArgs<T> : EventArgs
|
||||
private readonly NetworkStream networkStream;
|
||||
|
||||
public MessageRecivedEventArgs(NetworkStream networkStream, IPAddress ipAddress, T data)
|
||||
{
|
||||
private readonly NetworkStream networkStream;
|
||||
this.networkStream = networkStream;
|
||||
Data = data;
|
||||
IpAddress = ipAddress;
|
||||
}
|
||||
|
||||
public MessageRecivedEventArgs(NetworkStream networkStream, IPAddress ipAddress, T data)
|
||||
{
|
||||
this.networkStream = networkStream;
|
||||
Data = data;
|
||||
IpAddress = ipAddress;
|
||||
}
|
||||
public T Data { get; set; }
|
||||
|
||||
public T Data { get; set; }
|
||||
public IPAddress IpAddress { get; set; }
|
||||
|
||||
public IPAddress IpAddress { get; set; }
|
||||
public async Task SendResponseAsync(object response)
|
||||
{
|
||||
byte[] bytesToSend = Encoding.ASCII.GetBytes(JsonSerializer.Serialize(response));
|
||||
await networkStream.WriteAsync(bytesToSend);
|
||||
}
|
||||
|
||||
public async Task SendResponseAsync(object response)
|
||||
{
|
||||
byte[] bytesToSend = Encoding.ASCII.GetBytes(JsonSerializer.Serialize(response));
|
||||
await networkStream.WriteAsync(bytesToSend);
|
||||
}
|
||||
|
||||
public void SendResponse(object response)
|
||||
{
|
||||
SendResponseAsync(response).GetAwaiter().GetResult();
|
||||
}
|
||||
public void SendResponse(object response)
|
||||
{
|
||||
SendResponseAsync(response).GetAwaiter().GetResult();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user