diff --git a/Lidgren.Network/NetBitWriter.cs b/Lidgren.Network/NetBitWriter.cs index 2d3ecb7..08ffe25 100644 --- a/Lidgren.Network/NetBitWriter.cs +++ b/Lidgren.Network/NetBitWriter.cs @@ -171,6 +171,9 @@ namespace Lidgren.Network return; } + /// + /// Reads an unsigned 16 bit integer + /// [CLSCompliant(false)] #if UNSAFE public static unsafe ushort ReadUInt16(byte[] fromBuffer, int numberOfBits, int readBitOffset) @@ -283,6 +286,9 @@ namespace Lidgren.Network //[CLSCompliant(false)] //public static ulong ReadUInt64(byte[] fromBuffer, int numberOfBits, int readBitOffset) + /// + /// Writes un unsigned 16 bit integer + /// [CLSCompliant(false)] public static int WriteUInt16(ushort source, int numberOfBits, byte[] destination, int destinationBitOffset) { diff --git a/Lidgren.Network/NetBuffer.Write.cs b/Lidgren.Network/NetBuffer.Write.cs index eccbf4f..b611a20 100644 --- a/Lidgren.Network/NetBuffer.Write.cs +++ b/Lidgren.Network/NetBuffer.Write.cs @@ -27,12 +27,21 @@ using System.Runtime.InteropServices; namespace Lidgren.Network { + /// + /// Utility struct for writing Singles + /// [StructLayout(LayoutKind.Explicit)] public struct SingleUIntUnion { + /// + /// Value as a 32 bit float + /// [FieldOffset(0)] public float SingleValue; + /// + /// Value as an unsigned 32 bit integer + /// [FieldOffset(0)] [CLSCompliant(false)] public uint UIntValue; diff --git a/Lidgren.Network/NetBuffer.cs b/Lidgren.Network/NetBuffer.cs index e114ecb..b0582b6 100644 --- a/Lidgren.Network/NetBuffer.cs +++ b/Lidgren.Network/NetBuffer.cs @@ -6,6 +6,9 @@ namespace Lidgren.Network { public partial class NetBuffer { + /// + /// Number of bytes to overallocate for each message to avoid resizing + /// protected const int c_overAllocateAmount = 4; private static readonly Dictionary s_readMethods; diff --git a/Lidgren.Network/NetPeerConfiguration.cs b/Lidgren.Network/NetPeerConfiguration.cs index 794c406..3ff2dd8 100644 --- a/Lidgren.Network/NetPeerConfiguration.cs +++ b/Lidgren.Network/NetPeerConfiguration.cs @@ -33,7 +33,7 @@ namespace Lidgren.Network private readonly string m_appIdentifier; private string m_networkThreadName; private IPAddress m_localAddress; - private IPAddress m_broadcastAddress; + private IPAddress m_broadcastAddress; internal bool m_acceptIncomingConnections; internal int m_maximumConnections; internal int m_defaultOutgoingMessageCapacity; @@ -77,7 +77,7 @@ namespace Lidgren.Network m_disabledTypes = NetIncomingMessageType.ConnectionApproval | NetIncomingMessageType.UnconnectedData | NetIncomingMessageType.VerboseDebugMessage | NetIncomingMessageType.ConnectionLatencyUpdated; m_networkThreadName = "Lidgren network thread"; m_localAddress = IPAddress.Any; - m_broadcastAddress = IPAddress.Broadcast; + m_broadcastAddress = IPAddress.Broadcast; var ip = NetUtility.GetBroadcastAddress(); if (ip != null) { @@ -292,16 +292,19 @@ namespace Lidgren.Network } } - public IPAddress BroadcastAddress - { - get { return m_broadcastAddress; } - set - { - if (m_isLocked) - throw new NetException(c_isLockedMessage); - m_broadcastAddress = value; - } - } + /// + /// Gets or sets the local broadcast address to use when broadcasting + /// + public IPAddress BroadcastAddress + { + get { return m_broadcastAddress; } + set + { + if (m_isLocked) + throw new NetException(c_isLockedMessage); + m_broadcastAddress = value; + } + } /// /// Gets or sets the local port to bind to. Defaults to 0. Cannot be changed once NetPeer is initialized. diff --git a/Lidgren.Network/NetUtility.cs b/Lidgren.Network/NetUtility.cs index 568b93c..b025d51 100644 --- a/Lidgren.Network/NetUtility.cs +++ b/Lidgren.Network/NetUtility.cs @@ -35,7 +35,14 @@ namespace Lidgren.Network /// public static class NetUtility { + /// + /// Resolve endpoint callback + /// public delegate void ResolveEndPointCallback(IPEndPoint endPoint); + + /// + /// Resolve address callback + /// public delegate void ResolveAddressCallback(IPAddress adr); /// @@ -260,6 +267,9 @@ namespace Lidgren.Network return new string(c); } + /// + /// Gets the local broadcast address + /// public static IPAddress GetBroadcastAddress() { #if __ANDROID__ @@ -560,6 +570,9 @@ namespace Lidgren.Network return NetDeliveryMethod.Unreliable; } + /// + /// Creates a comma delimited string from a lite of items + /// public static string MakeCommaDelimitedList(IList list) { var cnt = list.Count;