1
0
mirror of https://github.com/lidgren/lidgren-network-gen3.git synced 2026-05-17 15:46:33 +09:00

Added some UNITY defines; fix by aeronaut84. Untested.

This commit is contained in:
lidgren
2014-08-02 18:01:30 +00:00
parent 57eba64f6f
commit 4bfb24da96
4 changed files with 13 additions and 5 deletions

View File

@@ -19,7 +19,7 @@ namespace Lidgren.Network
static NetAESEncryption() static NetAESEncryption()
{ {
#if !IOS && !__ANDROID__ #if !IOS && !__ANDROID__ && !UNITY_4_5
AesCryptoServiceProvider aes = new AesCryptoServiceProvider(); AesCryptoServiceProvider aes = new AesCryptoServiceProvider();
List<int> temp = new List<int>(); List<int> temp = new List<int>();
foreach (KeySizes keysize in aes.LegalKeySizes) foreach (KeySizes keysize in aes.LegalKeySizes)
@@ -103,7 +103,7 @@ namespace Lidgren.Network
/// </summary> /// </summary>
public bool Encrypt(NetOutgoingMessage msg) public bool Encrypt(NetOutgoingMessage msg)
{ {
#if !IOS && !__ANDROID__ #if !IOS && !__ANDROID__ && !UNITY_4_5
try try
{ {
// nested usings are fun! // nested usings are fun!
@@ -138,7 +138,7 @@ namespace Lidgren.Network
/// </summary> /// </summary>
public bool Decrypt(NetIncomingMessage msg) public bool Decrypt(NetIncomingMessage msg)
{ {
#if !IOS && !__ANDROID__ #if !IOS && !__ANDROID__ && !UNITY_4_5
try try
{ {
// nested usings are fun! // nested usings are fun!

View File

@@ -1,4 +1,4 @@
#if !__ANDROID__ && !IOS #if !__ANDROID__ && !IOS && !UNITY_WEBPLAYER
#define IS_MAC_AVAILABLE #define IS_MAC_AVAILABLE
#endif #endif

View File

@@ -35,6 +35,10 @@ namespace Lidgren.Network
// -4 bytes to be on the safe side and align to 8-byte boundary // -4 bytes to be on the safe side and align to 8-byte boundary
// Total 1408 bytes // Total 1408 bytes
// Note that lidgren headers (5 bytes) are not included here; since it's part of the "mtu payload" // Note that lidgren headers (5 bytes) are not included here; since it's part of the "mtu payload"
/// <summary>
/// Default MTU value in bytes
/// </summary>
public const int kDefaultMTU = 1408; public const int kDefaultMTU = 1408;
private const string c_isLockedMessage = "You may not modify the NetPeerConfiguration after it has been used to initialize a NetPeer"; private const string c_isLockedMessage = "You may not modify the NetPeerConfiguration after it has been used to initialize a NetPeer";

View File

@@ -16,13 +16,17 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRA
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE. USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#if !__ANDROID__ && !IOS #if !__ANDROID__ && !IOS && !UNITY_WEBPLAYER
#define IS_FULL_NET_AVAILABLE #define IS_FULL_NET_AVAILABLE
#endif #endif
using System; using System;
using System.Net; using System.Net;
#if IS_FULL_NET_AVAILABLE
using System.Net.NetworkInformation; using System.Net.NetworkInformation;
#endif
using System.Net.Sockets; using System.Net.Sockets;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;