protected static MsgTalkMessage json2MsgSummaryNews(ResLpsSummaryNews2Json rlsn2) { //結果メッセージを作成 MsgTalkMessage msg = new MsgTalkMessage(); //リザルトSB StringBuilder sbResult = new StringBuilder(); //ネームリスト、等作成 foreach (string desc in rlsn2.descriptionList) { //ネームリストに追記 msg.createList(desc); //全文章追記 sbResult.Append(msg.result); } //最後のあっとまーくを除去する if (msg.nameList.Count > 0) { if (msg.nameList[msg.nameList.Count - 1] == "@") { int targetIndex = msg.nameList.Count - 1; msg.nameList.RemoveAt(targetIndex); msg.emotionList.RemoveAt(targetIndex); msg.pointList.RemoveAt(targetIndex); } } //EOSの除去 string result = sbResult.ToString().Replace("EOS", ""); //結果をメッセージに格納 msg.url = LpsLiplisUtil.nullCheck(rlsn2.url); msg.title = LpsLiplisUtil.nullCheck(rlsn2.title); msg.result = result; msg.sorce = result; msg.jpgUrl = ""; msg.calcNewsEmotion(); ///jpgURLのセット if (rlsn2.jpgUrl != null) { if (!rlsn2.jpgUrl.Equals("")) { msg.jpgUrl = rlsn2.jpgUrl; } } return(msg); }
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); }