Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        private void buttonZhubang_Click(object sender, EventArgs e)
        {
            List <BiliInterfaceInfo> linfo = new List <BiliInterfaceInfo>();
            int end = int.Parse(textBoxZhubangEnd.Text);

            foreach (BiliInterfaceInfo i in (List <BiliInterfaceInfo>)dataGridViewRAW.DataSource)
            {
                if (i.Fpaiming <= end)
                {
                    linfo.Add(i);
                }
            }

            Zhubang zhu = new Zhubang();

            zhu.Gen(linfo);
        }
Exemplo n.º 3
0
        private void buttenGen_Click(object sender, RoutedEventArgs e)
        {
            BiliInterfaceInfo bi = new BiliInterfaceInfo()
            {
                AVNUM        = "AV10830407",
                title        = "【星尘二专收录曲】D!scolor【PV】",
                play         = 61531,
                video_review = 683,
                coins        = 2784,
                favorites    = 5386,
                review       = 806,
                share        = 261,
                Fdefen       = 390014,
                author       = "星尘Official",
                created_at   = "2017/05/26 10:12",
                aid          = 10830407,
                tag          = "",
                Fpaiming     = 1
            };

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