コード例 #1
0
ファイル: XmlViewsUtils.cs プロジェクト: sillsdev/WorldPad
		internal static string[] AddStringFromOtherObj(XmlNode frag, int hvoTarget, FdoCache cache)
		{
			int flid = XmlVc.GetFlid(frag, hvoTarget, cache);
			ITsStrFactory tsf = TsStrFactoryClass.Create();
			FieldType itype = cache.GetFieldType(flid);
			if ((itype == FieldType.kcptUnicode) ||
				(itype == FieldType.kcptBigUnicode))
			{
				return new string[] {cache.GetUnicodeProperty(hvoTarget, flid)};
			}
			else if ((itype == FieldType.kcptString) ||
				(itype == FieldType.kcptBigString))
			{
				return new string[] { cache.GetTsStringProperty(hvoTarget, flid).Text };
			}
			else // multistring of some type
			{
				int wsid = 0;
				string sep = "";
				if (s_cwsMulti > 1)
				{
					string sLabelWs = XmlUtils.GetOptionalAttributeValue(frag, "ws");
					if (sLabelWs != null && sLabelWs == "current")
					{
						sep = DisplayMultiSep(frag, cache)
							+ DisplayWsLabel(s_qwsCurrent, cache);
						wsid = s_qwsCurrent.WritingSystem;
					}
				}
				if (wsid == 0)
					wsid = LangProject.GetWritingSystem(frag, cache, null, LangProject.kwsAnal);
				if ((itype == FieldType.kcptMultiUnicode) ||
					(itype == FieldType.kcptMultiBigUnicode))
				{
					return new string[] {sep, cache.GetMultiUnicodeAlt(hvoTarget, flid, wsid, null) };
				}
				else
				{
					return new string[] {sep, cache.GetMultiStringAlt(hvoTarget, flid, wsid).Text };
				}
			}
		}