You've already forked lidgren-network-gen3
mirror of
https://github.com/lidgren/lidgren-network-gen3.git
synced 2026-05-16 07:06:30 +09:00
NetIncomingMessage and NetOutgoingMessage now implements Stream as base class
This commit is contained in:
@@ -56,11 +56,13 @@
|
||||
<Compile Include="NetIncomingMessage.Peek.cs" />
|
||||
<Compile Include="NetIncomingMessage.Read.cs" />
|
||||
<Compile Include="NetIncomingMessage.Read.Reflection.cs" />
|
||||
<Compile Include="NetIncomingMessage.Stream.cs" />
|
||||
<Compile Include="NetIncomingMessage.Write.cs" />
|
||||
<Compile Include="NetIncomingMessageType.cs" />
|
||||
<Compile Include="NetMessageType.cs" />
|
||||
<Compile Include="NetNatIntroduction.cs" />
|
||||
<Compile Include="NetOutgoingMessage.cs" />
|
||||
<Compile Include="NetOutgoingMessage.Stream.cs" />
|
||||
<Compile Include="NetOutgoingMessage.Write.cs" />
|
||||
<Compile Include="NetOutgoingMessage.Write.Reflection.cs" />
|
||||
<Compile Include="NetPeer.ConnectionApproval.cs" />
|
||||
|
||||
@@ -537,7 +537,10 @@ namespace Lidgren.Network
|
||||
int offset = nr * info.FragmentSize;
|
||||
|
||||
if (im.m_data.Length < offset + payloadLength)
|
||||
Array.Resize<byte>(ref im.m_data, offset + payloadLength);
|
||||
{
|
||||
byte[] arr = im.m_data;
|
||||
Array.Resize<byte>(ref arr, offset + payloadLength);
|
||||
}
|
||||
|
||||
Buffer.BlockCopy(m_owner.m_receiveBuffer, ptr, im.m_data, offset, payloadLength);
|
||||
|
||||
|
||||
@@ -35,10 +35,10 @@ namespace Lidgren.Network
|
||||
/// <summary>
|
||||
/// Gets or sets the read position in the buffer, in bits (not bytes)
|
||||
/// </summary>
|
||||
public int Position
|
||||
public override long Position // override of Stream property
|
||||
{
|
||||
get { return m_readPosition; }
|
||||
set { m_readPosition = value; }
|
||||
get { return (long)m_readPosition; }
|
||||
set { m_readPosition = (int)value; }
|
||||
}
|
||||
|
||||
static NetIncomingMessage()
|
||||
|
||||
@@ -88,7 +88,12 @@ namespace Lidgren.Network
|
||||
m_bitLength += bits;
|
||||
}
|
||||
|
||||
internal void Write(byte[] source, int offsetInBytes, int numberOfBytes)
|
||||
public override void Write(byte[] source, int offsetInBytes, int numberOfBytes)
|
||||
{
|
||||
throw new NetException("NetIncomingMessage does not support writing!");
|
||||
}
|
||||
|
||||
internal void WriteBytes(byte[] source, int offsetInBytes, int numberOfBytes)
|
||||
{
|
||||
if (source == null)
|
||||
throw new ArgumentNullException("source");
|
||||
|
||||
@@ -160,7 +160,7 @@ namespace Lidgren.Network
|
||||
m_bitLength += bits;
|
||||
}
|
||||
|
||||
public void Write(byte[] source, int offsetInBytes, int numberOfBytes)
|
||||
public override void Write(byte[] source, int offsetInBytes, int numberOfBytes)
|
||||
{
|
||||
if (source == null)
|
||||
throw new ArgumentNullException("source");
|
||||
|
||||
Reference in New Issue
Block a user