// ******************************************************************************** /// <summary> /// /// </summary> /// <param name="nodeLangset"></param> /// <param name="langset"></param> /// <returns></returns> /// <created>UPh,31.10.2015</created> /// <changed>UPh,31.10.2015</changed> // ******************************************************************************** private void ReadLangset(XmlNode nodeLangset, TermInfo.LangSet langset) { // Read description ReadProps(nodeLangset, ref langset._Props); // Read terms foreach (XmlNode nodeTig in nodeLangset.SelectNodes("./tig")) { XmlNode nodeTerm = nodeTig.SelectSingleNode("./term"); if (nodeTerm == null) { return; } TermInfo.Term term = langset.AddTerm(nodeTerm.InnerText); ReadProps(nodeTig, ref term._Props); } // Read terms foreach (XmlNode nodeTig in nodeLangset.SelectNodes("./ntig")) { XmlNode nodeTerm = nodeTig.SelectSingleNode("./termGrp/term"); if (nodeTerm == null) { return; } TermInfo.Term term = langset.AddTerm(nodeTerm.InnerText); ReadProps(nodeTig, ref term._Props); } }
// ******************************************************************************** /// <summary> /// /// </summary> /// <param name="match"></param> /// <returns></returns> /// <created>UPh,14.11.2015</created> /// <changed>UPh,14.11.2015</changed> // ******************************************************************************** private void HandleTerminologyMatch(long requestid, IndexItem match, int from, int len, List <TerminologyResultArgs> result = null) { // Get TermInfo TermBase termbase = _TermBases.FindTermBase(match.TermBaseID); if (termbase == null) { return; } TermInfo terminfo = null; if (!termbase.GetTermInfo(match.TermID, out terminfo, this)) { return; } if (terminfo.LanguageSets.Count != 2) { return; } TermInfo.Term srcterm = null; foreach (TermInfo.Term term in terminfo.LanguageSets[0].Terms) { ulong hash = TermIndex.MakeGlossaryHashCode(term.Text); if (match.Hash != hash) { continue; } srcterm = term; break; } if (srcterm == null) { return; } string definition = terminfo.Definition; foreach (TermInfo.Term term in terminfo.LanguageSets[1].Terms) { TerminologyResultArgs args = new TerminologyResultArgs(); if (term.Props != null) { args.Status = term.Props.Status; } else { args.Status = TermStatus.none; } args.RequestID = requestid; args.TermBaseID = match.TermBaseID; args.TermID = match.TermID; args.FindFrom = from; args.FindLen = len; args.Term1 = srcterm.Text; args.Term2 = term.Text; args.Origin = termbase.File.DisplayName; args.Description = definition; if (result != null) { result.Add(args); } else { _TermbaseQuery.FireTerminologyResult(args); } } }