DownloadPage() public static method

public static DownloadPage ( IRuntime runtime, IHttpWire wire ) : RuntimeTable
runtime IRuntime
wire IHttpWire
return RuntimeTable
Esempio n. 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);
                    }
                }
            }
        }
Esempio n. 2
0
        private void Work(string logValue) //multi threaded
        {
            ThreadContext.Properties[Config.LogKey] = logValue;

            IHttpWire wire = null;

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

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

                var downloadResult = Http.DownloadPage(_args.Runtime, wire);

                if (_callOnProgres)
                {
                    _args.Runtime.OnProgress();
                }

                lock (ResultLock)
                {
                    foreach (var p in downloadResult)
                    {
                        _results.Enqueue(p);
                    }
                }
            }
        }
Esempio n. 3
0
 protected override RuntimeTable <DownloadPage> Fetch(IRuntime runtime, IHttpWire wire)
 {
     return(Http.DownloadPage(runtime, wire));
 }