/// <summary> /// This creates a <c>DayTimeConstraint</c> from an <see cref="System.Xml.XmlNode">XmlNode</see>. /// </summary> /// <param name="itemsNode"> /// A <see cref="XmlNode">XmlNode</see> representing the <c>DayTimeConstraint</c>. /// </param> /// <exception cref="ArgumentNullException"> /// Thrown if the <see cref="XmlNode">XmlNode</see> is null. /// </exception> public override void FromXml(XmlNode itemsNode) { base.FromXml(itemsNode); XmlNodeList rangeListNode = itemsNode.SelectNodes("Range"); if (this.timeRange == null && rangeListNode.Count > 0) { this.timeRange = new TimeRangeCollection(); } for (int i = 0; i < rangeListNode.Count; i++) { XmlAttributeCollection attrColection = ((XmlNode)rangeListNode[i]).Attributes; XmlAttribute startTimeNode = (XmlAttribute)attrColection.GetNamedItem("StartTime"); XmlAttribute endTimeNode = (XmlAttribute)attrColection.GetNamedItem("EndTime"); Time start = null; Time end = null; if (startTimeNode != null) { start = new Time(Convert.ToInt32(startTimeNode.Value)); } if (endTimeNode != null) { end = new Time(Convert.ToInt32(endTimeNode.Value)); } this.timeRange.Add(new TimeRange(start, end)); } }
/// <summary> /// Adds the contents of another <see cref='TimeRangeCollection'/> to the end of the collection. /// </summary> /// <param name='val'> /// A <see cref='TimeRangeCollection'/> containing the objects to add to the collection. /// </param> /// <seealso cref='TimeRangeCollection.Add'/> public void AddRange(TimeRangeCollection val) { for (int i = 0; i < val.Count; i++) { this.Add(val[i]); } }
/// <summary> /// Initializes a new instance of <see cref='TimeRangeEnumerator'/>. /// </summary> public TimeRangeEnumerator(TimeRangeCollection mappings) { this.temp = ((IEnumerable)(mappings)); this.baseEnumerator = temp.GetEnumerator(); }
/// <summary> /// Initializes a new instance of <see cref='TimeRangeCollection'/> based on another <see cref='TimeRangeCollection'/>. /// </summary> /// <param name='val'> /// A <see cref='TimeRangeCollection'/> from which the contents are copied /// </param> public TimeRangeCollection(TimeRangeCollection val) { this.AddRange(val); }