跳到主要内容

github/tai

公开

Tai · Windows 软件与网站使用时长统计。上游 Planshit/Tai 的源码镜像,非灵栈原创;MIT 许可。来源:https://github.com/Planshit/Tai 。本次为手动同步,暂不提供安装包。

提交记录
修改Core/Librarys/Iconer.cs+28 −2看文件
@@ -42,7 +42,7 @@ namespace Core.Librarys
4242
4343 return iconName;
4444 }
45删除: public static string Get(string processname, string desc)
45新增: public static string Get(string processname, string desc, bool isRelativePath = true)
4646 {
4747 string iconName = FromatIconFileName(processname, desc);
4848 string iconPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
@@ -51,6 +51,12 @@ namespace Core.Librarys
5151 {
5252 return "pack://application:,,,/Tai;component/Resources/Icons/defaultIcon.png";
5353 }
54新增:
55新增: if (isRelativePath)
56新增: {
57新增: return Path.Combine(
58新增: "AppIcons", iconName);
59新增: }
5460 return iconPath;
5561 }
5662 /// <summary>
@@ -59,8 +65,9 @@ namespace Core.Librarys
5965 /// <param name="file"></param>
6066 /// <param name="processname"></param>
6167 /// <param name="desc"></param>
68新增: /// <param name="isRelativePath">是否返回相对路径</param>
6269 /// <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)
6471 {
6572 try
6673 {
@@ -69,8 +76,15 @@ namespace Core.Librarys
6976 string iconPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
7077 "AppIcons", iconName);
7178
79新增: string relativePath = Path.Combine(
80新增: "AppIcons", iconName);
81新增:
7282 if (isCheck && File.Exists(iconPath))
7383 {
84新增: if (isRelativePath)
85新增: {
86新增: return relativePath;
87新增: }
7488 return iconPath;
7589 }
7690 string dir = Path.GetDirectoryName(iconPath);
@@ -135,6 +149,12 @@ namespace Core.Librarys
135149 // copy to tai dir
136150
137151 File.Copy(iconFile, iconPath);
152新增:
153新增: if (isRelativePath)
154新增: {
155新增: return relativePath;
156新增: }
157新增:
138158 return iconPath;
139159 }
140160 return string.Empty;
@@ -153,6 +173,12 @@ namespace Core.Librarys
153173 encoder.Frames.Add(BitmapFrame.Create(ToImageSource(ico) as BitmapSource));
154174 encoder.Save(fileStream);
155175 }
176新增:
177新增: if (isRelativePath)
178新增: {
179新增: return relativePath;
180新增: }
181新增:
156182 return iconPath;
157183 }
158184 catch (Exception ex)
修改Core/Servicers/Instances/Main.cs+1 −1看文件
@@ -144,7 +144,7 @@ namespace Core.Servicers.Instances
144144 AppState.IsLoading = false;
145145 });
146146
147删除:
147新增:
148148
149149 // 加载应用配置(确保配置文件最先加载
150150 appConfig.Load();
修改UI/Controls/Base/Img.cs+4 −0看文件
@@ -74,6 +74,10 @@ namespace UI.Controls.Base
7474
7575 private void Handle()
7676 {
77新增: if (URL != null && URL.Length > 8 && URL.Substring(0, 8) == "AppIcons")
78新增: {
79新增: URL = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, URL);
80新增: }
7781 if (URL == null || (URL.IndexOf("pack://") == -1 && !File.Exists(URL)))
7882 {
7983 URL = "pack://application:,,,/Tai;component/Resources/Icons/defaultIcon.png";
修改UI/Librays/Image/Imager.cs+1 −1看文件
@@ -71,7 +71,7 @@ namespace Core.Librarys.Image
7171 bitmap.Freeze();
7272 }
7373
74删除: Logger.Error(ec.Message);
74新增: Logger.Error("无法读取图片:" + filePath + "。" + ec.Message);
7575
7676 return bitmap;
7777 }