Esempio n. 1
0
        /**
         * 入口程序
         * */
        public static void work(object sender, ElapsedEventArgs args)
        {
            //检查日志
            LogFileOperator.check();
            //执行文件删除
            string log = Cleaner.cleanUpExcessFiles(GlobleParams.getConfigList(), GlobleParams.getDeletePercent());

            //写日志
            LogFileOperator.writeLog(log);
        }
        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());
 }