Esempio n. 1
0
		/// <summary>
		/// Scan ImportResidue for XML looking string inserted by LIFT import.  If any is found,
		/// move it from ImportResidue to LiftResidue.
		/// </summary>
		/// <returns>string containing any LIFT import residue found in ImportResidue</returns>
		public static string ExtractLIFTResidue(FdoCache cache, int hvo, int flidImportResidue,
			int flidLiftResidue)
		{
			TsStringAccessor tsa = new TsStringAccessor(cache, hvo, flidImportResidue);
			if (tsa.UnderlyingTsString == null || tsa.Length < 13)
				return null;
			int idx = tsa.Text.IndexOf("<lift-residue");
			if (idx >= 0)
			{
				string sLiftResidue = tsa.Text.Substring(idx);
				int idx2 = sLiftResidue.IndexOf("</lift-residue>");
				if (idx2 >= 0)
				{
					idx2 += 15;
					if (sLiftResidue.Length > idx2)
						sLiftResidue = sLiftResidue.Substring(0, idx2);
				}
				if (flidLiftResidue != 0)
				{
					int cch = sLiftResidue.Length;
					ITsStrBldr tsb = tsa.UnderlyingTsString.GetBldr();
					tsb.Replace(idx, idx + cch, null, null);
					tsa.UnderlyingTsString = tsb.GetString();	// remove from ImportResidue
					cache.SetUnicodeProperty(hvo, flidLiftResidue, sLiftResidue);
				}
				return sLiftResidue;
			}
			else
			{
				return null;
			}
		}