提交记录修改Core/Librarys/Iconer.cs+28 −2看文件
修改Core/Servicers/Instances/Main.cs+1 −1看文件
修改UI/Controls/Base/Img.cs+4 −0看文件
修改UI/Librays/Image/Imager.cs+1 −1看文件
| @@ -42,7 +42,7 @@ namespace Core.Librarys | ||
| 42 | 42 | |
| 43 | 43 | return iconName; |
| 44 | 44 | } |
| 45 | 删除: public static string Get(string processname, string desc) | |
| 45 | 新增: public static string Get(string processname, string desc, bool isRelativePath = true) | |
| 46 | 46 | { |
| 47 | 47 | string iconName = FromatIconFileName(processname, desc); |
| 48 | 48 | string iconPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, |
| @@ -51,6 +51,12 @@ namespace Core.Librarys | ||
| 51 | 51 | { |
| 52 | 52 | return "pack://application:,,,/Tai;component/Resources/Icons/defaultIcon.png"; |
| 53 | 53 | } |
| 54 | 新增: | |
| 55 | 新增: if (isRelativePath) | |
| 56 | 新增: { | |
| 57 | 新增: return Path.Combine( | |
| 58 | 新增: "AppIcons", iconName); | |
| 59 | 新增: } | |
| 54 | 60 | return iconPath; |
| 55 | 61 | } |
| 56 | 62 | /// <summary> |
| @@ -59,8 +65,9 @@ namespace Core.Librarys | ||
| 59 | 65 | /// <param name="file"></param> |
| 60 | 66 | /// <param name="processname"></param> |
| 61 | 67 | /// <param name="desc"></param> |
| 68 | 新增: /// <param name="isRelativePath">是否返回相对路径</param> | |
| 62 | 69 | /// <returns>返回提取到程序目录下的路径</returns> |
| 63 | 删除: public static string ExtractFromFile(string file, string processname, string desc, bool isCheck = true) | |
| 70 | 新增: public static string ExtractFromFile(string file, string processname, string desc, bool isCheck = true, bool isRelativePath = true) | |
| 64 | 71 | { |
| 65 | 72 | try |
| 66 | 73 | { |
| @@ -69,8 +76,15 @@ namespace Core.Librarys | ||
| 69 | 76 | string iconPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, |
| 70 | 77 | "AppIcons", iconName); |
| 71 | 78 | |
| 79 | 新增: string relativePath = Path.Combine( | |
| 80 | 新增: "AppIcons", iconName); | |
| 81 | 新增: | |
| 72 | 82 | if (isCheck && File.Exists(iconPath)) |
| 73 | 83 | { |
| 84 | 新增: if (isRelativePath) | |
| 85 | 新增: { | |
| 86 | 新增: return relativePath; | |
| 87 | 新增: } | |
| 74 | 88 | return iconPath; |
| 75 | 89 | } |
| 76 | 90 | string dir = Path.GetDirectoryName(iconPath); |
| @@ -135,6 +149,12 @@ namespace Core.Librarys | ||
| 135 | 149 | // copy to tai dir |
| 136 | 150 | |
| 137 | 151 | File.Copy(iconFile, iconPath); |
| 152 | 新增: | |
| 153 | 新增: if (isRelativePath) | |
| 154 | 新增: { | |
| 155 | 新增: return relativePath; | |
| 156 | 新增: } | |
| 157 | 新增: | |
| 138 | 158 | return iconPath; |
| 139 | 159 | } |
| 140 | 160 | return string.Empty; |
| @@ -153,6 +173,12 @@ namespace Core.Librarys | ||
| 153 | 173 | encoder.Frames.Add(BitmapFrame.Create(ToImageSource(ico) as BitmapSource)); |
| 154 | 174 | encoder.Save(fileStream); |
| 155 | 175 | } |
| 176 | 新增: | |
| 177 | 新增: if (isRelativePath) | |
| 178 | 新增: { | |
| 179 | 新增: return relativePath; | |
| 180 | 新增: } | |
| 181 | 新增: | |
| 156 | 182 | return iconPath; |
| 157 | 183 | } |
| 158 | 184 | catch (Exception ex) |
| @@ -144,7 +144,7 @@ namespace Core.Servicers.Instances | ||
| 144 | 144 | AppState.IsLoading = false; |
| 145 | 145 | }); |
| 146 | 146 | |
| 147 | 删除: | |
| 147 | 新增: | |
| 148 | 148 | |
| 149 | 149 | // 加载应用配置(确保配置文件最先加载 |
| 150 | 150 | appConfig.Load(); |
| @@ -74,6 +74,10 @@ namespace UI.Controls.Base | ||
| 74 | 74 | |
| 75 | 75 | private void Handle() |
| 76 | 76 | { |
| 77 | 新增: if (URL != null && URL.Length > 8 && URL.Substring(0, 8) == "AppIcons") | |
| 78 | 新增: { | |
| 79 | 新增: URL = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, URL); | |
| 80 | 新增: } | |
| 77 | 81 | if (URL == null || (URL.IndexOf("pack://") == -1 && !File.Exists(URL))) |
| 78 | 82 | { |
| 79 | 83 | URL = "pack://application:,,,/Tai;component/Resources/Icons/defaultIcon.png"; |
| @@ -71,7 +71,7 @@ namespace Core.Librarys.Image | ||
| 71 | 71 | bitmap.Freeze(); |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 删除: Logger.Error(ec.Message); | |
| 74 | 新增: Logger.Error("无法读取图片:" + filePath + "。" + ec.Message); | |
| 75 | 75 | |
| 76 | 76 | return bitmap; |
| 77 | 77 | } |

