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); }
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; } } } }
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); }