/[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:31:05	108
+++ trunk/RomCheater.PluginFramework/Core/ProcContainer.cs	2012/05/10 12:12:26	109
@@ -70,10 +70,12 @@
             if (proc == null) return null;
             Icon large = ProcessIconEx.ExtractIConFromFile(proc.FileName, true);
             if (large == null) large = ProcessIconEx.ExtractIConFromFile(proc.FileName, false);
-            Bitmap ret = large.ToBitmap();
+            Bitmap ret = null;
+            if (large != null)
+                ret = large.ToBitmap();
             if (ret == null)
             {
-                int i = 0;
+                return null;
             }
             return ret;
         }
@@ -82,10 +84,12 @@
             if (proc == null) return null;
             Icon large = ProcessIconEx.ExtractIConFromFile(proc.FileName, true);
             if (large == null) large = ProcessIconEx.ExtractIConFromFile(proc.FileName, false);
-            Bitmap ret = large.ToBitmap();
+            Bitmap ret = null;
+            if (large != null)
+                ret = large.ToBitmap();
             if (ret == null)
             {
-                int i = 0;
+                return null;
             }
             ret = new Bitmap(ret, ret.Width * Scale, ret.Height * Scale);
             return ret;
@@ -95,10 +99,12 @@
             if (proc == null) return null;
             Icon large = ProcessIconEx.ExtractIConFromFile(proc.FileName, true);
             if (large == null) large = ProcessIconEx.ExtractIConFromFile(proc.FileName, false);
-            Bitmap ret = large.ToBitmap();
+            Bitmap ret = null;
+            if (large != null)
+                ret = large.ToBitmap();
             if (ret == null)
             {
-                int i = 0;
+                return null;
             }
             ret = new Bitmap(ret, Width, Height);
             return ret;
@@ -108,23 +114,36 @@
             if (this.ProcessInfo == null) return;
             Icon large = ProcessIconEx.ExtractIConFromFile(this.FileName, true);
             if (large == null) large = ProcessIconEx.ExtractIConFromFile(this.FileName, false);
-            Bitmap ret = large.ToBitmap();
+            Bitmap ret = null;
+            if (large != null)
+                ret = large.ToBitmap();
             if (ret == null)
             {
-                int i = 0;
+                this.ProcessIcon = null;
+                return;
             }
             this.ProcessIcon = ret;
         }
         private void CreateProcessIcon(int Scale)
         {
+            if (this.ProcessInfo == null) return;
             Icon large = ProcessIconEx.ExtractIConFromFile(this.FileName, true);
             if (large == null) large = ProcessIconEx.ExtractIConFromFile(this.FileName, false);
-            Bitmap ret = large.ToBitmap();
+            Bitmap ret = null;
+            if (large != null)
+                ret = large.ToBitmap();
             if (ret == null)
             {
-                int i = 0;
-            }
-            ret = new Bitmap(ret, ret.Width * Scale, ret.Height * Scale);           
+                this.ProcessIcon = null;
+                return;
+            }
+            ////Bitmap bmp = large.ToBitmap();
+            //string save_path = @"c:\temp";
+            //string icon_file = string.Format(@"{0}\{1}.bmp", save_path, new FileInfo(this.FileName).Name);
+           
+
+            ret = new Bitmap(ret, ret.Width * Scale, ret.Height * Scale);
+            //ret.Save(icon_file, System.Drawing.Imaging.ImageFormat.Bmp);
             this.ProcessIcon = ret;
         }
         private void CreateProcessIcon(int Width, int Height)
@@ -132,10 +151,13 @@
             if (this.ProcessInfo == null) return;
             Icon large = ProcessIconEx.ExtractIConFromFile(this.FileName, true);
             if (large == null) large = ProcessIconEx.ExtractIConFromFile(this.FileName, false);
-            Bitmap ret = large.ToBitmap();
+            Bitmap ret = null;
+            if (large != null)
+                ret = large.ToBitmap();
             if (ret == null)
             {
-                int i = 0;
+                this.ProcessIcon = null;
+                return;
             }
             ret = new Bitmap(ret, Width, Height);     
             this.ProcessIcon = ret;

 

  ViewVC Help
Powered by ViewVC 1.1.22