Exemplo n.º 1
0
        protected static MsgTalkMessage json2MsgShortNews(ResLpsShortNews2Json rlsn2)
        {
            //結果メッセージを作成
            MsgTalkMessage msg = new MsgTalkMessage();

            //リザルトSB
            StringBuilder sbResult = new StringBuilder();

            //ネームリスト、等作成
            string[] bufList = rlsn2.result.Split(';');

            foreach (string buf in bufList)
            {
                try
                {
                    string[] bufList2 = buf.Split(',');

                    if (buf.Length < 3)
                    {
                        break;
                    }

                    msg.nameList.Add(bufList2[0]);
                    msg.emotionList.Add(int.Parse(bufList2[1]));
                    msg.pointList.Add(int.Parse(bufList2[2]));
                    sbResult.Append(bufList2[0]);
                }
                catch
                {
                }
            }

            string result = sbResult.ToString().Replace("EOS", "");

            //結果をメッセージに格納
            msg.url    = rlsn2.url;
            msg.title  = result;
            msg.result = result;
            msg.sorce  = result;
            msg.calcNewsEmotion();
            msg.jpgUrl = "";

            return(msg);
        }
Exemplo n.º 2
0
        public static MsgTalkMessage getShortNews(string uid, string toneUrl, string newsFlg)
        {
            MsgTalkMessage msg = new MsgTalkMessage();

            try
            {
                NameValueCollection ps = new NameValueCollection();
                ps.Add("tone", toneUrl);                //TONE_URLの指定
                ps.Add("newsFlg", newsFlg);             //NEWS_FLGの指定

                //Jsonで結果取得
                string jsonText = HttpPost.sendPost(LpsDefine.LIPLIS_API_SHORT_NEWS, ps);

                //APIの結果受け取り用クラス
                ResLpsShortNews2Json result = JsonConvert.DeserializeObject <ResLpsShortNews2Json>(jsonText);

                //結果を返す
                return(LiplisNewsJpJson.getShortNews(result));
            }
            catch
            {
                return(msg);
            }
        }
Exemplo n.º 3
0
 public static MsgTalkMessage getShortNews(ResLpsShortNews2Json rlsn2)
 {
     return(json2MsgShortNews(rlsn2));
 }