From f5f3a5e5273173bcc02a2b1be76851f01ccb88bd Mon Sep 17 00:00:00 2001 From: Cassandra de la Cruz-Munoz Date: Thu, 17 Aug 2023 14:19:26 -0400 Subject: [PATCH] some breaking changes, mostly style stuff --- OscAddress.cs | 8 ++++---- OscMessage.cs | 8 ++++---- OscReceiver.cs | 4 ++-- OscSender.cs | 8 ++++---- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/OscAddress.cs b/OscAddress.cs index 81952ab..64f4086 100644 --- a/OscAddress.cs +++ b/OscAddress.cs @@ -21,11 +21,11 @@ using System.Text.RegularExpressions; namespace godotOscSharp { - public class Address + public class OscAddress { public string Pattern { get; } - public Address(string pattern) + public OscAddress(string pattern) { if (string.IsNullOrEmpty(pattern)) { @@ -63,7 +63,7 @@ namespace godotOscSharp return result.ToArray(); } - public static Address Parse(byte[] data, ref int index) + public static OscAddress Parse(byte[] data, ref int index) { var start = index; while (data[index] != 0) @@ -74,7 +74,7 @@ namespace godotOscSharp index++; var padding = 4 - ((index - start) % 4); index += padding; - return new Address(pattern); + return new OscAddress(pattern); } public override string ToString() diff --git a/OscMessage.cs b/OscMessage.cs index b92ad3a..2ee73c2 100644 --- a/OscMessage.cs +++ b/OscMessage.cs @@ -26,16 +26,16 @@ namespace godotOscSharp { public class OscMessage { - public Address Address { get; } + public OscAddress Address { get; } public List Data { get; } - public OscMessage(Address address) + public OscMessage(OscAddress address) { Address = address; } - public OscMessage(Address address, List data) + public OscMessage(OscAddress address, List data) { Address = address; Data = data; @@ -44,7 +44,7 @@ namespace godotOscSharp public static OscMessage Parse(byte[] data) { var index = 0; - var address = Address.Parse(data, ref index); + var address = OscAddress.Parse(data, ref index); var start = index; while (data[index] != 0) { diff --git a/OscReceiver.cs b/OscReceiver.cs index e7bc79f..8a6c134 100644 --- a/OscReceiver.cs +++ b/OscReceiver.cs @@ -28,10 +28,10 @@ namespace godotOscSharp public class OscReceiver : IDisposable { // The UDP client for receiving data - private UdpClient udpClient; + private readonly UdpClient udpClient; // The thread for listening to incoming messages - private Thread listenThread; + private readonly Thread listenThread; // The flag to indicate if the receiver is running private bool running; diff --git a/OscSender.cs b/OscSender.cs index 78639f0..d870adc 100644 --- a/OscSender.cs +++ b/OscSender.cs @@ -24,15 +24,15 @@ namespace godotOscSharp { 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) { - udpClient = new UdpClient(0); + udpClient = new UdpClient(port); this.host = host; this.port = port; }