예제 #1
0
        protected static MsgShortNews convertRlSumNjToMsg(ResLpsSummaryNews2Json rlsn2)
        {
            //ディスクリプションチェック
            if (rlsn2.descriptionList.Count < 1)
            {
                return FctLiplisMsg.createMsgMassageDlFaild();
            }

            //結果メッセージを作成
            MsgShortNews msg = new MsgShortNews();

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

            //ネームリスト、等作成
            foreach (string desc in rlsn2.descriptionList)
            {
                try
                {
                    string[] bufList = desc.Split(';');

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

                        if (bufList2.Length == 3)
                        {
                            msg.nameList.Add(bufList2[0]);
                            msg.emotionList.Add(int.Parse(bufList2[1]));
                            msg.pointList.Add(int.Parse(bufList2[2]));
                            sbResult.Append(bufList2[0]);
                        }
                        else
                        {

                        }
                    }
                }
                catch
                {

                }
            }

            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.calcNewsEmotion();

            ///jpgのダウンロード
            if (rlsn2.jpgUrl != null && !rlsn2.jpgUrl.Equals(""))
            {
                msg.jpgUrl = LiplisWedFileDownLoader.downLoadthumb(rlsn2.jpgUrl);
            }
            else
            {
                msg.jpgUrl = "";
            }

            return msg;
        }
예제 #2
0
        private static MsgShortNews convertRlShtNjToMsg(ResLpsShortNews2Json rlsn2)
        {
            //結果メッセージを作成
            MsgShortNews msg = new MsgShortNews();

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

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

            foreach (string buf in bufList)
            {
                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]);
            }

            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;
        }
예제 #3
0
        protected MsgShortNews convertRlSumNjToMsg(ResLpsChatResponse rlsn2)
        {
            //ディスクリプションチェック
            if (rlsn2 == null || rlsn2.descriptionList.Count < 1)
            {
                return lips.getOlc().getChatWord("noreply");
            }

            //結果メッセージを作成
            MsgShortNews msg = new MsgShortNews();

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

            //ネームリスト、等作成
            foreach (string desc in rlsn2.descriptionList)
            {
                try
                {
                    string[] bufList = desc.Split(';');

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

                        if (bufList2.Length == 3)
                        {
                            msg.nameList.Add(bufList2[0]);
                            msg.emotionList.Add(int.Parse(bufList2[1]));
                            msg.pointList.Add(int.Parse(bufList2[2]));
                            sbResult.Append(bufList2[0]);
                        }
                        else
                        {

                        }
                    }
                }
                catch
                {

                }
            }

            //データの作成
            msg.result = sbResult.ToString();
            msg.sorce = sbResult.ToString();
            msg.title = "";

            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.calcNewsEmotion();

            //
            if(rlsn2.opList.Count == 2)
            {
                this.context = rlsn2.opList[0];
                this.mode = rlsn2.opList[1];
            }

            return msg;
        }