Browse Source

Rewording

Matt Coburn 5 years ago
parent
commit
b9bfbb9598
1 changed files with 62 additions and 62 deletions
  1. 62 62
      Source/Managed/ENet.cs

+ 62 - 62
Source/Managed/ENet.cs

@@ -327,7 +327,7 @@ namespace ENet
 		{
 		{
 			get
 			get
 			{
 			{
-				IsCreated();
+				ThrowIfNotCreated();
 
 
 				return Native.enet_packet_get_data(nativePacket);
 				return Native.enet_packet_get_data(nativePacket);
 			}
 			}
@@ -337,14 +337,14 @@ namespace ENet
 		{
 		{
 			get
 			get
 			{
 			{
-				IsCreated();
+				ThrowIfNotCreated();
 
 
 				return Native.enet_packet_get_user_data(nativePacket);
 				return Native.enet_packet_get_user_data(nativePacket);
 			}
 			}
 
 
 			set
 			set
 			{
 			{
-				IsCreated();
+				ThrowIfNotCreated();
 
 
 				Native.enet_packet_set_user_data(nativePacket, value);
 				Native.enet_packet_set_user_data(nativePacket, value);
 			}
 			}
@@ -354,7 +354,7 @@ namespace ENet
 		{
 		{
 			get
 			get
 			{
 			{
-				IsCreated();
+				ThrowIfNotCreated();
 
 
 				return Native.enet_packet_get_length(nativePacket);
 				return Native.enet_packet_get_length(nativePacket);
 			}
 			}
@@ -364,13 +364,13 @@ namespace ENet
 		{
 		{
 			get
 			get
 			{
 			{
-				IsCreated();
+				ThrowIfNotCreated();
 
 
 				return Native.enet_packet_check_references(nativePacket) != 0;
 				return Native.enet_packet_check_references(nativePacket) != 0;
 			}
 			}
 		}
 		}
 
 
-		internal void IsCreated()
+		internal void ThrowIfNotCreated()
 		{
 		{
 			if (nativePacket == IntPtr.Zero)
 			if (nativePacket == IntPtr.Zero)
 				throw new InvalidOperationException("Packet not created");
 				throw new InvalidOperationException("Packet not created");
@@ -378,14 +378,14 @@ namespace ENet
 
 
 		public void SetFreeCallback(IntPtr callback)
 		public void SetFreeCallback(IntPtr callback)
 		{
 		{
-			IsCreated();
+			ThrowIfNotCreated();
 
 
 			Native.enet_packet_set_free_callback(nativePacket, callback);
 			Native.enet_packet_set_free_callback(nativePacket, callback);
 		}
 		}
 
 
 		public void SetFreeCallback(PacketFreeCallback callback)
 		public void SetFreeCallback(PacketFreeCallback callback)
 		{
 		{
-			IsCreated();
+			ThrowIfNotCreated();
 
 
 			Native.enet_packet_set_free_callback(nativePacket, Marshal.GetFunctionPointerForDelegate(callback));
 			Native.enet_packet_set_free_callback(nativePacket, Marshal.GetFunctionPointerForDelegate(callback));
 		}
 		}
@@ -523,7 +523,7 @@ namespace ENet
 		{
 		{
 			get
 			get
 			{
 			{
-				IsCreated();
+				ThrowIfNotCreated();
 
 
 				return Native.enet_host_get_peers_count(nativeHost);
 				return Native.enet_host_get_peers_count(nativeHost);
 			}
 			}
@@ -533,7 +533,7 @@ namespace ENet
 		{
 		{
 			get
 			get
 			{
 			{
-				IsCreated();
+				ThrowIfNotCreated();
 
 
 				return Native.enet_host_get_packets_sent(nativeHost);
 				return Native.enet_host_get_packets_sent(nativeHost);
 			}
 			}
@@ -543,7 +543,7 @@ namespace ENet
 		{
 		{
 			get
 			get
 			{
 			{
-				IsCreated();
+				ThrowIfNotCreated();
 
 
 				return Native.enet_host_get_packets_received(nativeHost);
 				return Native.enet_host_get_packets_received(nativeHost);
 			}
 			}
@@ -553,7 +553,7 @@ namespace ENet
 		{
 		{
 			get
 			get
 			{
 			{
-				IsCreated();
+				ThrowIfNotCreated();
 
 
 				return Native.enet_host_get_bytes_sent(nativeHost);
 				return Native.enet_host_get_bytes_sent(nativeHost);
 			}
 			}
@@ -563,19 +563,19 @@ namespace ENet
 		{
 		{
 			get
 			get
 			{
 			{
-				IsCreated();
+				ThrowIfNotCreated();
 
 
 				return Native.enet_host_get_bytes_received(nativeHost);
 				return Native.enet_host_get_bytes_received(nativeHost);
 			}
 			}
 		}
 		}
 
 
-		internal void IsCreated()
+		internal void ThrowIfNotCreated()
 		{
 		{
 			if (nativeHost == IntPtr.Zero)
 			if (nativeHost == IntPtr.Zero)
 				throw new InvalidOperationException("Host not created");
 				throw new InvalidOperationException("Host not created");
 		}
 		}
 
 
-		private static void IsChannelsLimited(int channelLimit)
+		private static void ThrowIfChannelsExceeded(int channelLimit)
 		{
 		{
 			if (channelLimit < 0 || channelLimit > Library.maxChannelCount)
 			if (channelLimit < 0 || channelLimit > Library.maxChannelCount)
 				throw new ArgumentOutOfRangeException("channelLimit");
 				throw new ArgumentOutOfRangeException("channelLimit");
@@ -624,7 +624,7 @@ namespace ENet
 			if (peerLimit < 0 || peerLimit > Library.maxPeers)
 			if (peerLimit < 0 || peerLimit > Library.maxPeers)
 				throw new ArgumentOutOfRangeException("peerLimit");
 				throw new ArgumentOutOfRangeException("peerLimit");
 
 
-			IsChannelsLimited(channelLimit);
+			ThrowIfChannelsExceeded(channelLimit);
 
 
 			if (address != null)
 			if (address != null)
 			{
 			{
@@ -643,25 +643,25 @@ namespace ENet
 
 
 		public void PreventConnections(bool state)
 		public void PreventConnections(bool state)
 		{
 		{
-			IsCreated();
+			ThrowIfNotCreated();
 
 
 			Native.enet_host_prevent_connections(nativeHost, (byte)(state ? 1 : 0));
 			Native.enet_host_prevent_connections(nativeHost, (byte)(state ? 1 : 0));
 		}
 		}
 
 
 		public void Broadcast(byte channelID, ref Packet packet)
 		public void Broadcast(byte channelID, ref Packet packet)
 		{
 		{
-			IsCreated();
+			ThrowIfNotCreated();
 
 
-			packet.IsCreated();
+			packet.ThrowIfNotCreated();
 			Native.enet_host_broadcast(nativeHost, channelID, packet.NativeData);
 			Native.enet_host_broadcast(nativeHost, channelID, packet.NativeData);
 			packet.NativeData = IntPtr.Zero;
 			packet.NativeData = IntPtr.Zero;
 		}
 		}
 
 
 		public void Broadcast(byte channelID, ref Packet packet, Peer excludedPeer)
 		public void Broadcast(byte channelID, ref Packet packet, Peer excludedPeer)
 		{
 		{
-			IsCreated();
+			ThrowIfNotCreated();
 
 
-			packet.IsCreated();
+			packet.ThrowIfNotCreated();
 			Native.enet_host_broadcast_exclude(nativeHost, channelID, packet.NativeData, excludedPeer.NativeData);
 			Native.enet_host_broadcast_exclude(nativeHost, channelID, packet.NativeData, excludedPeer.NativeData);
 			packet.NativeData = IntPtr.Zero;
 			packet.NativeData = IntPtr.Zero;
 		}
 		}
@@ -671,9 +671,9 @@ namespace ENet
 			if (peers == null)
 			if (peers == null)
 				throw new ArgumentNullException("peers");
 				throw new ArgumentNullException("peers");
 
 
-			IsCreated();
+			ThrowIfNotCreated();
 
 
-			packet.IsCreated();
+			packet.ThrowIfNotCreated();
 
 
 			if (peers.Length > 0)
 			if (peers.Length > 0)
 			{
 			{
@@ -697,7 +697,7 @@ namespace ENet
 
 
 		public int CheckEvents(out Event @event)
 		public int CheckEvents(out Event @event)
 		{
 		{
-			IsCreated();
+			ThrowIfNotCreated();
 
 
 			ENetEvent nativeEvent;
 			ENetEvent nativeEvent;
 
 
@@ -727,8 +727,8 @@ namespace ENet
 
 
 		public Peer Connect(Address address, int channelLimit, uint data)
 		public Peer Connect(Address address, int channelLimit, uint data)
 		{
 		{
-			IsCreated();
-			IsChannelsLimited(channelLimit);
+			ThrowIfNotCreated();
+			ThrowIfChannelsExceeded(channelLimit);
 
 
 			var nativeAddress = address.NativeData;
 			var nativeAddress = address.NativeData;
 			var peer = new Peer(Native.enet_host_connect(nativeHost, ref nativeAddress, (IntPtr)channelLimit, data));
 			var peer = new Peer(Native.enet_host_connect(nativeHost, ref nativeAddress, (IntPtr)channelLimit, data));
@@ -744,7 +744,7 @@ namespace ENet
 			if (timeout < 0)
 			if (timeout < 0)
 				throw new ArgumentOutOfRangeException("timeout");
 				throw new ArgumentOutOfRangeException("timeout");
 
 
-			IsCreated();
+			ThrowIfNotCreated();
 
 
 			ENetEvent nativeEvent;
 			ENetEvent nativeEvent;
 
 
@@ -764,57 +764,57 @@ namespace ENet
 
 
 		public void SetBandwidthLimit(uint incomingBandwidth, uint outgoingBandwidth)
 		public void SetBandwidthLimit(uint incomingBandwidth, uint outgoingBandwidth)
 		{
 		{
-			IsCreated();
+			ThrowIfNotCreated();
 
 
 			Native.enet_host_bandwidth_limit(nativeHost, incomingBandwidth, outgoingBandwidth);
 			Native.enet_host_bandwidth_limit(nativeHost, incomingBandwidth, outgoingBandwidth);
 		}
 		}
 
 
 		public void SetChannelLimit(int channelLimit)
 		public void SetChannelLimit(int channelLimit)
 		{
 		{
-			IsCreated();
-			IsChannelsLimited(channelLimit);
+			ThrowIfNotCreated();
+			ThrowIfChannelsExceeded(channelLimit);
 
 
 			Native.enet_host_channel_limit(nativeHost, (IntPtr)channelLimit);
 			Native.enet_host_channel_limit(nativeHost, (IntPtr)channelLimit);
 		}
 		}
 
 
 		public void SetMaxDuplicatePeers(ushort number)
 		public void SetMaxDuplicatePeers(ushort number)
 		{
 		{
-			IsCreated();
+			ThrowIfNotCreated();
 
 
 			Native.enet_host_set_max_duplicate_peers(nativeHost, number);
 			Native.enet_host_set_max_duplicate_peers(nativeHost, number);
 		}
 		}
 
 
 		public void SetInterceptCallback(IntPtr callback)
 		public void SetInterceptCallback(IntPtr callback)
 		{
 		{
-			IsCreated();
+			ThrowIfNotCreated();
 
 
 			Native.enet_host_set_intercept_callback(nativeHost, callback);
 			Native.enet_host_set_intercept_callback(nativeHost, callback);
 		}
 		}
 
 
 		public void SetInterceptCallback(InterceptCallback callback)
 		public void SetInterceptCallback(InterceptCallback callback)
 		{
 		{
-			IsCreated();
+			ThrowIfNotCreated();
 
 
 			Native.enet_host_set_intercept_callback(nativeHost, Marshal.GetFunctionPointerForDelegate(callback));
 			Native.enet_host_set_intercept_callback(nativeHost, Marshal.GetFunctionPointerForDelegate(callback));
 		}
 		}
 
 
 		public void SetChecksumCallback(IntPtr callback)
 		public void SetChecksumCallback(IntPtr callback)
 		{
 		{
-			IsCreated();
+			ThrowIfNotCreated();
 
 
 			Native.enet_host_set_checksum_callback(nativeHost, callback);
 			Native.enet_host_set_checksum_callback(nativeHost, callback);
 		}
 		}
 
 
 		public void SetChecksumCallback(ChecksumCallback callback)
 		public void SetChecksumCallback(ChecksumCallback callback)
 		{
 		{
-			IsCreated();
+			ThrowIfNotCreated();
 
 
 			Native.enet_host_set_checksum_callback(nativeHost, Marshal.GetFunctionPointerForDelegate(callback));
 			Native.enet_host_set_checksum_callback(nativeHost, Marshal.GetFunctionPointerForDelegate(callback));
 		}
 		}
 
 
 		public void Flush()
 		public void Flush()
 		{
 		{
-			IsCreated();
+			ThrowIfNotCreated();
 
 
 			Native.enet_host_flush(nativeHost);
 			Native.enet_host_flush(nativeHost);
 		}
 		}
@@ -864,7 +864,7 @@ namespace ENet
 		{
 		{
 			get
 			get
 			{
 			{
-				IsCreated();
+				ThrowIfNotCreated();
 
 
 				byte[] ip = ArrayPool.GetByteBuffer();
 				byte[] ip = ArrayPool.GetByteBuffer();
 
 
@@ -879,7 +879,7 @@ namespace ENet
 		{
 		{
 			get
 			get
 			{
 			{
-				IsCreated();
+				ThrowIfNotCreated();
 
 
 				return Native.enet_peer_get_port(nativePeer);
 				return Native.enet_peer_get_port(nativePeer);
 			}
 			}
@@ -889,7 +889,7 @@ namespace ENet
 		{
 		{
 			get
 			get
 			{
 			{
-				IsCreated();
+				ThrowIfNotCreated();
 
 
 				return Native.enet_peer_get_mtu(nativePeer);
 				return Native.enet_peer_get_mtu(nativePeer);
 			}
 			}
@@ -907,7 +907,7 @@ namespace ENet
 		{
 		{
 			get
 			get
 			{
 			{
-				IsCreated();
+				ThrowIfNotCreated();
 
 
 				return Native.enet_peer_get_rtt(nativePeer);
 				return Native.enet_peer_get_rtt(nativePeer);
 			}
 			}
@@ -917,7 +917,7 @@ namespace ENet
 		{
 		{
 			get
 			get
 			{
 			{
-				IsCreated();
+				ThrowIfNotCreated();
 
 
 				return Native.enet_peer_get_last_rtt(nativePeer);
 				return Native.enet_peer_get_last_rtt(nativePeer);
 			}
 			}
@@ -927,7 +927,7 @@ namespace ENet
 		{
 		{
 			get
 			get
 			{
 			{
-				IsCreated();
+				ThrowIfNotCreated();
 
 
 				return Native.enet_peer_get_lastsendtime(nativePeer);
 				return Native.enet_peer_get_lastsendtime(nativePeer);
 			}
 			}
@@ -937,7 +937,7 @@ namespace ENet
 		{
 		{
 			get
 			get
 			{
 			{
-				IsCreated();
+				ThrowIfNotCreated();
 
 
 				return Native.enet_peer_get_lastreceivetime(nativePeer);
 				return Native.enet_peer_get_lastreceivetime(nativePeer);
 			}
 			}
@@ -947,7 +947,7 @@ namespace ENet
 		{
 		{
 			get
 			get
 			{
 			{
-				IsCreated();
+				ThrowIfNotCreated();
 
 
 				return Native.enet_peer_get_packets_sent(nativePeer);
 				return Native.enet_peer_get_packets_sent(nativePeer);
 			}
 			}
@@ -957,7 +957,7 @@ namespace ENet
 		{
 		{
 			get
 			get
 			{
 			{
-				IsCreated();
+				ThrowIfNotCreated();
 
 
 				return Native.enet_peer_get_packets_lost(nativePeer);
 				return Native.enet_peer_get_packets_lost(nativePeer);
 			}
 			}
@@ -967,7 +967,7 @@ namespace ENet
 		{
 		{
 			get
 			get
 			{
 			{
-				IsCreated();
+				ThrowIfNotCreated();
 
 
 				return Native.enet_peer_get_packets_throttle(nativePeer);
 				return Native.enet_peer_get_packets_throttle(nativePeer);
 			}
 			}
@@ -977,7 +977,7 @@ namespace ENet
 		{
 		{
 			get
 			get
 			{
 			{
-				IsCreated();
+				ThrowIfNotCreated();
 
 
 				return Native.enet_peer_get_bytes_sent(nativePeer);
 				return Native.enet_peer_get_bytes_sent(nativePeer);
 			}
 			}
@@ -987,7 +987,7 @@ namespace ENet
 		{
 		{
 			get
 			get
 			{
 			{
-				IsCreated();
+				ThrowIfNotCreated();
 
 
 				return Native.enet_peer_get_bytes_received(nativePeer);
 				return Native.enet_peer_get_bytes_received(nativePeer);
 			}
 			}
@@ -997,20 +997,20 @@ namespace ENet
 		{
 		{
 			get
 			get
 			{
 			{
-				IsCreated();
+				ThrowIfNotCreated();
 
 
 				return Native.enet_peer_get_data(nativePeer);
 				return Native.enet_peer_get_data(nativePeer);
 			}
 			}
 
 
 			set
 			set
 			{
 			{
-				IsCreated();
+				ThrowIfNotCreated();
 
 
 				Native.enet_peer_set_data(nativePeer, value);
 				Native.enet_peer_set_data(nativePeer, value);
 			}
 			}
 		}
 		}
 
 
-		internal void IsCreated()
+		internal void ThrowIfNotCreated()
 		{
 		{
 			if (nativePeer == IntPtr.Zero)
 			if (nativePeer == IntPtr.Zero)
 				throw new InvalidOperationException("Peer not created");
 				throw new InvalidOperationException("Peer not created");
@@ -1018,23 +1018,23 @@ namespace ENet
 
 
 		public void ConfigureThrottle(uint interval, uint acceleration, uint deceleration, uint threshold)
 		public void ConfigureThrottle(uint interval, uint acceleration, uint deceleration, uint threshold)
 		{
 		{
-			IsCreated();
+			ThrowIfNotCreated();
 
 
 			Native.enet_peer_throttle_configure(nativePeer, interval, acceleration, deceleration, threshold);
 			Native.enet_peer_throttle_configure(nativePeer, interval, acceleration, deceleration, threshold);
 		}
 		}
 
 
 		public int Send(byte channelID, ref Packet packet)
 		public int Send(byte channelID, ref Packet packet)
 		{
 		{
-			IsCreated();
+			ThrowIfNotCreated();
 
 
-			packet.IsCreated();
+			packet.ThrowIfNotCreated();
 
 
 			return Native.enet_peer_send(nativePeer, channelID, packet.NativeData);
 			return Native.enet_peer_send(nativePeer, channelID, packet.NativeData);
 		}
 		}
 
 
 		public bool Receive(out byte channelID, out Packet packet)
 		public bool Receive(out byte channelID, out Packet packet)
 		{
 		{
-			IsCreated();
+			ThrowIfNotCreated();
 
 
 			IntPtr nativePacket = Native.enet_peer_receive(nativePeer, out channelID);
 			IntPtr nativePacket = Native.enet_peer_receive(nativePeer, out channelID);
 
 
@@ -1052,49 +1052,49 @@ namespace ENet
 
 
 		public void Ping()
 		public void Ping()
 		{
 		{
-			IsCreated();
+			ThrowIfNotCreated();
 
 
 			Native.enet_peer_ping(nativePeer);
 			Native.enet_peer_ping(nativePeer);
 		}
 		}
 
 
 		public void PingInterval(uint interval)
 		public void PingInterval(uint interval)
 		{
 		{
-			IsCreated();
+			ThrowIfNotCreated();
 
 
 			Native.enet_peer_ping_interval(nativePeer, interval);
 			Native.enet_peer_ping_interval(nativePeer, interval);
 		}
 		}
 
 
 		public void Timeout(uint timeoutLimit, uint timeoutMinimum, uint timeoutMaximum)
 		public void Timeout(uint timeoutLimit, uint timeoutMinimum, uint timeoutMaximum)
 		{
 		{
-			IsCreated();
+			ThrowIfNotCreated();
 
 
 			Native.enet_peer_timeout(nativePeer, timeoutLimit, timeoutMinimum, timeoutMaximum);
 			Native.enet_peer_timeout(nativePeer, timeoutLimit, timeoutMinimum, timeoutMaximum);
 		}
 		}
 
 
 		public void Disconnect(uint data)
 		public void Disconnect(uint data)
 		{
 		{
-			IsCreated();
+			ThrowIfNotCreated();
 
 
 			Native.enet_peer_disconnect(nativePeer, data);
 			Native.enet_peer_disconnect(nativePeer, data);
 		}
 		}
 
 
 		public void DisconnectNow(uint data)
 		public void DisconnectNow(uint data)
 		{
 		{
-			IsCreated();
+			ThrowIfNotCreated();
 
 
 			Native.enet_peer_disconnect_now(nativePeer, data);
 			Native.enet_peer_disconnect_now(nativePeer, data);
 		}
 		}
 
 
 		public void DisconnectLater(uint data)
 		public void DisconnectLater(uint data)
 		{
 		{
-			IsCreated();
+			ThrowIfNotCreated();
 
 
 			Native.enet_peer_disconnect_later(nativePeer, data);
 			Native.enet_peer_disconnect_later(nativePeer, data);
 		}
 		}
 
 
 		public void Reset()
 		public void Reset()
 		{
 		{
-			IsCreated();
+			ThrowIfNotCreated();
 
 
 			Native.enet_peer_reset(nativePeer);
 			Native.enet_peer_reset(nativePeer);
 		}
 		}