首页 > 其他分享 >CSharp: emojione

CSharp: emojione

时间:2023-01-25 00:33:33浏览次数:44  
标签:UserName string emojione time UserImage ms CSharp Message

 

        /// <summary>
        /// mysql 数据库用编码类型 utf8mb4
        /// 向sqlserver 数据库插入emoji 表情包
        /// 插入emoji 的数据时,值value 需要添加 N‘xxx’ 否则乱码
        /// https://github.com/macroplant2/emojione-cs
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="message"></param>
        /// <param name="time"></param>
        /// <param name="UserImg"></param>
        private void AddMessageinCache(string userName, string message, string time, string UserImg)
        {
            //CurrentMessage.Add(new Messages { UserName = userName, Message = message, Time = time, UserImage = UserImg });
            Messages ms = new Messages { UserName = userName, Message = message, Time = time, UserImage = UserImg };
            CurrentMessage.Add(ms);
            DateTime t = DateTime.Parse(time);// DateTime.ParseExact(time, nformat, CultureInfo.InvariantCulture);
            //string Query = "insert into DuMessages(UserName,[Message],[Time],UserImage) values('" + ms.UserName + "','" + System.Web.HttpUtility.UrlEncode(ms.Message, System.Text.Encoding.UTF8) + "','" + t + "','" + ms.UserImage + "')";
            string Query = "insert into DuMessages(UserName,[Message],[Time],UserImage) values(N'" + ms.UserName + "',N'" + ms.Message + "','" + t + "','" + ms.UserImage + "')";
            //这里可以增加聊天记录至数据库
            if (ConnC.ExecuteQuery(Query))
            {
            }
            if (CurrentMessage.Count > 100)
                CurrentMessage.RemoveAt(0);

        }

  

 

 

 

 

标签:UserName,string,emojione,time,UserImage,ms,CSharp,Message
From: https://www.cnblogs.com/geovindu/p/17066580.html

相关文章