private void SetContentFromNode(FdoCache cache, string sNodeName, bool fFixName, ITsMultiString item) { ILgWritingSystemFactory wsf = cache.WritingSystemFactory; ITsStrFactory tsf = cache.TsStrFactory; int iWS; XmlNode nd; bool fContentFound = false; // be pessimistic foreach (IWritingSystem ws in cache.ServiceLocator.WritingSystems.CurrentAnalysisWritingSystems) { string sWS = ws.Id; nd = m_node.SelectSingleNode(sNodeName + "[@ws='" + sWS + "']"); if (nd == null || nd.InnerText.Length == 0) { continue; } fContentFound = true; string sNodeContent; if (fFixName) { sNodeContent = NameFixer(nd.InnerText); } else { sNodeContent = nd.InnerText; } iWS = wsf.GetWsFromStr(sWS); item.set_String(iWS, (tsf.MakeString(sNodeContent, iWS))); } if (!fContentFound) { iWS = cache.ServiceLocator.WritingSystems.DefaultAnalysisWritingSystem.Handle; item.set_String(iWS, tsf.MakeString("", iWS)); } }
private static void SetContentFromNode(LcmCache cache, XmlNode posNode, string sNodeName, bool fFixName, ITsMultiString item) { var wsf = cache.WritingSystemFactory; int iWS; var fContentFound = false; // be pessimistic foreach (var ws in cache.ServiceLocator.WritingSystems.AnalysisWritingSystems) { var sWS = ws.Id; var nd = posNode.SelectSingleNode(sNodeName + "[@ws='" + sWS + "']"); if (nd == null || nd.InnerText.Length == 0) { continue; } fContentFound = true; var sNodeContent = fFixName ? NameFixer(nd.InnerText) : nd.InnerText; iWS = wsf.GetWsFromStr(sWS); item.set_String(iWS, TsStringUtils.MakeString(sNodeContent, iWS)); } if (!fContentFound) { iWS = cache.ServiceLocator.WritingSystems.DefaultAnalysisWritingSystem.Handle; item.set_String(iWS, TsStringUtils.EmptyString(iWS)); } }
private void SetContentFromNode(FdoCache cache, string sNodeName, bool fFixName, ITsMultiString item) { ILgWritingSystemFactory wsf = cache.WritingSystemFactory; ITsStrFactory tsf = cache.TsStrFactory; int iWS; XmlNode nd; bool fContentFound = false; // be pessimistic foreach (IWritingSystem ws in cache.ServiceLocator.WritingSystems.CurrentAnalysisWritingSystems) { string sWS = ws.Id; nd = m_node.SelectSingleNode(sNodeName + "[@ws='" + sWS + "']"); if (nd == null || nd.InnerText.Length == 0) continue; fContentFound = true; string sNodeContent; if (fFixName) sNodeContent = NameFixer(nd.InnerText); else sNodeContent = nd.InnerText; iWS = wsf.GetWsFromStr(sWS); item.set_String(iWS, (tsf.MakeString(sNodeContent, iWS))); } if (!fContentFound) { iWS = cache.ServiceLocator.WritingSystems.DefaultAnalysisWritingSystem.Handle; item.set_String(iWS, tsf.MakeString("", iWS)); } }