Beispiel #1
0
        public static bool IsMatch(string input, SpeechEntry entry)
        {
            int start = 0;

            string[] split = entry.Keywords;

            for (int i = 0; i < split.Length; i++)
            {
                if (split[i].Length > 0 && split[i].Length <= input.Length)
                {
                    if (!entry.CheckStart)
                    {
                        if (input.IndexOf(split[i], 0) < 0)
                        {
                            continue;
                        }
                    }

                    if (!entry.CheckEnd)
                    {
                        if (input.IndexOf(split[i], input.Length - split[i].Length) < 0)
                        {
                            continue;
                        }
                    }

                    if (input.IndexOf(split[i]) >= 0)
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
Beispiel #2
0
        public static SpeechEntry[] GetKeywords(string text)
        {
            if (FileManager.ClientVersion < ClientVersions.CV_305D)
            {
                return new SpeechEntry[0]
                       {
                       }
            }
            ;

            text = text.ToLower();
            List <SpeechEntry> list = new List <SpeechEntry>();

            for (int i = 0; i < _speech.Length; i++)
            {
                SpeechEntry entry = _speech[i];

                if (IsMatch(text, entry))
                {
                    list.Add(entry);
                }
            }

            list.Sort();

            return(list.ToArray());
        }
    }
Beispiel #3
0
        public static SpeechEntry[] GetKeywords(string text)
        {
            text = text.ToLower();
            List <SpeechEntry> list = new List <SpeechEntry>();

            for (int i = 0; i < _speech.Length; i++)
            {
                SpeechEntry entry = _speech[i];

                if (IsMatch(text, entry.Keywords))
                {
                    list.Add(entry);
                }
            }

            list.Sort();

            return(list.ToArray());
        }