示例#1
0
        public static Image Resolve(
            String emote,
            bool useTwitchEmotes              = true,
            bool useFrankerFaceZGlobalEmotes  = true,
            bool useFrankerFaceZChannelEmotes = false)
        {
            if (useTwitchEmotes)
            {
                var foundEmote = TwitchEmotes.Where(x => x.Key.IsMatch(emote)).Select(x => x.Value).FirstOrDefault();
                if (foundEmote != null)
                {
                    return(foundEmote.Value);
                }
            }
            if (useFrankerFaceZGlobalEmotes)
            {
                var foundEmote = FrankerFaceZGlobalEmotes.Where(x => x.Key.IsMatch(emote)).Select(x => x.Value).FirstOrDefault();
                if (foundEmote != null)
                {
                    return(foundEmote.Value);
                }
            }
            if (useFrankerFaceZChannelEmotes)
            {
                var foundEmote = FrankerFaceZChannelEmotes.Where(x => x.Key.IsMatch(emote)).Select(x => x.Value).FirstOrDefault();
                if (foundEmote != null)
                {
                    return(foundEmote.Value);
                }
            }

            throw new ArgumentException();
        }
示例#2
0
 public static bool IsEmote(
     String text,
     bool useTwitchEmotes              = true,
     bool useFrankerFaceZGlobalEmotes  = true,
     bool useFrankerFaceZChannelEmotes = true)
 {
     try
     {
         if (useTwitchEmotes)
         {
             var foundEmote = TwitchEmotes.Where(x => x.Key.IsMatch(text) && x.Key.ToString().Length == text.Length).Select(x => x.Value).FirstOrDefault();
             if (foundEmote != null)
             {
                 return(true);
             }
         }
         if (useFrankerFaceZGlobalEmotes)
         {
             var foundEmote = FrankerFaceZGlobalEmotes.Where(x => x.Key.IsMatch(text) && x.Key.ToString().Length == text.Length).Select(x => x.Value).FirstOrDefault();
             if (foundEmote != null)
             {
                 return(true);
             }
         }
         if (useFrankerFaceZChannelEmotes)
         {
             var foundEmote = FrankerFaceZChannelEmotes.Where(x => x.Key.IsMatch(text) && x.Key.ToString().Length == text.Length).Select(x => x.Value).FirstOrDefault();
             if (foundEmote != null)
             {
                 return(true);
             }
         }
     }
     catch (Exception ex)
     {
         Log.Error(ex);
     }
     return(false);
 }