示例#1
0
 public Page(Resource r)
     : base(r.Url, r.Parent)
 {
     if (!r.Loaded)
     {
         throw new InvalidOperationException();
     }
     this.Resources = new List<Resource>();
     MemoryStream ms = new MemoryStream(r.Content);
     StreamReader rd = new StreamReader(ms);
     this.HtmlContent = rd.ReadToEnd();
     Analyse();
 }
示例#2
0
        public void NewResource(Resource res)
        {
            if (UriSet.Contains(res.Url)) return;
            UriSet.Add(res.Url);

            lock (this)
            {
                if (res.Parent != null && res.Parent.Url.IsBaseOf(res.Url))
                {
                    PrimaryQueue.Enqueue(res);
                }
                else
                {
                    SecondaryQueue.Enqueue(res);
                }
            }
            res.LoadOK += res_LoadOK;
        }
示例#3
0
 public SpiderWorkProgress(Resource res)
 {
     Resource = res; Exception = null; CurrentRead = 0; ContentLength = 0;
 }