public void AppendAroundTimeRule(ScheduleRules rules, DateTime? aroundTime) { if (aroundTime.HasValue) { rules.Add(ScheduleRuleType.AroundTime, new ScheduleTime(aroundTime.Value.Hour, aroundTime.Value.Minute, aroundTime.Value.Second)); } }
public static void AppendOnDateAndDaysOfWeekRule(ScheduleRules rules, ScheduleDaysOfWeek daysOfWeek, DateTime? onDateTime) { if (daysOfWeek == ScheduleDaysOfWeek.None) { if (onDateTime.HasValue) { rules.Add(ScheduleRuleType.OnDate, onDateTime.Value.Date); } } else { if (onDateTime.HasValue) { rules.Add(ScheduleRuleType.DaysOfWeek, daysOfWeek, onDateTime.Value.Date); } else { rules.Add(ScheduleRuleType.DaysOfWeek, daysOfWeek); } } }
public static void AppendAroundTimeRule(ScheduleRules rules, DateTime aroundTime) { rules.Add(ScheduleRuleType.AroundTime, new ScheduleTime(aroundTime.Hour, aroundTime.Minute, aroundTime.Second)); }
private static void AppendORableRule(ScheduleRules rules, ScheduleRuleType rule, string expression) { expression = expression.Trim(); if (!String.IsNullOrEmpty(expression)) { List<object> arguments = new List<object>(); int index = 0; while (index < expression.Length) { int operatorIndex; int nextIndex; Operator op = GetNextOperator(expression, index, out operatorIndex, out nextIndex); if (op == Operator.None) { arguments.Add(expression.Substring(index).Trim()); rules.Add(rule, arguments.ToArray()); break; } string fragment = expression.Substring(index, operatorIndex - index).Trim(); if (fragment.Length > 0 && fragment != "AND" && fragment != "OR") { arguments.Add(fragment); } index = nextIndex; } } }
private static void AppendContainsRule(ScheduleRules rules, ScheduleRuleType containsRule, ScheduleRuleType doesNotContainRule, string expression) { expression = (expression ?? String.Empty).Trim(); if (!String.IsNullOrEmpty(expression)) { List<object> arguments = new List<object>(); bool lastOperatorWasNot = false; int index = 0; while (index < expression.Length) { int operatorIndex; int nextIndex; Operator op = GetNextOperator(expression, index, out operatorIndex, out nextIndex); if (op == Operator.None) { arguments.Add(expression.Substring(index).Trim()); rules.Add(lastOperatorWasNot ? doesNotContainRule : containsRule, arguments.ToArray()); break; } string fragment = expression.Substring(index, operatorIndex - index).Trim(); if (fragment.Length > 0 && fragment != "AND" && fragment != "OR") { if (lastOperatorWasNot) { rules.Add(doesNotContainRule, fragment); } else { arguments.Add(fragment); if (op != Operator.Or) { rules.Add(containsRule, arguments.ToArray()); arguments.Clear(); } } } lastOperatorWasNot = (op == Operator.Not); index = nextIndex; } } }
public static void AppendStartingBetweenRule(ScheduleRules rules, DateTime lowerTime, DateTime upperTime) { rules.Add(ScheduleRuleType.StartingBetween, new ScheduleTime(lowerTime.Hour, lowerTime.Minute, lowerTime.Second), new ScheduleTime(upperTime.Hour, upperTime.Minute, upperTime.Second)); }
public void AppendChannelsRule(ScheduleRules rules, bool notOnChannels, IList channelIds) { ScheduleRule channelsRule = new ScheduleRule(notOnChannels ? ScheduleRuleType.NotOnChannels : ScheduleRuleType.Channels); foreach (Guid channel in channelIds) { channelsRule.Arguments.Add(channel); } if (channelsRule.Arguments.Count > 0) { rules.Add(channelsRule); } }
private static void AppendStringArgumentsRule(ScheduleRules rules, ScheduleRuleType ruleType, IList arguments) { ScheduleRule rule = new ScheduleRule(ruleType); foreach (string arg in arguments) { rule.Arguments.Add(arg); } if (rule.Arguments.Count > 0) { rules.Add(rule); } }
public void UpdateManualSchedule(Guid channelId, string channelDisplayName, DateTime startTime, TimeSpan duration, ScheduleDaysOfWeek daysOfWeek) { ScheduleRules rules = new ScheduleRules(); rules.Add(ScheduleRuleType.Channels, channelId); rules.Add(ScheduleRuleType.ManualSchedule, startTime, new ScheduleTime(duration)); if (daysOfWeek != ScheduleDaysOfWeek.None) { rules.Add(ScheduleRuleType.DaysOfWeek, daysOfWeek); } _model.Schedule.Name = BuildManualScheduleName(channelDisplayName, startTime, duration, daysOfWeek); _model.Schedule.Rules = rules; }
public void AppendSkipRepeatsRule(ScheduleRules rules, bool skipRepeats) { if (skipRepeats) { rules.Add(ScheduleRuleType.SkipRepeats, true); } }
public void AppendNewTitlesOnlyRule(ScheduleRules rules, bool newTitlesOnly) { if (newTitlesOnly) { rules.Add(ScheduleRuleType.NewTitlesOnly, true); } }