From 1282428453ff4f85e4cdfa4766ff94d9a792c1b2 Mon Sep 17 00:00:00 2001 From: Nathan Crawford Date: Tue, 22 Jan 2008 02:52:26 +0000 Subject: [PATCH] Added commandline switch for generating images instead of debug info. --- embroideryInfo/Program.cs | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/embroideryInfo/Program.cs b/embroideryInfo/Program.cs index 9729651..97601c5 100644 --- a/embroideryInfo/Program.cs +++ b/embroideryInfo/Program.cs @@ -13,16 +13,23 @@ namespace embroideryInfo { try { - PesFile.PesFile design = new PesFile.PesFile(args[0]); - design.saveDebugInfo(); - //Bitmap DrawArea = design.designToBitmap(5); - //Bitmap temp = new Bitmap(DrawArea.Width, DrawArea.Height, System.Drawing.Imaging.PixelFormat.Format24bppRgb); - //Graphics tempGraph = Graphics.FromImage(temp); - //tempGraph.FillRectangle(Brushes.White, 0, 0, temp.Width, temp.Height); - //tempGraph.DrawImageUnscaled(DrawArea, 0, 0); - //tempGraph.Dispose(); - //temp.Save(args[0] + ".png"); + if (args[0] == "--image" && args.Length > 1) + { + PesFile.PesFile design = new PesFile.PesFile(args[1]); + Bitmap DrawArea = design.designToBitmap(5); + Bitmap temp = new Bitmap(DrawArea.Width, DrawArea.Height, System.Drawing.Imaging.PixelFormat.Format24bppRgb); + Graphics tempGraph = Graphics.FromImage(temp); + tempGraph.FillRectangle(Brushes.White, 0, 0, temp.Width, temp.Height); + tempGraph.DrawImageUnscaled(DrawArea, 0, 0); + tempGraph.Dispose(); + temp.Save(System.IO.Path.ChangeExtension(args[1], ".png")); + } + else + { + PesFile.PesFile design = new PesFile.PesFile(args[0]); + design.saveDebugInfo(); + } } catch (Exception ex) {