Exemple #1
0
        public static void Output(string outputDir)
        {
            var fdatas = FaceDataHelper.GetFaceDatas();
            var outputThumbFaceDatas = new List <FaceData>();

            foreach (var fdata in fdatas)
            {
                if (fdata.IsCustomed)
                {
                    CopyFile(fdata.Path13, fdata.Filename13, outputDir);
                    CopyFile(fdata.Path18, fdata.Filename18, outputDir);
                    CopyFile(fdata.Path20, fdata.Filename20, outputDir);
                    CopyFile(fdata.Path81, fdata.Filename81, outputDir);
                    CopyFile(fdata.Path82, fdata.Filename82, outputDir);
                    CopyFile(fdata.Path83, fdata.Filename83, outputDir);
                    if (string.IsNullOrEmpty(fdata.Path22) == false)
                    {
                        outputThumbFaceDatas.Add(fdata);
                    }
                }
            }

            if (outputThumbFaceDatas.Count > 0)
            {
                Dictionary <int, Image> drawImageCache = new Dictionary <int, Image>();
                List <int> pageChanged = new List <int>();
                foreach (var fdata in outputThumbFaceDatas)
                {
                    var pageno = fdata.PageInThumb;
                    if (drawImageCache.Keys.Contains(pageno) == false)
                    {
                        drawImageCache[fdata.PageInThumb] = new Bitmap(ThumbHelper.GetThumbPageImage(fdata.PageInThumb));
                    }
                    var g    = Graphics.FromImage(drawImageCache[pageno]);
                    var simg = Bitmap.FromFile(fdata.Path22);
                    g.DrawImage(simg,
                                new Rectangle(
                                    fdata.XPosInThumb * ThumbHelper.BLOCK_WIDTH,
                                    fdata.YPosInThumb * ThumbHelper.BLOCK_HEIGHT,
                                    ThumbHelper.BLOCK_WIDTH,
                                    ThumbHelper.BLOCK_HEIGHT),
                                new Rectangle(0, 0, ThumbHelper.BLOCK_WIDTH, ThumbHelper.BLOCK_HEIGHT),
                                GraphicsUnit.Pixel);
                    g.Dispose();
                    if (pageChanged.Contains(pageno) == false)
                    {
                        pageChanged.Add(pageno);
                    }
                }
                foreach (var pageno in pageChanged)
                {
                    SaveImage(drawImageCache[pageno], "00000022_0000" + pageno + ".bmp", outputDir);
                }
            }
            FaceDataHelper.SaveMyData();
        }
Exemple #2
0
        private void btnReset_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("是否重置全部修改", "重置", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) != DialogResult.Yes)
            {
                return;
            }

            foreach (var pnl in this.flowPanels)
            {
                foreach (Control ctrl in pnl.Controls)
                {
                    if (ctrl is Button && ctrl.Tag is FaceData)
                    {
                        var btn   = ctrl as Button;
                        var fdata = btn.Tag as FaceData;
                        this.ResetFaceData(fdata);
                        this.ButtonBindFaceData(btn, fdata);
                    }
                }
            }
            FaceDataHelper.SaveMyData();
        }
Exemple #3
0
 private void Form1_FormClosed(object sender, FormClosedEventArgs e)
 {
     FaceDataHelper.SaveMyData();
 }