/// <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); } }
/// <summary> /// Creates a new instance of the ApiEdit class /// </summary> /// <param name="url">Path to scripts on server</param> /// <param name="usePHP5">Whether a .php5 extension is to be used</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; ApiURL = URL + "api.php" + (PHP5 ? "5" : ""); Maxlag = 5; IWebProxy proxy; if (ProxyCache.TryGetValue(url, out proxy)) { ProxySettings = proxy; } else { ProxySettings = WebRequest.GetSystemWebProxy(); if (ProxySettings.IsBypassed(new Uri(url))) { ProxySettings = null; } ProxyCache.Add(url, ProxySettings); } }
internal void CacheProxy <T>(T proxy) { ProxyCache.Add(proxy.GetType(), proxy); }
internal void CacheProxy(Type proxyType, object proxy) { ProxyCache.Add(proxyType, proxy); }