示例#1
0
        public static SpeechEntry[] GetKeywords(string text)
        {
            if (Speech.m_Speech == null)
            {
                Speech.LoadSpeechTable();
            }
            text = text.ToLower();
            ArrayList dataStore = Engine.GetDataStore();

            SpeechEntry[] speechEntryArray1 = Speech.m_Speech;
            int           length            = speechEntryArray1.Length;

            for (int index = 0; index < length; ++index)
            {
                SpeechEntry speechEntry = speechEntryArray1[index];
                if (Speech.IsMatch(text, speechEntry.m_Keywords))
                {
                    dataStore.Add((object)speechEntry);
                }
            }
            dataStore.Sort();
            SpeechEntry[] speechEntryArray2 = (SpeechEntry[])dataStore.ToArray(typeof(SpeechEntry));
            Engine.ReleaseDataStore(dataStore);
            return(speechEntryArray2);
        }
示例#2
0
        public int CompareTo(object x)
        {
            if (x == null || x.GetType() != typeof(SpeechEntry))
            {
                return(-1);
            }
            if (x == this)
            {
                return(0);
            }
            SpeechEntry speechEntry = (SpeechEntry)x;

            if ((int)this.m_KeywordID < (int)speechEntry.m_KeywordID)
            {
                return(-1);
            }
            return((int)this.m_KeywordID > (int)speechEntry.m_KeywordID ? 1 : 0);
        }