- Barotrauma's projects are in the Barotrauma directory - All libraries are in the Libraries directory - MonoGame is now managed by NuGet, rather than referenced from the installed files (TODO: consider using PCL for easier cross-platform development?) - NuGet libraries are not included in the repo, as getting the latest versions automatically should be preferred - Removed Content/effects.mgfx as it didn't seem to be used anywhere - Removed some references to Subsurface directory - Renamed Launcher2 to Launcher
46 lines
967 B
C#
46 lines
967 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Security.Cryptography;
|
|
|
|
namespace Lidgren.Network
|
|
{
|
|
/// <summary>
|
|
/// Interface for an encryption algorithm
|
|
/// </summary>
|
|
public abstract class NetEncryption
|
|
{
|
|
/// <summary>
|
|
/// NetPeer
|
|
/// </summary>
|
|
protected NetPeer m_peer;
|
|
|
|
/// <summary>
|
|
/// Constructor
|
|
/// </summary>
|
|
public NetEncryption(NetPeer peer)
|
|
{
|
|
if (peer == null)
|
|
throw new NetException("Peer must not be null");
|
|
m_peer = peer;
|
|
}
|
|
|
|
public void SetKey(string str)
|
|
{
|
|
var bytes = System.Text.Encoding.ASCII.GetBytes(str);
|
|
SetKey(bytes, 0, bytes.Length);
|
|
}
|
|
|
|
public abstract void SetKey(byte[] data, int offset, int count);
|
|
|
|
/// <summary>
|
|
/// Encrypt an outgoing message in place
|
|
/// </summary>
|
|
public abstract bool Encrypt(NetOutgoingMessage msg);
|
|
|
|
/// <summary>
|
|
/// Decrypt an incoming message in place
|
|
/// </summary>
|
|
public abstract bool Decrypt(NetIncomingMessage msg);
|
|
}
|
|
}
|