Esempio n. 1
0
 public PluginExecuteScope(string typeKey)
 {
     _executeDetail = new ExecuteDetail(typeKey)
     {
         Begin = DateTime.Now
     };
 }
Esempio n. 2
0
        private static void SaveDetail(ExecuteDetail detail, string date)
        {
            var typeKey  = detail.TypeKey;
            var filePath = GetDetailFileName(typeKey, date);

            File.AppendAllText(filePath, detail.ToString());
            File.AppendAllText(filePath, Environment.NewLine);
        }
Esempio n. 3
0
        private static void WriteRecord(ExecuteDetail detail)
        {
            var record = new ExecuteRecord
            {
                TypeKey         = detail.TypeKey,
                LastExecuteTime = detail.End
            };

            WriteRecordInteranl(record);
        }
Esempio n. 4
0
        private static void EndScope(ExecuteDetail detail)
        {
            var currentDate = CurrentDate;

            //write record
            WriteRecord(detail);
            //save detail
            SaveDetail(detail, currentDate);
            //update summary
            UpdateSummary(detail, currentDate);
        }
Esempio n. 5
0
        private static void UpdateSummary(ExecuteDetail detail, string date)
        {
            var typeKey = detail.TypeKey;

            TrySaveAndResetAll(date);
            var summary = ReadSummary(typeKey, date);

            summary.TotalExecute++;
            summary.TotalElapsed += detail.Elapsed;
            summary.TotalSuccess += detail.Success;
            if (detail.Successed)
            {
                summary.LastSuccessExecute = detail.End;
            }
            summary.TotalFailed  += detail.Failed;
            summary.TotalMissed  += detail.Missed;
            summary.TotalCancled += detail.Canceled;
            SaveSummary(summary, date);
        }