SIL.FieldWorks.FwCoreDlgs.ReplaceAllCollectorEnv.DoReplace C# (CSharp) Méthode

DoReplace() private méthode

Does the find or replace.
private DoReplace ( ITsString tss ) : ITsString
tss ITsString The original string.
Résultat ITsString
		private ITsString DoReplace(ITsString tss)
		{
			if (tss == null || tss.Length == 0)
				return null;

			m_textSourceInit.SetString(tss, m_vc, m_sda.WritingSystemFactory);

			IVwTextSource textSource = m_textSourceInit as IVwTextSource;
			int ichMinLog, ichLimLog;
			ITsStrBldr tsb = null;
			int cch = tss.Length; // length of old string
			int delta = 0; // length difference between new and old string

			for (int ichStartLog = 0; ichStartLog <= cch; )
			{
				m_Pattern.FindIn(textSource, ichStartLog, cch, true, out ichMinLog, out ichLimLog, null);
				if (ichMinLog < 0)
					break;
				if (tsb == null)
					tsb = tss.GetBldr();

				if (IsEditable(tss, ichMinLog, ichLimLog))
				{
					delta += ReplaceString(tsb, tss, ichMinLog, ichLimLog, m_Pattern.ReplacementText,
						delta, m_fEmptySearch, m_Pattern.MatchOldWritingSystem);
					m_cReplace++;
				}
				ichStartLog = ichLimLog;
			}

			if (tsb == null)
				return null;

			return tsb.GetString().get_NormalizedForm(FwNormalizationMode.knmNFD);
		}