コード例 #1
0
ファイル: SnapshotRuleEx.cs プロジェクト: suh4s/BitShelter
        public static ICalendar GetCalendar(this SnapshotRule rule)
        {
            if (rule.HasCalendar() == false)
            {
                return(null);
            }

            // Modify here to handle several calendar if necessary in the future
            // Beware of calling GetExcludingDayRange if no exclusion range enabled
            rule.GetExcludingDayRange(out DateTime from, out DateTime to);
            return(new DailyCalendar(from, to));
        }
コード例 #2
0
ファイル: SnapshotRuleEx.cs プロジェクト: suh4s/BitShelter
        public static ITrigger GetTrigger(this SnapshotRule rule)
        {
            TriggerBuilder builder = TriggerBuilder.Create()
                                     .WithIdentity(rule.ToString(), "SnapshotJob")
                                     .WithCronSchedule(rule.GeneratedCron)
                                     .StartAt(rule.PeriodStart)
                                     .UsingJobData("RuleId", rule.Id)
                                     .WithDescription(rule.ToString());

            if (rule.PeriodEndEnabled)
            {
                builder = builder.EndAt(rule.PeriodEnd);
            }

            if (rule.HasCalendar())
            {
                builder = builder.ModifiedByCalendar(rule.GetCalendarName());
            }

            return(builder.Build());
        }