public void Create(Address?address, int peerLimit, int channelLimit, uint incomingBandwidth, uint outgoingBandwidth) { if (_host != null) { throw new InvalidOperationException("Already created."); } if (peerLimit < 0 || peerLimit > Native.ENET_PROTOCOL_MAXIMUM_PEER_ID) { throw new ArgumentOutOfRangeException("peerLimit"); } CheckChannelLimit(channelLimit); var ret = Native.enet_initialize(); if (ret < 0) { throw new ENetException(ret, "Initialization failed."); } if (address != null) { var nativeAddress = address.Value.NativeData; _host = Native.enet_host_create(ref nativeAddress, (IntPtr)peerLimit, (IntPtr)channelLimit, incomingBandwidth, outgoingBandwidth); } else { _host = Native.enet_host_create(null, (IntPtr)peerLimit, (IntPtr)channelLimit, incomingBandwidth, outgoingBandwidth); } if (_host == null) { throw new ENetException(0, "Host creation call failed."); } }
public static bool Initialize() { if (Native.enet_linked_version() != version) { throw new InvalidOperationException("Incompatatible version"); } return(Native.enet_initialize() == 0); }
public static bool Initialize() { if (Native.enet_linked_version() != version) { throw new InvalidOperationException("You're trying to use an incompatible version of Enet with this Managed Library."); } return(Native.enet_initialize() == 0); }
public static bool Initialize() { if (Native.enet_linked_version() != version) { throw new InvalidOperationException("ENet native is out of date. Download the latest release from https://github.com/SoftwareGuy/ENet-CSharp/releases"); } return(Native.enet_initialize() == 0); }
public static bool Initialize() { if (Initialized) { return(false); } Initialized = true; return(Native.enet_initialize() == 0); }
public static bool Initialize() { return(Native.enet_initialize() == 0); }
public static int Initialize() { return(Native.enet_initialize()); }