From 2e388517486ba88b7b37442f7d0ef079da9a0612 Mon Sep 17 00:00:00 2001 From: tornaco Date: Fri, 25 Nov 2022 19:41:48 +0800 Subject: [PATCH] [profile] add qinglihoutaiguanjiarizhi --- .../profiles/qinglihoutaiguanjiarizhi.json | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 files/profile/profiles/qinglihoutaiguanjiarizhi.json diff --git a/files/profile/profiles/qinglihoutaiguanjiarizhi.json b/files/profile/profiles/qinglihoutaiguanjiarizhi.json new file mode 100644 index 000000000..487cef8d9 --- /dev/null +++ b/files/profile/profiles/qinglihoutaiguanjiarizhi.json @@ -0,0 +1,16 @@ +{ + "author": "诗里沧海怨怼", + "version": 1, + "tags": [ + "app_opt" + ], + "profile": { + "name": "日志清理", + "description": "by诗里沧海怨怼 | 搭配后台管家使用,负责清理产生的日志", + "priority": 2, + "condition": "screenOff", + "actions": [ + "_10MB=10000000;_5MB=_10MB>>1;_1MB=_5MB/5;import java.nio.file.Path;import java.nio.file.Paths;import java.nio.file.Files;if(thanos.profileManager.isGlobalRuleVarByNameExists('logList')){if(globalVarOf$logList.size()==0){ui.showShortToast('请为变量logList添加内容');}else{int cntLog=0;foreach(pathStr:globalVarOf$logList){if(++cntLog==50){Thread.sleep(150);cntLog=0;}if(pathStr!=null){path=Paths.get(pathStr);if(Files.exists(path)&&Files.size(path)>=_5MB){Files.write(path,new byte[0],java.nio.file.StandardOpenOption.TRUNCATE_EXISTING);}}}}}else{thanos.profileManager.disableRuleByName('日志清理');thanos.profileManager.addGlobalRuleVar('logList',new String[0]);ui.showShortToast('变量logList不存在!');}" + ] + } +}