跳到主要内容

github/tai

公开

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

提交记录
修改Core/Servicers/Instances/Sleepdiscover.cs+7 −5看文件
@@ -54,11 +54,11 @@ namespace Core.Servicers.Instances
5454 if (e.Reason == SessionSwitchReason.RemoteDisconnect || e.Reason == SessionSwitchReason.ConsoleDisconnect)
5555 {
5656 // 与这台设备远程桌面连接断开
57删除: Debug.WriteLine("与这台设备远程桌面连接断开");
5857 if (status == SleepStatus.Wake)
5958 {
6059 status = SleepStatus.Sleep;
6160 SleepStatusChanged?.Invoke(status);
61新增: Logger.Warn("与这台设备远程桌面连接断开");
6262 }
6363 }
6464 }
@@ -89,20 +89,22 @@ namespace Core.Servicers.Instances
8989 switch (e.Mode)
9090 {
9191 case PowerModes.Suspend:
92删除: //电脑休眠
92新增: // 电脑休眠
9393 if (status == SleepStatus.Wake)
9494 {
9595 status = SleepStatus.Sleep;
9696 SleepStatusChanged?.Invoke(status);
97新增: Logger.Warn("设备已休眠");
9798 }
9899 break;
99100 case PowerModes.Resume:
100删除: //电脑恢复
101新增: // 电脑恢复
101102 if (status == SleepStatus.Sleep)
102103 {
103104 playSoundStartTime = DateTime.MinValue;
104105 status = SleepStatus.Wake;
105106 SleepStatusChanged?.Invoke(status);
107新增: Logger.Warn("设备已恢复");
106108 }
107109 break;
108110 }
@@ -197,9 +199,9 @@ namespace Core.Servicers.Instances
197199 {
198200 // 超过表示可能睡着了,切换状态
199201 status = SleepStatus.Sleep;
202新增: Logger.Info("[sleep] [1] time:" + timeSpan.TotalHours + ",start:" + playSoundStartTime);
200203
201204 playSoundStartTime = DateTime.MinValue;
202删除: Logger.Info("[sleep] [1] time:" + timeSpan.TotalHours + ",start:" + playSoundStartTime);
203205 SleepStatusChanged?.Invoke(status);
204206 }
205207 }
@@ -210,7 +212,7 @@ namespace Core.Servicers.Instances
210212 {
211213 // 没有播放声音且键盘休眠超时
212214 status = SleepStatus.Sleep;
213删除: Logger.Info("[sleep] [2]");
215新增: Logger.Info("[sleep] [2] " + pressKeyboardLastTime);
214216
215217 SleepStatusChanged?.Invoke(status);
216218 }