private void buttenGen_Click(object sender, RoutedEventArgs e) { BiliInterfaceInfo bi = BiliInterface.GetInfo(textBoxAv.Text); BiliInterface.GetFace(bi); BiliInterface.GetPic(bi); //text|font|ptSize|#colorcode|RightAlign TrueOrFalse|pointX|pointY|rectX|rectY|rectWidth|rectHeight|AutoOffsetY TrueOrFalse|MaxWidth List <TemplateInfo> tis = new List <TemplateInfo>(); string text = textBoxInfo.Text; text = Fubang.DoReplace(text, bi); var lines = Regex.Split(text, "\r\n|\r|\n"); foreach (string line in lines) { if (string.IsNullOrEmpty(line)) { continue; } var cells = Regex.Split(line, "[|]"); TemplateInfo ti = new TemplateInfo() { text = cells[0], font = new Font(cells[1], Convert.ToSingle(cells[2]), GraphicsUnit.Point), brush = new SolidBrush(ColorTranslator.FromHtml(cells[3])), isRightAlign = bool.Parse(cells[4]) }; if (!ti.isRightAlign) { ti.point = new PointF(Convert.ToSingle(cells[5]), Convert.ToSingle(cells[6])); } else { ti.rectangle = new RectangleF(Convert.ToSingle(cells[7]), Convert.ToSingle(cells[8]), Convert.ToSingle(cells[9]), Convert.ToSingle(cells[10])); } if (cells.Length >= 12) { ti.autoOffsetY = bool.Parse(cells[11]); } if (cells.Length >= 13) { ti.maxWidth = Convert.ToSingle(cells[12]); } tis.Add(ti); } Zhubang zb = new Zhubang(); System.Drawing.Image re; if (bgimg == null) { re = zb.GenStardustTemplate(tis); } else { re = zb.GenWithTemplate((System.Drawing.Image)bgimg.Clone(), tis); } imageMain.Source = ConvertDrawingImage2MediaImageSource(re); }
private void buttonDlFace_Click(object sender, RoutedEventArgs e) { foreach (BiliInterfaceInfo i in (List <BiliInterfaceInfo>)SharedData.Infos) { BiliInterface.GetFace(i); } }