ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/RomCheater/trunk/RomCheater.PluginFramework/Core/ProcContainer.cs
(Generate patch)

Comparing trunk/RomCheater.PluginFramework/Core/ProcContainer.cs (file contents):
Revision 106 by william, Thu May 10 10:53:07 2012 UTC vs.
Revision 107 by william, Thu May 10 11:16:03 2012 UTC

--- trunk/RomCheater.PluginFramework/Core/ProcContainer.cs	2012/05/10 11:15:23	106
+++ trunk/RomCheater.PluginFramework/Core/ProcContainer.cs	2012/05/10 11:16:03	107
@@ -68,38 +68,76 @@ namespace RomCheater.PluginFramework.Cor
         public static Bitmap CreateIconFromProcess(ProcContainer proc)
         {
             if (proc == null) return null;
-            return Icon.ExtractAssociatedIcon(proc.FileName).ToBitmap();
+            Icon large = ProcessIconEx.ExtractIConFromFile(proc.FileName, true);
+            if (large == null) large = ProcessIconEx.ExtractIConFromFile(proc.FileName, false);
+            Bitmap ret = large.ToBitmap();
+            if (ret == null)
+            {
+                int i = 0;
+            }
+            return ret;
         }
         public static Bitmap CreateIconFromProcess(ProcContainer proc, int Scale)
         {
             if (proc == null) return null;
-            Bitmap ret = Icon.ExtractAssociatedIcon(proc.FileName).ToBitmap();
+            Icon large = ProcessIconEx.ExtractIConFromFile(proc.FileName, true);
+            if (large == null) large = ProcessIconEx.ExtractIConFromFile(proc.FileName, false);
+            Bitmap ret = large.ToBitmap();
+            if (ret == null)
+            {
+                int i = 0;
+            }
             ret = new Bitmap(ret, ret.Width * Scale, ret.Height * Scale);
             return ret;
         }
         public static Bitmap CreateIconFromProcess(ProcContainer proc, int Width, int Height)
         {
             if (proc == null) return null;
-            Bitmap ret = Icon.ExtractAssociatedIcon(proc.FileName).ToBitmap();
+            Icon large = ProcessIconEx.ExtractIConFromFile(proc.FileName, true);
+            if (large == null) large = ProcessIconEx.ExtractIConFromFile(proc.FileName, false);
+            Bitmap ret = large.ToBitmap();
+            if (ret == null)
+            {
+                int i = 0;
+            }
             ret = new Bitmap(ret, Width, Height);
             return ret;
         }
         private void CreateProcessIcon()
         {
             if (this.ProcessInfo == null) return;
-            this.ProcessIcon = Icon.ExtractAssociatedIcon(this.FileName).ToBitmap();
+            Icon large = ProcessIconEx.ExtractIConFromFile(this.FileName, true);
+            if (large == null) large = ProcessIconEx.ExtractIConFromFile(this.FileName, false);
+            Bitmap ret = large.ToBitmap();
+            if (ret == null)
+            {
+                int i = 0;
+            }
+            this.ProcessIcon = ret;
         }
         private void CreateProcessIcon(int Scale)
         {
-            Bitmap ret = Icon.ExtractAssociatedIcon(this.FileName).ToBitmap();
-            ret = new Bitmap(ret, ret.Width * Scale, ret.Height * Scale);
+            Icon large = ProcessIconEx.ExtractIConFromFile(this.FileName, true);
+            if (large == null) large = ProcessIconEx.ExtractIConFromFile(this.FileName, false);
+            Bitmap ret = large.ToBitmap();
+            if (ret == null)
+            {
+                int i = 0;
+            }
+            ret = new Bitmap(ret, ret.Width * Scale, ret.Height * Scale);           
             this.ProcessIcon = ret;
         }
         private void CreateProcessIcon(int Width, int Height)
         {
             if (this.ProcessInfo == null) return;
-            Bitmap ret = Icon.ExtractAssociatedIcon(this.FileName).ToBitmap();
-            ret = new Bitmap(ret, Width, Height);
+            Icon large = ProcessIconEx.ExtractIConFromFile(this.FileName, true);
+            if (large == null) large = ProcessIconEx.ExtractIConFromFile(this.FileName, false);
+            Bitmap ret = large.ToBitmap();
+            if (ret == null)
+            {
+                int i = 0;
+            }
+            ret = new Bitmap(ret, Width, Height);     
             this.ProcessIcon = ret;
         }
     }