Example #1
0
        public void ProcessNewPaths(Page p, UrlObject domainObject)
        {
            if (p != null && domainObject != null)
            {
                Console.WriteLine("Visited: " + p.Link.GetFullPath(false));

                Unvisited.Remove(p.Link.GetFullPath(false));
                if (!Visited.ContainsKey(p.Link.GetFullPath(false)))
                {
                    Visited.Add(p.Link.GetFullPath(false), p);
                }

                foreach (LinkTag l in p.LinkTags)
                {
                    var toBeVisited = false;
                    var visited     = false;
                    try
                    {
                        var key = Unvisited[l.Url.GetFullPath(false)];
                        toBeVisited = true;
                    }
                    catch (KeyNotFoundException /* knfe */) { }

                    try
                    {
                        var key = Visited[l.Url.GetFullPath(false)];
                        visited = true;
                    }
                    catch (KeyNotFoundException /* knfe */) { }

                    if (toBeVisited != true
                        & visited != true)
                    {
                        if (l.Url.GetDomain() == domainObject.GetDomain())
                        {
                            Unvisited.Add(l.Url.GetFullPath(false), l.Url);
                        }
                    }
                }
            }
        }
Example #2
0
        public void ProcessNewPaths(Page p, UrlObject domainObject)
        {
            if (p != null && domainObject != null)
            {
                Console.WriteLine("Visited: " + p.Link.GetFullPath(false));

                Unvisited.Remove(p.Link.GetFullPath(false));
                if (!Visited.ContainsKey(p.Link.GetFullPath(false)))
                {
                    Visited.Add(p.Link.GetFullPath(false), p);
                }

                foreach (LinkTag l in p.LinkTags)
                {
                    var toBeVisited = false;
                    var visited = false;
                    try
                    {
                        var key = Unvisited[l.Url.GetFullPath(false)];
                        toBeVisited = true;
                    }
                    catch (KeyNotFoundException /* knfe */) { }

                    try
                    {
                        var key = Visited[l.Url.GetFullPath(false)];
                        visited = true;
                    }
                    catch (KeyNotFoundException /* knfe */) { }

                    if (toBeVisited != true
                        & visited != true)
                    {
                        if (l.Url.GetDomain() == domainObject.GetDomain())
                            Unvisited.Add(l.Url.GetFullPath(false), l.Url);
                    }
                }
            }
        }