/// <summary> /// <para>Initializes a new instance of the <see cref="System.Fabric.Chaos.DataStructures.ChaosScheduleJobActiveDays" /> class by copying another set of active days.</para> /// </summary> /// <param name="other">Another set of days to copy.</param> public ChaosScheduleJobActiveDays(ChaosScheduleJobActiveDays other) : this() { foreach (DayOfWeek day in Enum.GetValues(typeof(DayOfWeek))) { this.activeDays[day] = other.activeDays[day]; } }
internal static unsafe ChaosScheduleJob FromNative(NativeTypes.FABRIC_CHAOS_SCHEDULE_JOB *pointer) { var nativeJob = *pointer; var chaosParameters = NativeTypes.FromNativeString(nativeJob.ChaosParameters); var days = ChaosScheduleJobActiveDays.FromNative(nativeJob.Days); var times = new List <ChaosScheduleTimeRangeUtc>(); var nativeTimesList = *(NativeTypes.FABRIC_CHAOS_SCHEDULE_TIME_RANGE_UTC_LIST *)nativeJob.Times; for (int i = 0; i < nativeTimesList.Count; ++i) { var time = ChaosScheduleTimeRangeUtc.FromNative(nativeTimesList.Items + i * sizeof(NativeTypes.FABRIC_CHAOS_SCHEDULE_TIME_RANGE_UTC)); times.Add(time); } return(new ChaosScheduleJob(chaosParameters, days, times)); }
/// <summary> /// <para>Initializes a new instance of the <see cref="System.Fabric.Chaos.DataStructures.ChaosScheduleJob" /> class.</para> /// </summary> /// <param name="chaosParameters">Parameters to run Chaos with.</param> /// <param name="days">Which days of the week this job will trigger runs of Chaos.</param> /// <param name="times">What times of the day Chaos will be running for.</param> public ChaosScheduleJob(string chaosParameters, ChaosScheduleJobActiveDays days, List <ChaosScheduleTimeRangeUtc> times) { if (chaosParameters == null) { throw new System.ArgumentNullException("ChaosParameters", StringResources.ChaosScheduler_ScheduleJobParametersIsNull); } if (days == null) { throw new System.ArgumentNullException("Days", StringResources.ChaosScheduler_ScheduleJobDaysIsNull); } if (times == null) { throw new System.ArgumentNullException("Times", StringResources.ChaosScheduler_ScheduleJobTimesIsNull); } this.ChaosParameters = chaosParameters; this.Days = days; this.Times = times; }