You've already forked lidgren-network-gen3
mirror of
https://github.com/lidgren/lidgren-network-gen3.git
synced 2026-05-15 22:56:30 +09:00
Missing project added; various code cleanups
This commit is contained in:
@@ -15,12 +15,10 @@ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Diagnostics;
|
||||
using System.Net;
|
||||
|
||||
namespace Lidgren.Network
|
||||
{
|
||||
@@ -62,6 +60,14 @@ namespace Lidgren.Network
|
||||
get { return m_bitLength; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the internal data buffer, don't modify
|
||||
/// </summary>
|
||||
public byte[] PeekDataBuffer()
|
||||
{
|
||||
return m_data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the NetDeliveryMethod used by this message
|
||||
/// </summary>
|
||||
@@ -110,6 +116,20 @@ namespace Lidgren.Network
|
||||
m_fragmentationInfo = null;
|
||||
}
|
||||
|
||||
public void Decrypt(NetXtea tea)
|
||||
{
|
||||
// need blocks of 8 bytes
|
||||
int blocks = m_bitLength / 64;
|
||||
if (blocks * 64 != m_bitLength)
|
||||
throw new NetException("Wrong message length for XTEA decrypt! Length is " + m_bitLength + " bits");
|
||||
|
||||
Console.WriteLine("DECRYPTING " + NetUtility.ToHexString(m_data));
|
||||
|
||||
byte[] result = new byte[m_data.Length];
|
||||
tea.DecryptBlock(m_data, 0, result, 0);
|
||||
m_data = result;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return String.Format("[NetIncomingMessage {0}, {1}|{2}, {3} bits]",
|
||||
|
||||
Reference in New Issue
Block a user