Пример #1
0
            public override IDeepCopyable CopyTo(IDeepCopyable other)
            {
                var dest = other as MappingComponent;

                if (dest != null)
                {
                    base.CopyTo(dest);
                    if (IdentityElement != null)
                    {
                        dest.IdentityElement = (Hl7.Fhir.Model.Id)IdentityElement.DeepCopy();
                    }
                    if (UriElement != null)
                    {
                        dest.UriElement = (Hl7.Fhir.Model.FhirUri)UriElement.DeepCopy();
                    }
                    if (NameElement != null)
                    {
                        dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopy();
                    }
                    if (CommentsElement != null)
                    {
                        dest.CommentsElement = (Hl7.Fhir.Model.FhirString)CommentsElement.DeepCopy();
                    }
                    return(dest);
                }
                else
                {
                    throw new ArgumentException("Can only copy to an object of the same type", "other");
                }
            }
        /// <summary>
        /// Initializes a new instance of the <see cref="UriFoundEventArgs"/> class.
        /// </summary>
        /// <param name="element">The element.</param>
        public UriFoundEventArgs(UriElement element)
        {
            if (element == null)
                throw new ArgumentNullException("element");

            _element = element;
        }
Пример #3
0
        public void Test_That_CouchbaseClientSection_Has_Localhost_Uri()
        {
            var section = (CouchbaseClientSection)ConfigurationManager.GetSection("couchbaseClients/couchbase");
            var servers = new UriElement[section.Servers.Count];

// ReSharper disable once CoVariantArrayConversion
            section.Servers.CopyTo(servers, 0);
            Assert.AreEqual("http://localhost:8091", servers[0].Uri.OriginalString);
        }
        public void Test_That_CouchbaseClientSection_Has_ServerIp_Uri()
        {
            var section = (CouchbaseClientSection)ConfigurationManager.GetSection("couchbaseClients/couchbase");
            var servers = new UriElement[section.Servers.Count];

// ReSharper disable once CoVariantArrayConversion
            section.Servers.CopyTo(servers, 0);
            Assert.IsNotNullOrEmpty(servers[0].Uri.OriginalString);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="UriFoundEventArgs"/> class.
        /// </summary>
        /// <param name="cameFrom">The came from.</param>
        /// <param name="foundUri">The found URI.</param>
        public UriFoundEventArgs(Uri cameFrom, Uri foundUri)
        {
            if (cameFrom == null)
                throw new ArgumentNullException("cameFrom");

            if (foundUri == null)
                throw new ArgumentNullException("foundUri");

            _element = new UriElement(cameFrom, foundUri);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="UriProcessFinishedEventArgs"/> class.
 /// </summary>
 /// <param name="element">The element.</param>
 /// <param name="response">The response.</param>
 /// <param name="related">The related.</param>
 /// <param name="contentHash">The content hash.</param>
 /// <param name="content">The content.</param>
 public UriProcessingFinishedEventArgs(UriElement element, HttpWebResponse response, UriElement[] related, string contentHash, string content, TimeSpan responseTime)
 {
     _element = element;
     _method = response.Method;
     _status = (int)response.StatusCode;
     _responseHeaders = response.Headers;
     _contentHash = contentHash;
     _content = content;
     _related = related;
     _responseTime = responseTime;
 }
		/// <summary>
		/// Initializes a new instance of the <see cref="HttpUriHandler"/> class.
		/// </summary>
		/// <param name="element">The element.</param>
		/// <param name="response">The response.</param>
		public UriHandler(UriElement element, HttpWebResponse response)
		{
			if (response == null)
				throw new ArgumentNullException("response");

			if (element == null)
				throw new ArgumentNullException("element");

			_response = response;
			_element = element;
			_related = new List<UriElement>();
		}
 /// <summary>
 /// Initializes a new instance of the <see cref="UriHandlerStartedEventArgs"/> class.
 /// </summary>
 public UriHandlerStartedEventArgs(UriElement element)
 {
     Element = element;
     Cancel = false;
 }
Пример #9
0
        /// <summary>
        /// Threads the process handler.
        /// </summary>
        /// <param name="uri">The URI.</param>
        /// <returns></returns>
        private bool ThreadProcessHandler(UriElement uri)
        {
            // find a free slot in the thread pool
            for (int i = 0; i < _threadPool.Length; i++)
            {
                if (_threadPool[i] == null || !_threadPool[i].IsAlive)
                {
                    ParameterizedThreadStart start = new ParameterizedThreadStart(this.ProcessHandler);
                    Thread thread = new Thread(start);
                    thread.Name = i.ToString();

                    // add the thread to the thread pool
                    _threadPool[i] = thread;

                    // start the thread for the current URI
                    thread.Start(uri);
                    return true;
                }
            }

            return false;
        }
Пример #10
0
 /// <summary>
 /// Determines whether [is processing required] [the specified URI].
 /// </summary>
 /// <param name="uri">The URI.</param>
 /// <returns>
 /// 	<see langword="true"/> if [is processing required] [the specified URI]; otherwise, <see langword="false"/>.
 /// </returns>
 private bool IsProcessingRequired(UriElement uri)
 {
     return !_processing.ContainsKey(uri) && !_processed.Contains(uri) && !_notProcessed.Contains(uri) && (InitialUrl.IsBaseOf(uri) || uri.RequestedUri.Host.Contains(InitialUrl.Host) || InitialUrl.Host.Contains(uri.RequestedUri.Host));
 }
Пример #11
0
 /// <summary>
 /// Determines whether the specified URI is processed.
 /// </summary>
 /// <param name="uri">The URI.</param>
 /// <returns>
 /// 	<see langword="true"/> if the specified URI is processed; otherwise, <see langword="false"/>.
 /// </returns>
 private bool IsProcessed(UriElement uri)
 {
     return _processing.ContainsKey(uri) || _processed.Contains(uri);
 }