コード例 #1
0
ファイル: TermBaseDB.cs プロジェクト: crashracer/EasyTerm
        // ********************************************************************************
        /// <summary>
        ///
        /// </summary>
        /// <param name="termID"></param>
        /// <param name="info"></param>
        /// <param name="abort"></param>
        /// <returns></returns>
        /// <created>UPh,20.03.2016</created>
        /// <changed>UPh,20.03.2016</changed>
        // ********************************************************************************
        internal bool GetTermStatus(TermListItem item, IAbortTermQuery abort)
        {
            TermInfo info = new TermInfo();

            if (!GetTermInfo(item.TermID, out info, abort))
            {
                return(false);
            }

            // Find term in first language set
            if (info.LanguageSets.Count == 0)
            {
                return(false);
            }

            foreach (EasyTermCore.TermInfo.Term term in info.LanguageSets[0].Terms)
            {
                if (term.Props != null && term.Text == item.Term)
                {
                    item.Status = term.Props.Status;
                    return(true);
                }
            }

            return(true);
        }
コード例 #2
0
ファイル: TermBaseQuery.cs プロジェクト: crashracer/EasyTerm
        // ********************************************************************************
        /// <summary>
        ///
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        /// <created>UPh,31.10.2015</created>
        /// <changed>UPh,31.10.2015</changed>
        // ********************************************************************************
        public void RequestTermInfo(TermListItem item, long requestid)
        {
            if (!_Worker.IsStarted)
            {
                _Worker.Start();
            }

            _Worker.PutRequest(TermBaseRequest.MakeTermInfoRequest(item.TermBaseID, item.TermID, requestid));
        }
コード例 #3
0
        // ********************************************************************************
        /// <summary>
        ///
        /// </summary>
        /// <param name="items"></param>
        /// <returns></returns>
        /// <created>UPh,14.11.2015</created>
        /// <changed>UPh,14.11.2015</changed>
        // ********************************************************************************
        public void BuildIndex(int lcid, TermListItems items)
        {
            LCID = lcid;
            int count = items.Count;

            _Items = new IndexItem[count];

            for (int i = 0; i < count; i++)
            {
                TermListItem termItem = items[i];

                _Items[i].Hash       = MakeGlossaryHashCode(termItem.Term);
                _Items[i].TermBaseID = termItem.TermBaseID;
                _Items[i].TermID     = termItem.TermID;
            }

            Array.Sort(_Items);
        }
コード例 #4
0
ファイル: TermBaseCSV.cs プロジェクト: crashracer/EasyTerm
        // ********************************************************************************
        /// <summary>
        ///
        /// </summary>
        /// <param name="items"></param>
        /// <param name="bAbort"></param>
        /// <returns></returns>
        /// <created>UPh,25.10.2015</created>
        /// <changed>UPh,25.10.2015</changed>
        // ********************************************************************************
        internal override void GetTermList(TermListItems items, IAbortTermQuery abort, bool bTargetLanguage)
        {
            if (_Stream == null)
            {
                return;
            }

            for (int i = 0; i < _Terms.Count; i++)
            {
                var tuple = _Terms[i];

                TermListItem item = new TermListItem();
                if (bTargetLanguage)
                {
                    items.Add(File.ID, tuple.Item2, i);
                }
                else
                {
                    items.Add(File.ID, tuple.Item1, i);
                }
            }
        }