private bool FindSpecial(PrintIssue issue, ref string filename) { foreach (RegexValues rv in _specialRegexList.Values) { //if (issue.Match(rv, filename)) MatchValues matchValues = issue.Match(rv, filename); if (matchValues != null) { //filename = rv.MatchReplace_old("_"); filename = matchValues.Replace("_"); return(true); } } return(false); }
private bool FindDate(PrintIssue issue, ref string filename) { foreach (RegexValues rv in _dateRegexList.Values) { //if (issue.Match(rv, filename, v => zdate.IsDateValid(v))) MatchValues matchValues = issue.Match(rv, filename, v => zdate.IsDateValid(v)); if (matchValues != null) { //filename = rv.MatchReplace_old("_"); filename = matchValues.Replace("_"); if (!issue.Special) { return(true); } break; } } return(false); }
private bool FindDate(PrintIssue issue, ref string filename) { foreach (RegexValues rv in _dateRegexList.Values) { //if (issue.Match(rv, filename, v => zdate.IsDateValid(v))) MatchValues matchValues = issue.Match(rv, filename, v => zdate.IsDateValid(v)); if (matchValues != null) { //filename = rv.MatchReplace_old("_"); filename = matchValues.Replace("_"); if (!issue.Special) return true; break; } } return false; }
private bool FindSpecial(PrintIssue issue, ref string filename) { foreach (RegexValues rv in _specialRegexList.Values) { //if (issue.Match(rv, filename)) MatchValues matchValues = issue.Match(rv, filename); if (matchValues != null) { //filename = rv.MatchReplace_old("_"); filename = matchValues.Replace("_"); return true; } } 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); }