public static void Test_OneFindPrint(DownloadAutomateManager downloadAutomate, string title, string category = null, PrintType postType = PrintType.Unknow) { TestFindPrint testFindPrint = FindPrint(downloadAutomate, new TestPrint { title = title, category = category, postType = postType }); Trace.WriteLine(testFindPrint.zToJson()); }
public static void Test_FindPrintFromMongo(DownloadAutomateManager downloadAutomate, string printName, string query, int limit = 0, string sort = null) { Trace.WriteLine("regex {0} : \"{1}\"", printName, downloadAutomate.FindPrintManager.FindPrintList[printName].Pattern); string file = zPath.Combine(GetDirectory(), printName + ".txt"); string bsonFile = zpath.PathSetFileNameWithoutExtension(file, zPath.GetFileNameWithoutExtension(file) + "_out_bson"); FindPrintFromMongo(downloadAutomate, query, limit, sort).zFindPrint(downloadAutomate).zSave(bsonFile); WriteAllFindPrint(bsonFile); zmongo.FileReader<TestFindPrint>(bsonFile).zView(); }
//public static void Test_FindPrint(DownloadAutomateManager_v1 downloadAutomate, string file) public static void Test_FindPrint(DownloadAutomateManager downloadAutomate, string file) { Trace.WriteLine("Test_FindPrint \"{0}\"", file); if (downloadAutomate.FindPrintManager != null) Trace.WriteLine(" FindPrintManager2.PrintRegexList : {0}", downloadAutomate.FindPrintManager.FindPrintList.Count); file = zPath.Combine(GetDirectory(), file); string bsonFile = zpath.PathSetFileNameWithoutExtension(file, zPath.GetFileNameWithoutExtension(file) + "_out_bson"); zmongo.FileReader<TestPrint>(file).zFindPrint(downloadAutomate).zSave(bsonFile); WriteAllFindPrint(bsonFile); }
public static void Test_FindPrintFromMongo(DownloadAutomateManager downloadAutomate, string printName, string query, int limit = 0, string sort = null) { Trace.WriteLine("regex {0} : \"{1}\"", printName, downloadAutomate.FindPrintManager.FindPrintList[printName].Pattern); string file = zPath.Combine(GetDirectory(), printName + ".txt"); string bsonFile = zpath.PathSetFileNameWithoutExtension(file, zPath.GetFileNameWithoutExtension(file) + "_out_bson"); FindPrintFromMongo(downloadAutomate, query, limit, sort).zFindPrint(downloadAutomate).zSave(bsonFile); WriteAllFindPrint(bsonFile); zmongo.FileReader <TestFindPrint>(bsonFile).zView(); }
//public static void Test_FindPrint(DownloadAutomateManager_v1 downloadAutomate, string file) public static void Test_FindPrint(DownloadAutomateManager downloadAutomate, string file) { Trace.WriteLine("Test_FindPrint \"{0}\"", file); if (downloadAutomate.FindPrintManager != null) { Trace.WriteLine(" FindPrintManager2.PrintRegexList : {0}", downloadAutomate.FindPrintManager.FindPrintList.Count); } file = zPath.Combine(GetDirectory(), file); string bsonFile = zpath.PathSetFileNameWithoutExtension(file, zPath.GetFileNameWithoutExtension(file) + "_out_bson"); zmongo.FileReader <TestPrint>(file).zFindPrint(downloadAutomate).zSave(bsonFile); WriteAllFindPrint(bsonFile); }
//public static TestFindPrint FindPrint(DownloadAutomateManager_v1 downloadAutomate, TestPrint print) public static TestFindPrint FindPrint(DownloadAutomateManager downloadAutomate, TestPrint print) { //FindPrint findPrint = null; //if (downloadAutomate.FindPrintManager != null) // findPrint = downloadAutomate.FindPrint(print.title, print.category); //else if (downloadAutomate.FindPrintManager_new != null) // findPrint = downloadAutomate.FindPrint_new(print.title, print.postType); FindPrintInfo findPrint = downloadAutomate.FindPrint(print.title, print.postType); TestFindPrint testFindPrint = new TestFindPrint(); testFindPrint.post_title = print.title; testFindPrint.post_category = print.category; testFindPrint.post_isPrint = print.postType == PrintType.Print; //testFindPrint.post_postType = print.postType; testFindPrint.findPrint_file = findPrint.file; testFindPrint.findPrint_type = findPrint.findPrintType; testFindPrint.findPrint_name = findPrint.name; testFindPrint.findPrint_title = findPrint.title; testFindPrint.print_name = findPrint.print != null ? findPrint.print.Name : null; testFindPrint.print_title = findPrint.print != null ? findPrint.print.Title : null; testFindPrint.titleInfo_formatedTitle = findPrint.titleInfo != null ? findPrint.titleInfo.FormatedTitle : null; testFindPrint.findPrint_date = findPrint.date; testFindPrint.findPrint_dateType = findPrint.dateType; if (findPrint.titleInfo != null) { testFindPrint.findPrint_dateCapture = RegexCaptureValues.CreateRegexCaptureValues(findPrint.titleInfo.DateMatch, allValues: true); //testFindPrint.findPrint_dateOtherCaptureList = RegexCaptureValues.CreateRegexCaptureValuesList(findPrint.titleInfo.DateOtherMatchList, allValues: true); } testFindPrint.findPrint_number = findPrint.number; if (findPrint.titleInfo != null) { testFindPrint.findPrint_numberCapture = RegexCaptureValues.CreateRegexCaptureValues(findPrint.titleInfo.NumberMatch, allValues: true); } testFindPrint.findPrint_special = findPrint.special; if (findPrint.titleInfo != null) { testFindPrint.findPrint_specialCapture = RegexCaptureValues.CreateRegexCaptureValues(findPrint.titleInfo.SpecialMatch, allValues: true); } testFindPrint.findPrint_specialText = findPrint.specialText; testFindPrint.findPrint_remainText = findPrint.remainText; testFindPrint.warnings = __traceMessages.ToArray(); __traceMessages.Clear(); return(testFindPrint); }
public static IEnumerable <TestPrint> FindPrintFromMongo(DownloadAutomateManager downloadAutomate, string query, int limit = 0, string sort = null) { if (sort == null) { sort = "{ 'download.title': 1 }"; } //var query2 = pb.Data.Mongo.MongoCommand.Find("dl", "RapideDdl_Detail2", query, limit: limit, sort: sort, fields: "{ '_id': 1, 'download.title': 1, 'download.creationDate': 1, 'download.category': 1, 'download.isPrint': 1, 'download.sourceUrl': 1 }"); var query2 = MongoCommand.Find("dl", "RapideDdl_Detail2", query, limit: limit, sort: sort, fields: "{ '_id': 1, 'download.title': 1, 'download.creationDate': 1, 'download.category': 1, 'download.postType': 1, 'download.sourceUrl': 1 }"); var query3 = query2.Select(document => new TestPrint { title = document["download"]["title"].AsString, category = document["download"]["category"].AsString, //isPrint = document["download"]["isPrint"].AsBoolean postType = (PrintType)document["download"]["postType"].AsInt32 } ); return(query3); }
public static void Test_OneFindPrint(DownloadAutomateManager downloadAutomate, string title, string category = null, PrintType postType = PrintType.Unknow) { TestFindPrint testFindPrint = FindPrint(downloadAutomate, new TestPrint { title = title, category = category, postType = postType }); Trace.WriteLine(testFindPrint.zToJson()); }
//public static TestFindPrint FindPrint(DownloadAutomateManager_v1 downloadAutomate, TestPrint print) public static TestFindPrint FindPrint(DownloadAutomateManager downloadAutomate, TestPrint print) { //FindPrint findPrint = null; //if (downloadAutomate.FindPrintManager != null) // findPrint = downloadAutomate.FindPrint(print.title, print.category); //else if (downloadAutomate.FindPrintManager_new != null) // findPrint = downloadAutomate.FindPrint_new(print.title, print.postType); FindPrintInfo findPrint = downloadAutomate.FindPrint(print.title, print.postType); TestFindPrint testFindPrint = new TestFindPrint(); testFindPrint.post_title = print.title; testFindPrint.post_category = print.category; testFindPrint.post_isPrint = print.postType == PrintType.Print; //testFindPrint.post_postType = print.postType; testFindPrint.findPrint_file = findPrint.file; testFindPrint.findPrint_type = findPrint.findPrintType; testFindPrint.findPrint_name = findPrint.name; testFindPrint.findPrint_title = findPrint.title; testFindPrint.print_name = findPrint.print != null ? findPrint.print.Name : null; testFindPrint.print_title = findPrint.print != null ? findPrint.print.Title : null; testFindPrint.titleInfo_formatedTitle = findPrint.titleInfo != null ? findPrint.titleInfo.FormatedTitle : null; testFindPrint.findPrint_date = findPrint.date; testFindPrint.findPrint_dateType = findPrint.dateType; if (findPrint.titleInfo != null) { testFindPrint.findPrint_dateCapture = RegexCaptureValues.CreateRegexCaptureValues(findPrint.titleInfo.DateMatch, allValues: true); //testFindPrint.findPrint_dateOtherCaptureList = RegexCaptureValues.CreateRegexCaptureValuesList(findPrint.titleInfo.DateOtherMatchList, allValues: true); } testFindPrint.findPrint_number = findPrint.number; if (findPrint.titleInfo != null) testFindPrint.findPrint_numberCapture = RegexCaptureValues.CreateRegexCaptureValues(findPrint.titleInfo.NumberMatch, allValues: true); testFindPrint.findPrint_special = findPrint.special; if (findPrint.titleInfo != null) testFindPrint.findPrint_specialCapture = RegexCaptureValues.CreateRegexCaptureValues(findPrint.titleInfo.SpecialMatch, allValues: true); testFindPrint.findPrint_specialText = findPrint.specialText; testFindPrint.findPrint_remainText = findPrint.remainText; testFindPrint.warnings = __traceMessages.ToArray(); __traceMessages.Clear(); return testFindPrint; }
public static IEnumerable<TestFindPrint> zFindPrint(this IEnumerable<TestPrint> prints, DownloadAutomateManager downloadAutomate) { try { ActiveTraceCatch(); foreach (TestPrint print in prints) { yield return FindPrint(downloadAutomate, print); } } finally { DesactiveTraceCatch(); } }
public static IEnumerable<TestPrint> FindPrintFromMongo(DownloadAutomateManager downloadAutomate, string query, int limit = 0, string sort = null) { if (sort == null) sort = "{ 'download.title': 1 }"; //var query2 = pb.Data.Mongo.MongoCommand.Find("dl", "RapideDdl_Detail2", query, limit: limit, sort: sort, fields: "{ '_id': 1, 'download.title': 1, 'download.creationDate': 1, 'download.category': 1, 'download.isPrint': 1, 'download.sourceUrl': 1 }"); var query2 = MongoCommand.Find("dl", "RapideDdl_Detail2", query, limit: limit, sort: sort, fields: "{ '_id': 1, 'download.title': 1, 'download.creationDate': 1, 'download.category': 1, 'download.postType': 1, 'download.sourceUrl': 1 }"); var query3 = query2.Select(document => new TestPrint { title = document["download"]["title"].AsString, category = document["download"]["category"].AsString, //isPrint = document["download"]["isPrint"].AsBoolean postType = (PrintType)document["download"]["postType"].AsInt32 } ); return query3; }
public static IEnumerable <TestFindPrint> zFindPrint(this IEnumerable <TestPrint> prints, DownloadAutomateManager downloadAutomate) { try { ActiveTraceCatch(); foreach (TestPrint print in prints) { yield return(FindPrint(downloadAutomate, print)); } } finally { DesactiveTraceCatch(); } }