public static void RunDownloadAutomate(string parameters = null) { //DownloadAutomateManager downloadAutomateManager = CreateDownloadAutomateManager(parameters); DownloadAutomateManager downloadAutomateManager = CreateDownloadAutomateManagerWithServers(parameters); try { //DownloadAutomateManagerCreator downloadAutomateManagerCreator = GetDownloadAutomateManagerCreator(parameters); //downloadAutomateManager = downloadAutomateManagerCreator.Create(); //InitServers(); //downloadAutomateManager.AddServerManagers(downloadAutomateManagerCreator.CreateServerManagers()); if (!downloadAutomateManager.ControlDownloadManagerClient()) { throw new PBException("error download manager client is not working"); } downloadAutomateManager.Start(); downloadAutomateManager.Run(); } finally { if (downloadAutomateManager != null) { downloadAutomateManager.Dispose(); } } }
// int gapDayBefore = 0, int gapDayAfter = 0, int? traceLevel = null //public static DownloadAutomateManager_v2 Create(int version = 3, bool dailyPrintManager = false, bool useTestManager = false, bool test = false) //{ // CreateDownloadAutomateManager create = new CreateDownloadAutomateManager(); // create._version = version; // create._dailyPrintManager = dailyPrintManager; // //create._gapDayBefore = gapDayBefore; // //create._gapDayAfter = gapDayAfter; // create._useTestManager = useTestManager; // //create._traceLevel = traceLevel; // create._test = test; // return create._Create(); //} public DownloadAutomateManager Create() { // from DownloadAutomate_f.CreateDownloadAutomate_v2() // le 01/11/2014 désactive version 1 et version 2 // version 1 : utilise l'ancien FindPrintManager, l'ancienne liste de print dans print_list1.xml, l'ancien pattern de date FindPrints/Dates/Date avec l'ancien FindDateManager // version 2 : version 1 + le nouveau FindPrintManager_new avec le nouveau PrintTitleManager, la nouvelle liste de print dans print_list2.xml, // version 3 : version 2 + le nouveau pattern de date FindPrints/Dates/DateNew avec le nouveau FindDateManager_new // version 4 (not used) : version 3 + découpe le titre avec "du" ou "-" (PrintTitleManager) // version 5 : version 3 + new find date // version 6 : version 5 + printTitleManager version 2 + findPrintManager version 2 if (_version < 3 || _version > 6) { throw new PBException("bad version {0}", _version); } Trace.WriteLine("create download automate : version {0} useTestManager {1} traceLevel {2}", _version, _useTestManager, _traceLevel.zToStringOrNull()); //if (!_test) // _xeConfig = XmlConfig.CurrentConfig.GetElement("DownloadAutomateManager"); //else // _xeConfig = XmlConfig.CurrentConfig.GetElement("DownloadAutomateManager_Test"); _mongoDownloadAutomateManager = CreateMongoDownloadAutomateManager(); //_findPrintManager = CreateFindPrintManager(); _findPrintManager = FindPrintManagerCreator.Create(_xeConfig, _parameters, _version); _downloadManager = CreateDownloadManager(); _mailSender = CreateMailSender(); _mailMessage = CreateMailMessage(); _downloadAutomateManager = _CreateDownloadAutomateManager(); //InitServers(); //CreateServerManagers(); _downloadAutomateManager.Init(_xeConfig); _downloadAutomateManager.SetParameters(_parameters); TraceResult(); //if (!ControlDownloadManagerClient()) // throw new PBException("error DownloadManagerClient is not working"); if (_traceLevel != null) { //Trace.CurrentTrace.TraceLevel = (int)_traceLevel; pb.TraceLevel.Level = (int)_traceLevel; } //_downloadAutomateManager.Start(); return(_downloadAutomateManager); }
public static DownloadAutomateManager CreateDownloadAutomateManagerWithServers(string parameters = null) { //NamedValues<ZValue> parameters2 = NamedValues.ParseValues(parameters); NamedValues <ZValue> parameters2 = ParseParameters(parameters); bool test = WebData.GetTestValue(parameters2); DownloadAutomateManagerCreator downloadAutomateManagerCreator = GetDownloadAutomateManagerCreator(parameters2, test); DownloadAutomateManager downloadAutomateManager = downloadAutomateManagerCreator.Create(); //InitServers(test); InitServers_v2(test); downloadAutomateManager.AddServerManagers(downloadAutomateManagerCreator.CreateServerManagers()); return(downloadAutomateManager); }
private DownloadAutomateManager _CreateDownloadAutomateManager() { DownloadAutomateManager downloadAutomateManager = new DownloadAutomateManager(); downloadAutomateManager.MongoDownloadAutomateManager = _mongoDownloadAutomateManager; downloadAutomateManager.DownloadAllPrintType = printType => printType == PrintType.Print; downloadAutomateManager.FindPrintManager = _findPrintManager; downloadAutomateManager.DownloadManager = _downloadManager; downloadAutomateManager.MailSender = _mailSender; downloadAutomateManager.MailMessage = _mailMessage; //downloadAutomateManager.Init(_xeConfig); //downloadAutomateManager.SetParameters(_parameters); return(downloadAutomateManager); }
private DownloadAutomateManager _CreateDownloadAutomateManager() { DownloadAutomateManager downloadAutomateManager = new DownloadAutomateManager(); downloadAutomateManager.MongoDownloadAutomateManager = _mongoDownloadAutomateManager; downloadAutomateManager.DownloadAllPrintType = printType => printType == PrintType.Print; downloadAutomateManager.FindPrintManager = _findPrintManager; downloadAutomateManager.DownloadManager = _downloadManager; downloadAutomateManager.MailSender = _mailSender; downloadAutomateManager.MailMessage = _mailMessage; //downloadAutomateManager.Init(_xeConfig); //downloadAutomateManager.SetParameters(_parameters); return downloadAutomateManager; }
// int gapDayBefore = 0, int gapDayAfter = 0, int? traceLevel = null //public static DownloadAutomateManager_v2 Create(int version = 3, bool dailyPrintManager = false, bool useTestManager = false, bool test = false) //{ // CreateDownloadAutomateManager create = new CreateDownloadAutomateManager(); // create._version = version; // create._dailyPrintManager = dailyPrintManager; // //create._gapDayBefore = gapDayBefore; // //create._gapDayAfter = gapDayAfter; // create._useTestManager = useTestManager; // //create._traceLevel = traceLevel; // create._test = test; // return create._Create(); //} public DownloadAutomateManager Create() { // from DownloadAutomate_f.CreateDownloadAutomate_v2() // le 01/11/2014 désactive version 1 et version 2 // version 1 : utilise l'ancien FindPrintManager, l'ancienne liste de print dans print_list1.xml, l'ancien pattern de date FindPrints/Dates/Date avec l'ancien FindDateManager // version 2 : version 1 + le nouveau FindPrintManager_new avec le nouveau PrintTitleManager, la nouvelle liste de print dans print_list2.xml, // version 3 : version 2 + le nouveau pattern de date FindPrints/Dates/DateNew avec le nouveau FindDateManager_new // version 4 (not used) : version 3 + découpe le titre avec "du" ou "-" (PrintTitleManager) // version 5 : version 3 + new find date // version 6 : version 5 + printTitleManager version 2 + findPrintManager version 2 if (_version < 3 || _version > 6) throw new PBException("bad version {0}", _version); Trace.WriteLine("create download automate : version {0} useTestManager {1} traceLevel {2}", _version, _useTestManager, _traceLevel.zToStringOrNull()); //if (!_test) // _xeConfig = XmlConfig.CurrentConfig.GetElement("DownloadAutomateManager"); //else // _xeConfig = XmlConfig.CurrentConfig.GetElement("DownloadAutomateManager_Test"); _mongoDownloadAutomateManager = CreateMongoDownloadAutomateManager(); //_findPrintManager = CreateFindPrintManager(); _findPrintManager = FindPrintManagerCreator.Create(_xeConfig, _parameters, _version); _downloadManager = CreateDownloadManager(); _mailSender = CreateMailSender(); _mailMessage = CreateMailMessage(); _downloadAutomateManager = _CreateDownloadAutomateManager(); //InitServers(); //CreateServerManagers(); _downloadAutomateManager.Init(_xeConfig); _downloadAutomateManager.SetParameters(_parameters); TraceResult(); //if (!ControlDownloadManagerClient()) // throw new PBException("error DownloadManagerClient is not working"); if (_traceLevel != null) Trace.CurrentTrace.TraceLevel = (int)_traceLevel; //_downloadAutomateManager.Start(); return _downloadAutomateManager; }