Ejemplo n.º 1
0
 public static FindDay Find(FindDayManager findDayManager, string text)
 {
     FindDay findDay = new FindDay();
     findDay._enumerator = findDayManager.DayRegexList.Values.GetEnumerator();
     findDay._text = text;
     findDay.FindNext();
     return findDay;
 }
Ejemplo n.º 2
0
        public static FindDay Find(FindDayManager findDayManager, string text)
        {
            FindDay findDay = new FindDay();

            findDay._enumerator = findDayManager.DayRegexList.Values.GetEnumerator();
            findDay._text       = text;
            findDay.FindNext();
            return(findDay);
        }
Ejemplo n.º 3
0
 public FindDay Find(string text)
 {
     //foreach (RegexValues rv in _dayRegexList.Values)
     //{
     //    MatchValues matchValues = rv.Match(text);
     //    if (matchValues.Success)
     //    {
     //        int day;
     //        if (zDay.TryGetDay(matchValues.GetValues(), out day))
     //            return new FindDay { Found = true, Day = day, MatchValues = matchValues };
     //    }
     //}
     //return new FindDay { Found = false, Day = null, MatchValues = null };
     return(FindDay.Find(this, text));
 }
Ejemplo n.º 4
0
        private void FindDayAndPrint()
        {
            if (!_findPrintManager.UseFindDay || _expectedDate == null || _titleInfo.FormatedTitle == "" || _date != null)
            {
                return;
            }

            if (__traceWarning)
            {
                Trace.WriteLine("  search day \"{0}\"", _titleInfo.FormatedTitle);
            }
            FindDay findDay = _findPrintManager.FindDayManager.Find(_titleInfo.FormatedTitle);

            while (findDay.Found)
            {
                int  day  = (int)findDay.Day;
                Date?date = zdate.GetDayInsideDateGap(day, (Date)_expectedDate, _findPrintManager.GapDayBefore, _findPrintManager.GapDayAfter);
                if (date != null)
                {
                    if (__traceWarning)
                    {
                        Trace.WriteLine("  day found {0} date {1} expected date {2}", day, date, _expectedDate);
                    }
                    //_dateMatch = findDay.MatchValues;
                    //title = findDay.MatchValues.Replace(" $$day$$ ");
                    //_foundDate = true;
                    string title = findDay.MatchValues.Replace("").Trim();
                    if (_dayTitle == null)
                    {
                        _dayTitle = title;
                        _date     = date;
                        _dateType = DateType.Day;
                    }
                    if (__traceWarning)
                    {
                        Trace.WriteLine("  search print \"{0}\"", title);
                    }
                    _findPrint = _findPrintManager.FindPrintList.Find(title);
                    if (_findPrint.Success)
                    {
                        _dayTitle = title;
                        _date     = date;
                        _dateType = DateType.Day;
                        break;
                    }
                }
                else if (__traceWarning)
                {
                    Trace.WriteLine("  wrong day found {0} expected date {1} in \"{2}\"", day, _expectedDate, _titleInfo.FormatedTitle);
                }
                findDay.FindNext();
            }

            //    if (_expectedDate != null && _printTitleManager.UseFindDay)
            //    {
            //        FindDay findDay = _printTitleManager.FindDayManager.Find(title);
            //        //Trace.WriteLine("FindDay \"{0}\" : found {1} day {2}", title, findDay.Found, findDay.Day);
            //        if (findDay.Found)
            //        {
            //            int day = (int)findDay.Day;
            //            Date? date = zdate.GetDayInsideDateGap(day, (Date)_expectedDate, _printTitleManager.GapDayBefore, _printTitleManager.GapDayAfter);
            //            if (date != null)
            //            {
            //                _date = date;
            //                _dateType = DateType.Day;
            //                _dateMatch = findDay.MatchValues;
            //                title = findDay.MatchValues.Replace(" $$day$$ ");
            //                _foundDate = true;
            //            }
            //            else
            //                Trace.WriteLine("  wrong day found {0} expected date {1} in \"{2}\"", day, _expectedDate, title);
            //        }
            //    }
            //    return title;
        }