Beispiel #1
0
        /// <summary>
        /// リストを生成する
        /// </summary>
        /// <param name="sentenceData"></param>
        public void createList(string sentenceData)
        {
            StringBuilder sbSource = new StringBuilder();

            //コロン分解
            foreach (var parts in sentenceData.Split(';'))
            {
                try
                {
                    //コンマ分解
                    string[] buf = parts.Split(',');

                    //文末が来たら抜ける
                    if (buf[0] == "EOS")
                    {
                        break;
                    }

                    nameList.Add(buf[0]);
                    sbSource.Append(buf[0]);
                    emotionList.Add(LpsLiplisUtil.stringToInt(buf[1]));
                    pointList.Add(LpsLiplisUtil.stringToInt(buf[2]));
                }
                catch
                {
                }
            }

            result = sbSource.ToString();
            sorce  = sbSource.ToString();
            title  = sbSource.ToString();
        }
Beispiel #2
0
        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);
        }