From aa3f4c74dcddca1277dc7cf8b83c4c786a12cc5b Mon Sep 17 00:00:00 2001
From: Jonathan Li <jonathan.li@hotmail.co.uk>
Date: Wed, 16 Dec 2015 19:39:40 +0000
Subject: [PATCH] GSDumpGUI: Add png image display support

---
 tools/GSDumpGUI/Forms/frmMain.cs | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/tools/GSDumpGUI/Forms/frmMain.cs b/tools/GSDumpGUI/Forms/frmMain.cs
index 2fa5c8aeab..12a9dfc43c 100644
--- a/tools/GSDumpGUI/Forms/frmMain.cs
+++ b/tools/GSDumpGUI/Forms/frmMain.cs
@@ -293,19 +293,22 @@ namespace GSDumpGUI
         {
             if (lstDumps.SelectedIndex != -1)
             {
+                String [] Extensions = new String[] { ".png", ".bmp" };
                 String DumpFileName = lstDumps.SelectedItem.ToString().Split(new char[] { '|' })[0];
                 String Filename = Path.GetDirectoryName(Properties.Settings.Default.DumpDir + "\\") + 
-                                  "\\" + Path.GetFileNameWithoutExtension(DumpFileName) + ".bmp";
-                if (File.Exists(Filename))
+                                  "\\" + Path.GetFileNameWithoutExtension(DumpFileName);
+
+                foreach (String Extension in Extensions)
                 {
-                    pctBox.Image = Image.FromFile(Filename);
-                    pctBox.Cursor = Cursors.Hand;
-                }
-                else
-                {
-                    pctBox.Image = NoImage;
-                    pctBox.Cursor = Cursors.Default;
+                    if (File.Exists(Filename + Extension))
+                    {
+                        pctBox.Load(Filename + Extension);
+                        pctBox.Cursor = Cursors.Hand;
+                        return;
+                    }
                 }
+                pctBox.Image = NoImage;
+                pctBox.Cursor = Cursors.Default;
             }
         }
 
@@ -313,10 +316,7 @@ namespace GSDumpGUI
         {
             if (pctBox.Cursor == Cursors.Hand)
             {
-                String DumpFileName = lstDumps.SelectedItem.ToString().Split(new char[] { '|' })[0];
-                String Filename = Path.GetDirectoryName(Properties.Settings.Default.DumpDir + "\\") +
-                                  "\\" + Path.GetFileNameWithoutExtension(DumpFileName) + ".bmp";
-                Process.Start(Filename);
+                Process.Start(pctBox.ImageLocation);
             }
         }