public static void GetEmoji() { AllEmojis = new List <MyEmoji>(); AllGroup = new List <string>(); AllEmojis = MyFiles.ReadLocalEmoji(); if (null == AllEmojis || 0 == AllEmojis.Count) { return; } foreach (var emoji in AllEmojis) { if (!AllGroup.Contains(emoji.Group)) { AllGroup.Add(emoji.Group); } } }
public static void GetDic() { AllDic = new Dictionary <string, string>(); AllKey = new List <string>(); AllDic = MyFiles.ReadLocalTrans(); if (null == AllDic || 0 == AllDic.Count) { return; } foreach (var key in AllDic.Keys) { AllKey.Add(key); } //按字符长短排序,先替换掉长字符 AllKey.Sort((k1, k2) => k1.Length - k2.Length); AllKey.Reverse(); }
/// <summary> /// 从json得到trans数据 /// </summary> private static Dictionary <string, string> GetTransResult() { string json = GetJson(BaseUrl + "/emoji/direct"); if (!json.StartsWith("{")) { return(null); } try { JavaScriptSerializer serializer = new JavaScriptSerializer(); MyFiles.WriteLocalTrans(json); var myresult = serializer.Deserialize <Dictionary <string, string> >(json); return(myresult); } catch { return(null); } }
/// <summary> /// 从json得到result数据 /// </summary> private static List <MyEmoji> GetEmojiResult() { string json = GetJson(BaseUrl + "/emoji"); if (!json.StartsWith("[")) { return(null); } try { JavaScriptSerializer serializer = new JavaScriptSerializer(); MyFiles.WriteLocalEmoji(json); var myresult = serializer.Deserialize <List <MyEmoji> >(json); return(myresult); } catch { return(null); } }