Exemplo n.º 1
0
        public static Period Parse(string str)
        {
            Match match = ParseRegex.Match(str);
            if (!match.Success)
                throw new ArgumentException();

            Period result = new Period();
            string dayofweekStr = match.Groups[1].ToString();
            result.DayOfWeek = dayofweekStr == "" ? 0 : int.Parse(dayofweekStr);
            string timeStr = match.Groups[2].ToString();
            result.Time = timeStr == "" ? 0 : int.Parse(timeStr);
            result.WeekStr = match.Groups[3].ToString();
            result.Week = ParseWeek(result.WeekStr);

            return result;
        }
Exemplo n.º 2
0
        public bool ConflictWith(Period other)
        {
            if (DayOfWeek == 0 || other.DayOfWeek == 0)
                return false;

            return DayOfWeek == other.DayOfWeek && Time == other.Time && (Week & other.Week) != 0;
        }