some breaking changes, mostly style stuff

This commit is contained in:
Cassandra de la Cruz-Munoz 2023-08-17 14:19:26 -04:00
parent 3ff6e776ba
commit f5f3a5e527
4 changed files with 14 additions and 14 deletions

View File

@ -21,11 +21,11 @@ using System.Text.RegularExpressions;
namespace godotOscSharp namespace godotOscSharp
{ {
public class Address public class OscAddress
{ {
public string Pattern { get; } public string Pattern { get; }
public Address(string pattern) public OscAddress(string pattern)
{ {
if (string.IsNullOrEmpty(pattern)) if (string.IsNullOrEmpty(pattern))
{ {
@ -63,7 +63,7 @@ namespace godotOscSharp
return result.ToArray(); return result.ToArray();
} }
public static Address Parse(byte[] data, ref int index) public static OscAddress Parse(byte[] data, ref int index)
{ {
var start = index; var start = index;
while (data[index] != 0) while (data[index] != 0)
@ -74,7 +74,7 @@ namespace godotOscSharp
index++; index++;
var padding = 4 - ((index - start) % 4); var padding = 4 - ((index - start) % 4);
index += padding; index += padding;
return new Address(pattern); return new OscAddress(pattern);
} }
public override string ToString() public override string ToString()

View File

@ -26,16 +26,16 @@ namespace godotOscSharp
{ {
public class OscMessage public class OscMessage
{ {
public Address Address { get; } public OscAddress Address { get; }
public List<OscArgument> Data { get; } public List<OscArgument> Data { get; }
public OscMessage(Address address) public OscMessage(OscAddress address)
{ {
Address = address; Address = address;
} }
public OscMessage(Address address, List<OscArgument> data) public OscMessage(OscAddress address, List<OscArgument> data)
{ {
Address = address; Address = address;
Data = data; Data = data;
@ -44,7 +44,7 @@ namespace godotOscSharp
public static OscMessage Parse(byte[] data) public static OscMessage Parse(byte[] data)
{ {
var index = 0; var index = 0;
var address = Address.Parse(data, ref index); var address = OscAddress.Parse(data, ref index);
var start = index; var start = index;
while (data[index] != 0) while (data[index] != 0)
{ {

View File

@ -28,10 +28,10 @@ namespace godotOscSharp
public class OscReceiver : IDisposable public class OscReceiver : IDisposable
{ {
// The UDP client for receiving data // The UDP client for receiving data
private UdpClient udpClient; private readonly UdpClient udpClient;
// The thread for listening to incoming messages // The thread for listening to incoming messages
private Thread listenThread; private readonly Thread listenThread;
// The flag to indicate if the receiver is running // The flag to indicate if the receiver is running
private bool running; private bool running;

View File

@ -24,15 +24,15 @@ namespace godotOscSharp
{ {
public class OscSender : IDisposable public class OscSender : IDisposable
{ {
private UdpClient udpClient; private readonly UdpClient udpClient;
private IPAddress host; private readonly IPAddress host;
private int port; private readonly int port;
public OscSender(IPAddress host, int port) public OscSender(IPAddress host, int port)
{ {
udpClient = new UdpClient(0); udpClient = new UdpClient(port);
this.host = host; this.host = host;
this.port = port; this.port = port;
} }