Beispiel #1
0
        private void Work(string logValue) //multi threaded
        {
            ThreadContext.Properties[Config.LogKey] = logValue;

            string url = string.Empty;

            while (true)
            {
                lock (UrlLock)
                {
                    if (Urls.Count > 0)
                    {
                        url = Urls.Dequeue();
                    }
                    else
                    {
                        url = null;
                    }
                }

                if (url == null) //nothing left in queue
                {
                    break;
                }

                _runtime.Call(_line);
                var downloadResult = Http.DownloadPage(_runtime, url, _line);
                _runtime.Call(_line);

                if (_callOnProgres)
                {
                    _runtime.OnProgress();
                }

                lock (ResultLock)
                {
                    foreach (var p in downloadResult)
                    {
                        _results.Enqueue(p);
                    }
                }
            }
        }
Beispiel #2
0
 public object Download()
 {
     _runtime.Call(_line);
     return(DownloadImpl());
 }
Beispiel #3
0
 public byte[] Download()
 {
     _runtime.Call(_line);
     return(DownloadImpl());
 }