/// <summary>
        ///
        /// </summary>
        /// <param name="jobIdParameters"></param>
        internal static void ScheduleJobs(List <string> jobIdParameters)
        {
            DateTime startTime = DateTime.Now;

            log.Info(LocalizationService.FormatResourceString("JobSchedulerMessage01", startTime));
            ErrorControlService.GetService().StartRuntimeStopwatch();
            JobManager manager = JobManager.GetJobManager();

            if (manager.AllJobs == null)
            {
                return;
            }

            int           jobCount = manager.AllJobs.Count;
            List <string> jobIds   = new(jobCount);

            for (int i = 0; i < jobCount; i++)
            {
                JobConfig jobConfig = manager.AllJobs[i];
                if (jobConfig == null)
                {
                    continue;
                }

                ExitWhenInvalidId(jobIds, jobConfig.Id);

                InitNewThread(jobIdParameters, jobIds, jobConfig);
            }

            LogTime(startTime);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="element"></param>
        /// <returns></returns>
        internal async Task <List <Element> > CrawlAttachementsAsync(Element element)
        {
            ConverterService converter        = new();
            List <Element>   attachements     = new();
            StatisticService statisticService = StatisticService.GetService(_jobConfig.Id);

            foreach (var attachementName in element.AttachementNames)
            {
                ConverterResult res;
                try
                {
                    res = await converter.ConvertAttachementAsync(element, attachementName);
                }
                catch
                {
                    _log.Error(LocalizationService.FormatResourceString("AttachementCrawlerMessage01", attachementName, element.Id));
                    ErrorControlService.GetService().IncreaseErrorCount();
                    continue;
                }
                Element attachement = element.Clone() as Element;
                OverwriteAttachementValues(attachement, res, attachementName);
                attachements.Add(attachement);
                statisticService.IncreaseFoundDocumentsCount();
            }
            return(attachements);
        }
 /// <summary>
 ///
 /// </summary>
 /// <param name="element"></param>
 /// <param name="context"></param>
 /// <param name="isIndexingSuccess"></param>
 private void MarkElementFound(Element element, ElementLogContext context, bool isIndexingSuccess)
 {
     if (isIndexingSuccess)
     {
         context.SetElementFound(element, _jobConfig.Id, true);
         _log.Info(LocalizationService.FormatResourceString("CrawlerIndexerInterfaceMessage06", element.Id));
         StatisticService.GetService(_jobConfig.Id).IncreaseIndexedDocumentsCount();
     }
     else
     {
         _log.Error(LocalizationService.FormatResourceString("CrawlerIndexerInterfaceMessage08", element.Id));
         ErrorControlService.GetService().IncreaseErrorCount();
     }
 }
        /// <summary>
        ///
        /// </summary>
        /// <param name="jobConfig"></param>
        private static void RunJob(JobConfig jobConfig)
        {
            JobManager.GetJobManager().SelectedJobConfig = jobConfig;
            PublicationCrawler crawler = new();

            crawler.Initialize();
            crawler.StartCrawling();
            crawler.CompleteCrawling();
            StatisticService.GetService(jobConfig.Id).PrintStatistic();
            ErrorControlService.GetService().PrintErrorStatistic();
            StatisticService service = StatisticService.GetService(jobConfig.Id);
            string           text    = LocalizationService.FormatResourceString("MailClientMessage01",
                                                                                jobConfig.Id,
                                                                                DateTime.Now,
                                                                                service.FoundDocumentsCount,
                                                                                service.IndexedDocumentsCount,
                                                                                service.RemovedDocumentsCount);

            new MailService(jobConfig).SendMail(text);
        }