public Emoticon(EmoticonSet set, string regex, JsonImage data) { Regex = regex; Width = data.width ?? -1; Height = data.height ?? -1; Url = data.url; ImageSet = set; if (Regex.IsRegex()) { Regex = Regex.Replace(@">\;", ">").Replace(@"<\;", "<"); try { m_reg = new Regex(Regex); } catch { } } string localPath = GetLocalPath(set.Cache); if (File.Exists(localPath)) { LocalFile = localPath; } }
public EmoticonData(TwitchEmoticonResponse emotes, string cache) { m_defaultSet = new EmoticonSet(this, -1); Cache = cache; foreach (var emote in emotes.emoticons) { foreach (var img in emote.images) { EmoticonSet set = GetOrCreateEmoticonSet(img.emoticon_set); set.Add(new Emoticon(set, emote.regex, img)); } } }
private EmoticonSet GetOrCreateEmoticonSet(int?id) { if (id == null) { return(m_defaultSet); } int i = (int)id; while (m_sets.Count <= i) { m_sets.Add(null); } var set = m_sets[i]; if (set == null) { set = m_sets[i] = new EmoticonSet(this, i); } return(set); }
public Emoticon(EmoticonSet set, string regex, JsonImage data) { Regex = regex; Width = data.width ?? -1; Height = data.height ?? -1; Url = data.url; ImageSet = set; if (Regex.IsRegex()) { Regex = Regex.Replace(@">\;", ">").Replace(@"<\;", "<"); try { m_reg = new Regex(Regex); } catch { } } string localPath = GetLocalPath(set.Cache); if (File.Exists(localPath)) LocalFile = localPath; }
private EmoticonSet GetOrCreateEmoticonSet(int? id) { if (id == null) return m_defaultSet; int i = (int)id; while (m_sets.Count <= i) m_sets.Add(null); var set = m_sets[i]; if (set == null) set = m_sets[i] = new EmoticonSet(this, i); return set; }