예제 #1
0
파일: CBStatement.cs 프로젝트: zsea/QnPg
        public static CBStatement DeeplyCopy(CBStatement cbstatement)
        {
            CBStatement cBStatement = new CBStatement();

            cBStatement.Time      = cbstatement.Time;
            cBStatement.goodsname = cbstatement.goodsname;
            cBStatement.Speaker   = cbstatement.Speaker;
            for (int i = 0; i < cbstatement.Lines.Count; i++)
            {
                cBStatement.Lines.Add(cbstatement.Lines[i]);
            }
            return(cBStatement);
        }
예제 #2
0
 public ChatRecord(List <CBStatement> cbslist, string seller)
 {
     this.Statements = cbslist;
     this._Seller    = seller;
     if (cbslist != null && cbslist.Count > 0)
     {
         for (int i = cbslist.Count - 1; i >= 0; i--)
         {
             CBStatement cBStatement = cbslist[i];
             if (cBStatement.SpeakerRole == CBStatement.Role.Guest)
             {
                 this.Speaker = cBStatement.Speaker;
                 break;
             }
         }
     }
 }
예제 #3
0
        private CBStatement CreateCBStatement(HtmlNode htmlNode)
        {
            CBStatement cbs = null;

            for (int i = 0; i < 2; i++)
            {
                try
                {
                    string   value       = htmlNode.Attributes["data-time"].Value;
                    DateTime time        = ChatRecordParser.TimeSpanToDateTime(Convert.ToInt64(value));
                    string   nick        = htmlNode.Attributes["data-nick"].Value;
                    bool     isSellerMsg = htmlNode.Attributes["class"].Value.Contains("imui-msg-r");
                    htmlNode.Attributes["class"].Value.Contains("imui-msg-l");
                    CBStatement.Role role;
                    if (isSellerMsg)
                    {
                        role = CBStatement.Role.Self;
                    }
                    else
                    {
                        role = CBStatement.Role.Guest;
                    }
                    HtmlNode htmlNode_ = htmlNode.SelectSingleNode(".//div[contains(@class,'msg-body-html')]");
                    string   chatmsg   = this.GetChatContent(htmlNode_);
                    cbs = new CBStatement(nick, chatmsg, time, role);
                    return(cbs);
                }
                catch (OutOfMemoryException ex)
                {
                    GC.Collect();
                }
                catch (Exception ex2)
                {
                }
            }
            return(cbs);
        }