public void OnMatchCaseClicked() { m_MatchCaseCheckBox.enabled = !m_MatchCaseCheckBox.enabled; if (m_MatchCaseCheckBox.enabled && m_MatchWholeWordCheckBox.enabled) { m_Flags = PDFSearchHandle.MatchOption.MATCH_CASE_AND_WHOLE_WORD; } else if (m_MatchCaseCheckBox.enabled && !m_MatchWholeWordCheckBox.enabled) { m_Flags = PDFSearchHandle.MatchOption.MATCH_CASE; } else if (!m_MatchCaseCheckBox.enabled && m_MatchWholeWordCheckBox.enabled) { m_Flags = PDFSearchHandle.MatchOption.MATCH_WHOLE_WORD; } else { m_Flags = PDFSearchHandle.MatchOption.NONE; } if (m_ProgressiveSearch != null) { m_SearchFinished = false; m_ProgressiveSearch.StartSearch(m_InputField.text.Trim(), m_Flags); } }
public IList <PDFSearchResult> Search(string findWhat, PDFSearchHandle.MatchOption flags = PDFSearchHandle.MatchOption.NONE, int startIndex = 0) { if (string.IsNullOrEmpty(findWhat.Trim())) { return(new List <PDFSearchResult>()); } return(Search(Encoding.Unicode.GetBytes(findWhat.Trim() + "\0"), flags, startIndex)); }
/// <summary> /// Start a new search and if a search is already started this method will stop it. /// </summary> /// <param name="search"></param> /// <param name="flags">PDFSearchHandle.MATCH_CASE, (PDFSearchHandle.MATCH_WHOLE_WORD or PDFSearchHandle.MATCH_CASE | PDFSearchHandle.MATCH_WHOLE_WORD)</param> public void StartSearch(string search, PDFSearchHandle.MatchOption flags) { if (string.IsNullOrEmpty(search.Trim())) { m_Search = null; } else { m_Search = Encoding.Unicode.GetBytes(search.Trim() + "\0"); } m_Flags = flags; m_PageCount = m_Document.GetPageCount(); m_NewSearchRequested = true; }
public IList <PDFSearchResult> Search(byte[] findWhatUnicode, PDFSearchHandle.MatchOption flags = PDFSearchHandle.MatchOption.NONE, int startIndex = 0) { List <PDFSearchResult> searchResults = new List <PDFSearchResult>(); if (findWhatUnicode == null) { return(searchResults); } using (PDFSearchHandle searchHandle = new PDFSearchHandle(this, findWhatUnicode, startIndex, flags)) { foreach (PDFSearchResult result in searchHandle.EnumerateSearchResults()) { searchResults.Add(result); } } return(searchResults); }