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 108 by william, Thu May 10 11:16:03 2012 UTC vs.
Revision 109 by william, Thu May 10 12:12:26 2012 UTC

--- 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 @@ namespace RomCheater.PluginFramework.Cor
             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 @@ namespace RomCheater.PluginFramework.Cor
             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 @@ namespace RomCheater.PluginFramework.Cor
             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 @@ namespace RomCheater.PluginFramework.Cor
             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 @@ namespace RomCheater.PluginFramework.Cor
             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;