コード例 #1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Does the find.
        /// </summary>
        /// <param name="tss">The original string.</param>
        /// <param name="tag">Tag</param>
        /// ------------------------------------------------------------------------------------
        protected virtual void DoFind(ITsString tss, int tag)
        {
            m_textSourceInit.SetString(tss, m_vc, m_sda.WritingSystemFactory);

            IVwTextSource textSource = m_textSourceInit as IVwTextSource;
            int           ichBegin   = 0;

            if (m_StartLocation != null)
            {
                Debug.Assert(m_StartLocation.TopLevelHvo == m_hvoCurr && m_StartLocation.m_tag == tag);
                ichBegin = m_StartLocation.m_ichLim;
            }

            int ichMin, ichLim;

            // When we re-wrote the find stuff to use this FindCollectorEnv, we removed some
            // whacky code from the FwFindReplaceDlg to try to deal with a sporadic failure
            // reported as TE-4085. We're no longer even calling the same method on vwPattern,
            // but if this failure ever recurs, this is probably the place where we'd want to
            // put a try/catch block so we could retry the find.
            m_Pattern.FindIn(textSource, ichBegin, tss.Length, true, out ichMin,
                             out ichLim, null);
            if (PassedLimit(tag, ichMin))
            {
                m_fHitLimit = true;
                return;
            }
            if (ichMin >= 0)
            {
                m_LocationFound = new LocationInfo(m_stack, CountOfPrevPropAtRoot, tag,
                                                   ichMin, ichLim);
            }
        }