示例#1
0
        /// <summary>
        /// Creates a new instance of the ApiEdit class
        /// </summary>
        /// <param name="url">Path to scripts on server</param>
        /// <param name="usePHP5"></param>
        public ApiEdit(string url, bool usePHP5)
            : this()
        {
            if (string.IsNullOrEmpty(url))
            {
                throw new ArgumentException("Invalid URL specified", "url");
            }
            if (!url.StartsWith("http://"))
            {
                throw new NotSupportedException("Only editing via HTTP is currently supported");
            }

            URL    = url;
            PHP5   = usePHP5;
            Maxlag = 5;

            if (ProxyCache.ContainsKey(url))
            {
                ProxySettings = ProxyCache[url];
            }
            else
            {
                ProxySettings = WebRequest.GetSystemWebProxy();
                if (ProxySettings.IsBypassed(new Uri(url)))
                {
                    ProxySettings = null;
                }
                ProxyCache.Add(url, ProxySettings);
            }
        }
 internal object LookUpProxy(Type type)
 => ProxyCache.ContainsKey(type) ? ProxyCache[type] : null;