Beispiel #1
0
        /// <summary>
        /// starts the Import of the given Directory
        /// </summary>
        public void Start()
        {
            Log.Logger.Info($"Import has been started:\nError-Directory: {ImportModel.ErrorDirectory}\nImport-Directory: {ImportModel.ImportDirectory}\nBackup-Directory: {ImportModel.BackupDirectory}");
            FileExporter fileExporter = new FileExporter(ImportModel, _fileHandler);

            fileExporter.Messenger = Messenger;
            _fileHandler.Messenger = Messenger;

            try
            {
                fileExporter.InitializeIdxBuilder();
                StartExport(fileExporter);
            } catch (Exception e)
            {
                Messenger.sendError(e);
            }
        }
Beispiel #2
0
        private void StartExport(FileExporter fileExporter)
        {
            long startTime       = DateTime.Now.Millisecond;
            int  fileImportCount = 0;

            foreach (IFileInfo exportFileInfo in _fileHandler.GetImportFiles(ImportModel.ErrorDirectory))
            {
                ExportFile exportFile = new ExportFile(exportFileInfo);
                exportFile.BuilData();

                if (exportFile.Data != null)
                {
                    fileExporter.Start(exportFile);
                    fileImportCount++;
                }
                else
                {
                    Messenger?.SendMessage($"{exportFile.File.Name} couldn't be exported!");
                }
            }
            Inform(fileImportCount, DateTime.Now.Millisecond - startTime);
        }