/// <summary> /// Initializes a new instance of the <see cref="ToxOptions"/> struct. /// </summary> /// <param name="ipv6Enabled">Whether or not IPv6 should be enabled.</param> /// <param name="udpEnabled">Whether or not UDP should be enabled.</param> public ToxOptions(bool ipv6Enabled, bool udpEnabled) { _options = new ToxOptionsStruct(); _options.Ipv6Enabled = ipv6Enabled; _options.UdpEnabled = udpEnabled; _options.LocalDiscoveryEnabled = true; _options.HolePunchingEnabled = true; }
/// <summary> /// Initializes a new instance of the <see cref="ToxOptions"/> struct. /// </summary> /// <param name="ipv6Enabled">Whether or not IPv6 should be enabled.</param> /// <param name="type">The type of proxy we want to connect to.</param> /// <param name="proxyAddress">The IP address or DNS name of the proxy to be used.</param> /// <param name="proxyPort">The port to use to connect to the proxy.</param> public ToxOptions(bool ipv6Enabled, ToxProxyType type, string proxyAddress, int proxyPort) { if (string.IsNullOrEmpty(proxyAddress)) { throw new ArgumentNullException("proxyAddress"); } if (proxyAddress.Length > 255) { throw new Exception("Parameter proxyAddress is too long."); } _options = new ToxOptionsStruct(); _options.Ipv6Enabled = ipv6Enabled; _options.UdpEnabled = false; _options.ProxyType = type; _options.ProxyHost = proxyAddress; _options.ProxyPort = (ushort)proxyPort; }
internal ToxOptions(ToxOptionsStruct options) { _options = options; }
/// <summary> /// Initializes a new instance of the <see cref="ToxOptions"/> struct. /// </summary> /// <param name="ipv6Enabled">Whether or not IPv6 should be enabled.</param> /// <param name="udpEnabled">Whether or not UDP should be enabled.</param> public ToxOptions(bool ipv6Enabled, bool udpEnabled) { _options = new ToxOptionsStruct(); _options.Ipv6Enabled = ipv6Enabled; _options.UdpEnabled = udpEnabled; }
/// <summary> /// Initializes a new instance of the <see cref="ToxOptions"/> struct. /// </summary> /// <param name="ipv6Enabled">Whether or not IPv6 should be enabled.</param> /// <param name="type">The type of proxy we want to connect to.</param> /// <param name="proxyAddress">The IP address or DNS name of the proxy to be used.</param> /// <param name="proxyPort">The port to use to connect to the proxy.</param> public ToxOptions(bool ipv6Enabled, ToxProxyType type, string proxyAddress, int proxyPort) { if (string.IsNullOrEmpty(proxyAddress)) throw new ArgumentNullException("proxyAddress"); if (proxyAddress.Length > 255) throw new Exception("Parameter proxyAddress is too long."); _options = new ToxOptionsStruct(); _options.Ipv6Enabled = ipv6Enabled; _options.UdpEnabled = false; _options.ProxyType = type; _options.ProxyHost = proxyAddress; _options.ProxyPort = (ushort)proxyPort; }
internal static extern void OptionsFree(ref ToxOptionsStruct options);
internal static extern void OptionsDefault(ref ToxOptionsStruct options);
internal static extern ToxHandle New(ref ToxOptionsStruct options, ref ToxErrorNew error);