You've already forked lidgren-network-gen3
mirror of
https://github.com/lidgren/lidgren-network-gen3.git
synced 2026-05-18 16:16:35 +09:00
Lots of XML comments added; documentation rebuilt
This commit is contained in:
Binary file not shown.
@@ -54,6 +54,7 @@
|
|||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="NamespaceDoc.cs" />
|
||||||
<Compile Include="NetBitVector.cs" />
|
<Compile Include="NetBitVector.cs" />
|
||||||
<Compile Include="NetBitWriter.cs" />
|
<Compile Include="NetBitWriter.cs" />
|
||||||
<Compile Include="NetClient.cs" />
|
<Compile Include="NetClient.cs" />
|
||||||
|
|||||||
@@ -151,6 +151,9 @@ namespace Lidgren.Network
|
|||||||
m_numBitsSet = 0;
|
m_numBitsSet = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a string that represents this object
|
||||||
|
/// </summary>
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
StringBuilder bdr = new StringBuilder(m_capacity + 2);
|
StringBuilder bdr = new StringBuilder(m_capacity + 2);
|
||||||
|
|||||||
@@ -114,6 +114,9 @@ namespace Lidgren.Network
|
|||||||
return serverConnection.SendMessage(msg, method, sequenceChannel);
|
return serverConnection.SendMessage(msg, method, sequenceChannel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a string that represents this object
|
||||||
|
/// </summary>
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return "[NetClient " + ServerConnection + "]";
|
return "[NetClient " + ServerConnection + "]";
|
||||||
|
|||||||
@@ -343,6 +343,10 @@ namespace Lidgren.Network
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Disconnect from the remote peer
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="byeMessage">the message to send with the disconnect message</param>
|
||||||
public void Disconnect(string byeMessage)
|
public void Disconnect(string byeMessage)
|
||||||
{
|
{
|
||||||
// user or library thread
|
// user or library thread
|
||||||
|
|||||||
@@ -416,6 +416,9 @@ namespace Lidgren.Network
|
|||||||
ExecuteDisconnect(reason, true);
|
ExecuteDisconnect(reason, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a string that represents this object
|
||||||
|
/// </summary>
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return "[NetConnection to " + m_remoteEndpoint + "]";
|
return "[NetConnection to " + m_remoteEndpoint + "]";
|
||||||
|
|||||||
@@ -106,6 +106,9 @@ namespace Lidgren.Network
|
|||||||
m_resentMessages++;
|
m_resentMessages++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a string that represents this object
|
||||||
|
/// </summary>
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
StringBuilder bdr = new StringBuilder();
|
StringBuilder bdr = new StringBuilder();
|
||||||
|
|||||||
@@ -23,6 +23,9 @@ using System.Security;
|
|||||||
|
|
||||||
namespace Lidgren.Network
|
namespace Lidgren.Network
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Methods to encrypt and decrypt data using the XTEA algorith
|
||||||
|
/// </summary>
|
||||||
public sealed class NetXtea
|
public sealed class NetXtea
|
||||||
{
|
{
|
||||||
private const int m_blockSize = 8;
|
private const int m_blockSize = 8;
|
||||||
|
|||||||
@@ -111,6 +111,9 @@ namespace Lidgren.Network
|
|||||||
m_data = result;
|
m_data = result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a string that represents this object
|
||||||
|
/// </summary>
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return "[NetIncomingMessage #" + m_sequenceNumber + " " + this.LengthBytes + " bytes]";
|
return "[NetIncomingMessage #" + m_sequenceNumber + " " + this.LengthBytes + " bytes]";
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ namespace Lidgren.Network
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Reset()
|
internal void Reset()
|
||||||
{
|
{
|
||||||
m_messageType = NetMessageType.LibraryError;
|
m_messageType = NetMessageType.LibraryError;
|
||||||
m_bitLength = 0;
|
m_bitLength = 0;
|
||||||
@@ -114,6 +114,9 @@ namespace Lidgren.Network
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Encrypt this message using the XTEA algorithm; no more writing can be done before sending it
|
||||||
|
/// </summary>
|
||||||
public void Encrypt(NetXtea tea)
|
public void Encrypt(NetXtea tea)
|
||||||
{
|
{
|
||||||
// need blocks of 8 bytes
|
// need blocks of 8 bytes
|
||||||
@@ -130,6 +133,9 @@ namespace Lidgren.Network
|
|||||||
m_data = result;
|
m_data = result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a string that represents this object
|
||||||
|
/// </summary>
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return "[NetOutgoingMessage " + m_messageType + " " + this.LengthBytes + " bytes]";
|
return "[NetOutgoingMessage " + m_messageType + " " + this.LengthBytes + " bytes]";
|
||||||
|
|||||||
@@ -117,6 +117,9 @@ namespace Lidgren.Network
|
|||||||
m_receivedMessages += numMessages;
|
m_receivedMessages += numMessages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a string that represents this object
|
||||||
|
/// </summary>
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
StringBuilder bdr = new StringBuilder();
|
StringBuilder bdr = new StringBuilder();
|
||||||
|
|||||||
@@ -26,9 +26,24 @@ namespace Lidgren.Network
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public enum NetPeerStatus
|
public enum NetPeerStatus
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// NetPeer is not running; socket is not bound
|
||||||
|
/// </summary>
|
||||||
NotRunning = 0,
|
NotRunning = 0,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// NetPeer is in the process of starting up
|
||||||
|
/// </summary>
|
||||||
Starting = 1,
|
Starting = 1,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// NetPeer is bound to socket and listening for packets
|
||||||
|
/// </summary>
|
||||||
Running = 2,
|
Running = 2,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Shutdown has been requested and will be executed shortly
|
||||||
|
/// </summary>
|
||||||
ShutdownRequested = 3,
|
ShutdownRequested = 3,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ using System.Diagnostics;
|
|||||||
namespace Lidgren.Network
|
namespace Lidgren.Network
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Thread safe (blocking) queue with TryDequeue() and EnqueueFirst()
|
/// Thread safe (blocking) expanding queue with TryDequeue() and EnqueueFirst()
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DebuggerDisplay("Count={Count} Capacity={Capacity}")]
|
[DebuggerDisplay("Count={Count} Capacity={Capacity}")]
|
||||||
public sealed class NetQueue<T>
|
public sealed class NetQueue<T>
|
||||||
@@ -47,18 +47,22 @@ namespace Lidgren.Network
|
|||||||
private int m_size;
|
private int m_size;
|
||||||
private int m_head;
|
private int m_head;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the number of items in the queue
|
||||||
|
/// </summary>
|
||||||
public int Count { get { return m_size; } }
|
public int Count { get { return m_size; } }
|
||||||
|
|
||||||
public int Capacity { get { return m_items.Length; } }
|
public int Capacity { get { return m_items.Length; } }
|
||||||
|
|
||||||
public NetQueue(int initialCapacity)
|
public NetQueue(int initialCapacity)
|
||||||
{
|
{
|
||||||
|
System.Collections.Generic.Queue<int> a;
|
||||||
m_lock = new object();
|
m_lock = new object();
|
||||||
m_items = new T[initialCapacity];
|
m_items = new T[initialCapacity];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Places an item last/tail of the queue
|
/// Adds an item last/tail of the queue
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Enqueue(T item)
|
public void Enqueue(T item)
|
||||||
{
|
{
|
||||||
@@ -163,6 +167,9 @@ namespace Lidgren.Network
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determines whether an item is in the queue
|
||||||
|
/// </summary>
|
||||||
public bool Contains(T item)
|
public bool Contains(T item)
|
||||||
{
|
{
|
||||||
lock (m_lock)
|
lock (m_lock)
|
||||||
@@ -186,6 +193,9 @@ namespace Lidgren.Network
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Copies the queue items to a new array
|
||||||
|
/// </summary>
|
||||||
public T[] ToArray()
|
public T[] ToArray()
|
||||||
{
|
{
|
||||||
lock (m_lock)
|
lock (m_lock)
|
||||||
@@ -202,6 +212,9 @@ namespace Lidgren.Network
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Removes all objects from the queue
|
||||||
|
/// </summary>
|
||||||
public void Clear()
|
public void Clear()
|
||||||
{
|
{
|
||||||
lock (m_lock)
|
lock (m_lock)
|
||||||
|
|||||||
@@ -12,5 +12,13 @@ namespace Lidgren.Network
|
|||||||
{
|
{
|
||||||
config.AcceptIncomingConnections = true;
|
config.AcceptIncomingConnections = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a string that represents this object
|
||||||
|
/// </summary>
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return "[NetServer " + ConnectionsCount + " connections]";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,6 +46,9 @@ namespace Lidgren.Network
|
|||||||
public static double Now { get { return (double)Environment.TickCount / 1000.0; } }
|
public static double Now { get { return (double)Environment.TickCount / 1000.0; } }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Given seconds it will output a human friendly readable string (milliseconds if less than 60 seconds)
|
||||||
|
/// </summary>
|
||||||
public static string ToReadable(double seconds)
|
public static string ToReadable(double seconds)
|
||||||
{
|
{
|
||||||
if (seconds > 60)
|
if (seconds > 60)
|
||||||
|
|||||||
Reference in New Issue
Block a user