示例#1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ToxOptions"/> struct.
 /// </summary>
 /// <param name="ipv6Enabled"></param>
 /// <param name="udpDisabled"></param>
 public ToxOptions(bool ipv6Enabled, bool udpDisabled)
 {
     Ipv6Enabled  = ipv6Enabled;
     UdpDisabled  = udpDisabled;
     ProxyType    = ToxProxyType.None;
     ProxyAddress = null;
     ProxyPort    = 0;
 }
示例#2
0
        /// <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;
        }
示例#3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ToxOptions"/> struct.
        /// </summary>
        /// <param name="ipv6Enabled"></param>
        /// <param name="type"></param>
        /// <param name="proxyAddress"></param>
        /// <param name="proxyPort"></param>
        public ToxOptions(bool ipv6Enabled, ToxProxyType type, string proxyAddress, int proxyPort)
        {
            Ipv6Enabled = ipv6Enabled;
            UdpDisabled = true;
            ProxyType   = type;

            char[] dest        = new char[256];
            char[] sourceArray = proxyAddress.ToCharArray();

            if (sourceArray.Length > dest.Length)
            {
                throw new Exception("Argument proxy_address is longer than 256 chars");
            }

            Array.Copy(sourceArray, 0, dest, 0, sourceArray.Length);

            ProxyAddress = dest;
            ProxyPort    = (ushort)proxyPort;
        }
示例#4
0
        /// <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;
        }
示例#5
0
 public static extern void SetProxyType(ToxOptionsHandle options, ToxProxyType proxy_type);