/[RomCheater]/trunk/RomCheater.PluginFramework/Core/ProcContainer.cs
ViewVC logotype

Diff of /trunk/RomCheater.PluginFramework/Core/ProcContainer.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- 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 @@
         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;
         }
     }

 

  ViewVC Help
Powered by ViewVC 1.1.22