예제 #1
0
파일: Schedule.cs 프로젝트: kflu/camrec
        public static Schedule FromXml(XElement scheduleElement)
        {
            Schedule s;
            DateTime start,end;
            string startStr = Util.IfNullThen(scheduleElement.Attribute("startlocal"), null);
            string endStr = Util.IfNullThen(scheduleElement.Attribute("endlocal"), null);
            if (startStr == null && endStr == null)
            {
                start = new DateTime(1, 1, 1, 0, 0, 0);
                end = new DateTime(1, 1, 1, 23, 59, 59);
                s = new Schedule(start.TimeOfDay, end.TimeOfDay);
            }
            else if (DateTime.TryParse(startStr, out start) &&
                DateTime.TryParse(endStr, out end) &&
                // You can't specify a TZ as we only compare local time
                start.Kind == DateTimeKind.Unspecified &&
                end.Kind == DateTimeKind.Unspecified)
            {
                s = new Schedule(start.TimeOfDay, end.TimeOfDay);
            }
            else
            {
                Util.Log("Cannot parse Schedule from XML");
                s = null;
            }

            return s;
        }
예제 #2
0
 /* TODO: need to add support for them to be configurable. They needs to be configed in the subclass.
 public readonly int height;
 public readonly int width;
 public readonly int[] framerate;
  */
 protected CameraRecorder(XElement recorderElement)
 {
     Util.ThrowIfNull(recorderElement, "recorderElement");
     this.schedule = Schedule.FromXml(recorderElement.Element(Schedule.XName));
     this.cameraInfo = CameraInfo.FromXml(recorderElement.Element(CameraInfo.XName));
     Util.ThrowIfNull(this.schedule, "schedule");
     Util.ThrowIfNull(this.cameraInfo, "cameraInfo");
 }