/** * 执行定时任务 * */ private void startTimeJob() { Timer timer = new Timer(); //执行时间间隔 timer.Interval = GlobleParams.getFrequency(); timer.Elapsed += new ElapsedEventHandler(CleanWorker.work); timer.Start(); }
private static void printGlobleParams() { StringBuilder log = new StringBuilder(); log.AppendLine("当前时间:" + DateTime.Now.ToString() + " 服务启动...\n"); log.AppendLine("执行频率:" + GlobleParams.getFrequency() / 60000 + "分钟"); log.AppendLine("删除比例:" + GlobleParams.getDeletePercent() + "%"); log.AppendLine("共读取到:" + GlobleParams.getConfigList().Count() + "个需要检查的路径\n"); LogFileOperator.writeLog(log.ToString()); }
private static void createGlobleParams() { GlobleParams.setFrequency(GlobleParams.getFrequency() == -60000 ? "30" : (GlobleParams.getFrequency() / 60000).ToString()); GlobleParams.setDeletePercent(GlobleParams.getDeletePercent() == -1 ? "10" : GlobleParams.getDeletePercent().ToString()); }