Exemple #1
0
        private void btSave_Click(object sender, EventArgs e)
        {
            if (null != slLogger)
            {
                slLogger.Trace(">> Save PNG Click");
            }
            if (!String.IsNullOrEmpty(_currentFilePathImg))
            {
                String sFileName = _currentFilePathImg;
                try
                {
                    pbCover.Image.Save(sFileName, ImageFormat.Png);

                    _currentFilePathImg     = sFileName;
                    lbCurrentPngFile.Text   = _currentFilePathImg;
                    btSave.Enabled          = true;
                    btPictureReload.Enabled = true;

                    MyProcessHelper pPngQuant = new MyProcessHelper(Application.StartupPath + "\\pngquant\\pngquant.exe", sFileName + " --force --ext .png --verbose");
                    pPngQuant.DoIt();
                    // pngquant "test/1.png" "test1/1.png" --force --ext .png --verbose

                    if (null == newGame)
                    {
                        newGame = new ClGameStructure("", true, true);
                    }
                    newGame.PngMissing = false;
                    newGame.setPicture(sFileName, (Image)(new Bitmap(pbCover.Image)));
                }
                catch (Exception ex)
                {
                    if (null != slLogger)
                    {
                        slLogger.Fatal(ex.Message);
                    }
                }
            }
            if (null != slLogger)
            {
                slLogger.Trace("<< Save PNG Click");
            }
        }
Exemple #2
0
        private void btSaveAs_Click(object sender, EventArgs e)
        {
            if (null != slLogger)
            {
                slLogger.Trace(">> Save as PNG Click");
            }
            if (Directory.Exists(_folderPath))
            {
                sfdGeneSaveImage.InitialDirectory = _folderPath;
            }
            String sDefFile = "Game.png";

            if (null == newGame)
            {
            }
            else
            {
                if (!String.IsNullOrEmpty(newGame.PictureFileName))
                {
                    sDefFile = newGame.PictureFileName;
                    sfdGeneSaveImage.FileName = sDefFile;
                }
                else
                if (!String.IsNullOrEmpty(newGame.Discs))
                {
                    sDefFile = newGame.Discs.Split(',')[0] + ".png";
                    sfdGeneSaveImage.FileName = sDefFile;
                }
            }
            if (DialogResult.OK == sfdGeneSaveImage.ShowDialog())
            {
                String sFileName = sfdGeneSaveImage.FileName;
                try
                {
                    pbCover.Image.Save(sFileName, ImageFormat.Png);

                    _currentFilePathImg     = sFileName;
                    lbCurrentPngFile.Text   = _currentFilePathImg;
                    btSave.Enabled          = true;
                    btPictureReload.Enabled = true;

                    MyProcessHelper pPngQuant = new MyProcessHelper(Application.StartupPath + "\\pngquant\\pngquant.exe", sFileName + " --force --ext .png --verbose");
                    pPngQuant.DoIt();

                    if (null == newGame)
                    {
                        newGame = new ClGameStructure("", true, true);
                    }
                    newGame.PngMissing = false;
                    newGame.setPicture(sFileName, (Image)(new Bitmap(pbCover.Image)));
                }
                catch (Exception ex)
                {
                    if (null != slLogger)
                    {
                        slLogger.Fatal(ex.Message);
                    }
                }
            }
            // pngquant "test/1.png" "test1/1.png" --force --ext .png --verbose

            if (null != slLogger)
            {
                slLogger.Trace("<< Save as PNG Click");
            }
        }