private bool FindNumber(PrintIssue issue, string filename) { foreach (RegexValues rv in _numberRegexList.Values) { //Match match = rv.Match_old(filename); MatchValues matchValues = rv.Match(filename); //while (match.Success) while (matchValues.Success) { //if (issue.MatchSetValues(rv, v => PrintIssue.IsNumberValid(v))) if (issue.MatchSetValues(matchValues, v => PrintIssue.IsNumberValid(v))) { if (issue.Control()) { return(true); } } //match = rv.Next_old(); matchValues = matchValues.Next(); } } return(false); }
private bool FindNumber(PrintIssue issue, string filename) { foreach (RegexValues rv in _numberRegexList.Values) { //Match match = rv.Match_old(filename); MatchValues matchValues = rv.Match(filename); //while (match.Success) while (matchValues.Success) { //if (issue.MatchSetValues(rv, v => PrintIssue.IsNumberValid(v))) if (issue.MatchSetValues(matchValues, v => PrintIssue.IsNumberValid(v))) { if (issue.Control()) { return true; } } //match = rv.Next_old(); matchValues = matchValues.Next(); } } return false; }
public PrintIssue Find(string filename) { WriteLine("search \"{0}\"", filename); PrintIssue issue = null; PrintIssue lastIssueError = null; //List<GClass2<PrintIssue, RegexValues>> issues = new List<GClass2<PrintIssue,RegexValues>>(); List <GClass2 <PrintIssue, MatchValues> > issues = new List <GClass2 <PrintIssue, MatchValues> >(); bool foundIssue = false; filename = zstr.ReplaceUTF8Code(filename); filename = filename.Replace('\u0430', 'a'); filename = filename.Replace('\u0435', 'e'); filename = filename.Replace('\u043E', 'o'); WriteLine("search \"{0}\"", filename); foreach (RegexValues rv in _printRegexList.Values) { //issue = Match(rv, filename); GClass2 <PrintIssue, MatchValues> gc = Match(rv, filename); //if (issue != null && issue.Error == null) if (gc.Value1 != null && gc.Value1.Error == null) { Print print = issue.Print; //if (issue.Match(print.NormalizedFilename, filename)) MatchValues matchValues = issue.Match(print.NormalizedFilename, filename); if (matchValues != null) { foundIssue = true; break; } //if (issue.Match(print.NormalizedSpecialFilename, filename)) matchValues = issue.Match(print.NormalizedSpecialFilename, filename); if (matchValues != null) { foundIssue = true; break; } //issues.Add(new GClass2<PrintIssue, RegexValues>(issue, rv)); issues.Add(new GClass2 <PrintIssue, MatchValues>(issue, gc.Value2)); } //if (issue != null && issue.Error != null) if (gc.Value1 != null && gc.Value1.Error != null) { lastIssueError = issue; } } if (!foundIssue) { //foreach (GClass2<PrintIssue, RegexValues> issue2 in issues) foreach (GClass2 <PrintIssue, MatchValues> issue2 in issues) { issue = issue2.Value1; //RegexValues rv = issue2.Value2; MatchValues matchValues = issue2.Value2; Print print = issue.Print; //string filename2 = filename = rv.MatchReplace_old("_"); string filename2 = filename = matchValues.Replace("_"); FindSpecial(issue, ref filename2); if (print.Frequency != PrintFrequency.Daily && print.Frequency != PrintFrequency.Weekly) { if (FindNumber(issue, filename2)) { foundIssue = true; } //if (issue.Error != null) // lastIssueError = issue; } bool foundDate = false; if (!foundIssue) { if (FindDate(issue, ref filename2)) { foundDate = true; } //if (issue.Error != null) // lastIssueError = issue; } if (!foundIssue && print.Frequency != PrintFrequency.Daily) { if (FindNumber(issue, filename2)) { foundIssue = true; } //if (issue.Error != null) // lastIssueError = issue; } if (foundDate) { foundIssue = true; } if (!foundIssue && (print.Frequency == PrintFrequency.Daily || print.Frequency == PrintFrequency.Weekly)) { if (FindDay(issue, filename2)) { foundIssue = true; } //if (issue.Error != null) // lastIssueError = issue; } if (issue.Error != null) { lastIssueError = issue; } if (foundIssue) { break; } } } if (!foundIssue) { if (_trace) { WriteLine("print not found \"{0}\"", filename); } return(lastIssueError); } issue.Control(); return(issue); }