Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="XmlRpcClient"/> class.
        /// </summary>
        /// <param name="serverUrl">The server URL.</param>
        /// <exception cref="ArgumentException">Is thrown when the passed server URL was not valid.</exception>
        public XmlRpcClient(Uri serverUrl)
        {
            try
            {
                ServicePointManager.ServerCertificateValidationCallback = delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return(true); };

                this.clientProxy             = XmlRpcProxyGen.Create <IDokuWikiProxy>();
                this.clientProxy.NonStandard = XmlRpcNonStandard.AllowNonStandardDateTime;
                this.clientProxy.Url         = serverUrl.AbsoluteUri;
                Console.WriteLine("XmlRpc proxy to URL: " + serverUrl.AbsoluteUri + " generated.");

                // Network logging; Only used by developers in debug configuration when "LOG_NETWORK_TRAFFIC" is set.
                this.LogXmlTraffic();
            }
            catch (UriFormatException ufe)
            {
                Console.WriteLine(ufe);
                throw new ArgumentException("serverUrl", "Server URL is not valid. Cause: " + ufe.Message);
            }
        }
		/// <summary>
		/// Initializes a new instance of the <see cref="XmlRpcClient"/> class.
		/// </summary>
		/// <param name="serverUrl">The server URL.</param>
		/// <exception cref="ArgumentException">Is thrown when the passed server URL was not valid.</exception>
		public XmlRpcClient(Uri serverUrl)
		{
			try
			{
				ServicePointManager.ServerCertificateValidationCallback = delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return true; };

				this.clientProxy = XmlRpcProxyGen.Create<IDokuWikiProxy>();
				this.clientProxy.NonStandard = XmlRpcNonStandard.AllowNonStandardDateTime;
				this.clientProxy.Url = serverUrl.AbsoluteUri;
				Console.WriteLine("XmlRpc proxy to URL: " + serverUrl.AbsoluteUri + " generated.");

				// Network logging; Only used by developers in debug configuration when "LOG_NETWORK_TRAFFIC" is set.
				this.LogXmlTraffic();
			}
			catch (UriFormatException ufe)
			{
				Console.WriteLine(ufe);
				throw new ArgumentException("serverUrl", "Server URL is not valid. Cause: " + ufe.Message);
			}
		}