Ejemplo n.º 1
0
        internal HdaBrowseNode Browse(string address)
        {
            var browseElements = _browser.Browse(new ItemIdentifier(string.IsNullOrWhiteSpace(address) ? null : address));
            var root           = new HdaBrowseNode {
                Tag = string.IsNullOrEmpty(address) ? "" : address, Name = string.IsNullOrEmpty(address) ? "Root" : address, Root = true, HasChildren = browseElements.Length > 0
            };

            this.GetNodes(root, browseElements);
            return(root);
        }
Ejemplo n.º 2
0
        private void ProccessPage()
        {
            string url = _repo.GetNextUrl();

            if (url == null)
            {
                Stop();
                return;
            }

            string html = _browser.Browse(url);

            if (IsInvalidPage(html))
            {
                return;
            }

            if (_checker.IsSearched(url, html))
            {
                _repo.AddFound(url);
                OnFound(new FoundEventArgs(url));
            }
            else
            {
                _repo.AddVisited(url);
            }

            _repo.Enqueue(_extractor.ExtractUrls(html, url));
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            Smartphone smartphone = new Smartphone();

            ICaller caller = smartphone;

            string[] phoneNumbers = Console.ReadLine().Split();
            caller.Call(phoneNumbers);

            IBrowser browser = smartphone;

            string[] urls = Console.ReadLine().Split();
            browser.Browse(urls);
        }