1
0
mirror of https://github.com/lidgren/lidgren-network-gen3.git synced 2026-05-15 22:56:30 +09:00

Added NetBuffer.WriteAt()

This commit is contained in:
lidgren
2014-01-13 08:02:34 +00:00
parent e844bb1918
commit faebe22254

View File

@@ -217,6 +217,17 @@ namespace Lidgren.Network
}
#endif
/// <summary>
/// Writes a 32 bit signed integer at a given offset in the buffer
/// </summary>
public void WriteAt(Int32 offset, Int32 source)
{
int newBitLength = Math.Max(m_bitLength + 32, offset + 32);
EnsureBufferSize(newBitLength);
NetBitWriter.WriteUInt32((UInt32)source, 32, m_data, offset);
m_bitLength = newBitLength;
}
#if UNSAFE
/// <summary>
/// Writes a 32 bit unsigned integer
@@ -253,6 +264,17 @@ namespace Lidgren.Network
}
#endif
/// <summary>
/// Writes a 32 bit unsigned integer at a given offset in the buffer
/// </summary>
public void WriteAt(Int32 offset, UInt32 source)
{
int newBitLength = Math.Max(m_bitLength + 32, offset + 32);
EnsureBufferSize(newBitLength);
NetBitWriter.WriteUInt32(source, 32, m_data, offset);
m_bitLength = newBitLength;
}
/// <summary>
/// Writes a 32 bit signed integer
/// </summary>