Пример #1
0
 public bool DowloadHtml(string SearchName)
 {
     _cover = null;
     try {
         _html = HtmlDowloadHelper.Dowloadhtml(string.Format(BaseURi, SearchName));
         return(true);
     }
     catch { return(false); }
 }
Пример #2
0
        public bool FindCover()
        {
            if (String.IsNullOrEmpty(_html))
            {
                throw new SearcherException("Code HTML do not download");
            }
            string firstWordbp = "content=\"https://patentimages.storage.googleapis.com/";

            foreach (Match m in Regex.Matches(_html, firstWordbp))
            {
                int lengthbp = _html.IndexOf('>') - Convert.ToInt32(m.Index);
                for (int i = m.Index; i < _html.Length; i++)
                {
                    if (_html[i] == '>')
                    {
                        lengthbp = i;
                        break;
                    }
                }
                if (!result.Contains(_html.Substring(Convert.ToInt32(m.Index), lengthbp)))
                {
                    result.Add(_html.Substring(Convert.ToInt32(m.Index + 9), lengthbp));
                }
            }

            string srere = "";

            foreach (var url in result)
            {
                srere = url.Split('\"')[0];
                if (srere.Contains(".pdf") == false)
                {
                    Uri.Add(srere);
                }
            }
            try
            {
                _cover = HtmlDowloadHelper.DowloadImage(Uri);
                return(true);
            }
            catch { return(false); }
        }