--- trunk/RomCheater.PluginFramework/Core/ProcContainer.cs 2012/05/10 09:53:16 101 +++ trunk/RomCheater.PluginFramework/Core/ProcContainer.cs 2012/05/10 11:16:03 107 @@ -23,7 +23,7 @@ namespace RomCheater.PluginFramework.Cor fname = ProcessModeleInfoEx.GetMainModulePath(process); fi = new FileInfo(fname); } - catch (Exception ex) + catch (Exception) { throw; } @@ -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; } }