/* 根据表情符号查询表情图片 */ public string GetMsgFacePicture(string symbol) { msgface mf = new msgface(); if (File.Exists(MSG_FACE_XML)) { mf.ReadXml(MSG_FACE_XML); } foreach (msgface.msg_faceRow row in mf.msg_face) { if (row.symbol.Equals(symbol)) { return(row.picture); } } return(""); }
/* 读取表情列表 */ public List <MsgFace> GetMsgFaceList() { List <MsgFace> facelist = new List <MsgFace>(); msgface mf = new msgface(); if (File.Exists(MSG_FACE_XML)) { mf.ReadXml(MSG_FACE_XML); } foreach (msgface.msg_faceRow row in mf.msg_face) { MsgFace item = new MsgFace(); item.face_symbol = row.symbol; item.face_picture = row.picture; item.face_desc = row.description; facelist.Add(item); } return(facelist); }
/* 初始化表情列表,当前不支持增加表情 */ private void InitMsgFaceList() { if (!File.Exists(MSG_FACE_XML)) { string[] symbols = { ":-)", ":-<", ":-D", "-(", ";-)", ":-0", "%-)", "|-P", ":-(", ":-()", "<@_@>", "^-^", "?_?", "~zZ" }; string[] descriptions = { "微笑", "苦笑", "大笑", "痛苦", "抛媚眼", "惊讶", "大跌眼镜", "捧腹大笑", "生气", "震惊", "晕", "害羞", "疑惑", "痛哭" }; string[] pictures = { "mantou_005.png", "mantou_001.png", "mantou_004.png", "mantou_016.png", "mantou_015.png", "mantou_009.png", "mantou_013.png", "mantou_010.png", "mantou_018.png", "mantou_003.png", "mantou_020.png", "mantou_006.png", "mantou_012.png", "mantou_017.png" }; msgface mf = new msgface(); for (int i = 0; i < symbols.Length; i++) { mf.msg_face.Addmsg_faceRow(symbols[i], pictures[i], descriptions[i]); } mf.WriteXml(MSG_FACE_XML); } }