public void ParseElement(XmlNode node) { while (true) { if (node.NodeType != XmlNodeType.Element) { break; } XmlElement elem = (XmlElement)node; if (elem.Name == "chat") { string text = elem.InnerText; string vposstr = elem.GetAttribute("vpos"); if (vposstr == null) { break; } string mailstr = elem.GetAttribute("mail"); NicoComment comment = new NicoComment(); comment.Text = text; comment.VPos = Int64.Parse(vposstr); comment.TextColor = Color.FromRgb(0xff, 0xff, 0xff); comment.PosGroup = PosGroupType.Normal; comment.FontSize = SizeModel.normalSize; if (mailstr != null) { string[] splited = mailstr.Split(); foreach (string mail in splited) { if (mail == "184") { continue; } if (mail.StartsWith("#")) { comment.TextColor = (Color)ColorConverter.ConvertFromString(mail); } else { PosGroupType posType = PosGroupModel.GetPosGroupFromString(mail); if (posType != PosGroupType.None) { comment.PosGroup = posType; continue; } double fontSize = SizeModel.GetSizeTypeFromString(mail); if (fontSize > 0) { comment.FontSize = fontSize; continue; } Color col = ColorTypeModel.GetColorFromString(mail); if (col != invalidColor) { comment.TextColor = col; continue; } } } } comments.Add(comment); break; } break; } if (node.HasChildNodes) { foreach (XmlNode child in node.ChildNodes) { ParseElement(child); } } }
public void SetByNicoComment(NicoComment config) { this.Text = config.Text; this.Fill = new SolidColorBrush(config.TextColor); _posGroup = config.PosGroup; this.FontFamily = new FontFamily("MS PGothic"); this.FontSize = config.FontSize; this.FontWeight = FontWeights.UltraBold; this.TextTrimming = System.Windows.TextTrimming.None; this.TextWrapping = System.Windows.TextWrapping.NoWrap; // this->adjustSize(); // this->setAttribute(Qt::WA_TranslucentBackground); this.initReady(); }