提交记录修改Core/Librarys/Iconer.cs+28 −2看文件
| @@ -18,9 +18,33 @@ namespace Core.Librarys | ||
| 18 | 18 | { |
| 19 | 19 | public class Iconer |
| 20 | 20 | { |
| 21 | 删除: public static string Get(string processname, string desc) | |
| 21 | 新增: /// <summary> | |
| 22 | 新增: /// 格式化图标文件名称 | |
| 23 | 新增: /// </summary> | |
| 24 | 新增: /// <param name="processname">进程名称</param> | |
| 25 | 新增: /// <param name="desc">进程简介</param> | |
| 26 | 新增: /// <returns>返回正确的文件名称</returns> | |
| 27 | 新增: private static string FromatIconFileName(string processname, string desc) | |
| 22 | 28 | { |
| 23 | 29 | string iconName = (processname + desc).Replace(" ", "") + ".png"; |
| 30 | 新增: | |
| 31 | 新增: // 清除无效字符 | |
| 32 | 新增: iconName = iconName.Replace("/", ""); | |
| 33 | 新增: iconName = iconName.Replace("\\", ""); | |
| 34 | 新增: iconName = iconName.Replace(":", ""); | |
| 35 | 新增: iconName = iconName.Replace("*", ""); | |
| 36 | 新增: iconName = iconName.Replace("?", ""); | |
| 37 | 新增: iconName = iconName.Replace("\"", ""); | |
| 38 | 新增: iconName = iconName.Replace("'", ""); | |
| 39 | 新增: iconName = iconName.Replace("<", ""); | |
| 40 | 新增: iconName = iconName.Replace(">", ""); | |
| 41 | 新增: iconName = iconName.Replace("|", ""); | |
| 42 | 新增: | |
| 43 | 新增: return iconName; | |
| 44 | 新增: } | |
| 45 | 新增: public static string Get(string processname, string desc) | |
| 46 | 新增: { | |
| 47 | 新增: string iconName = FromatIconFileName(processname, desc); | |
| 24 | 48 | string iconPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, |
| 25 | 49 | "AppIcons", iconName); |
| 26 | 50 | if (!File.Exists(iconPath)) |
| @@ -40,9 +64,11 @@ namespace Core.Librarys | ||
| 40 | 64 | { |
| 41 | 65 | try |
| 42 | 66 | { |
| 43 | 删除: string iconName = (processname + desc).Replace(" ", "") + ".png"; | |
| 67 | 新增: string iconName = FromatIconFileName(processname, desc); | |
| 68 | 新增: | |
| 44 | 69 | string iconPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, |
| 45 | 70 | "AppIcons", iconName); |
| 71 | 新增: | |
| 46 | 72 | if (isCheck && File.Exists(iconPath)) |
| 47 | 73 | { |
| 48 | 74 | return iconPath; |

