Ejemplo n.º 1
0
        public async Task <List <OutputFileModel> > ProcessXml()
        {
            HtmlOutputs = new ConcurrentQueue <string>();

            //create output directory if it does not exist
            Directory.CreateDirectory(_airTicketsSettings.OutputHtmlPath);
            TryDeleteExistingOutputFiles();//useful when retrying to generate files
            //Copy css file
            if (File.Exists(Path.Combine(_airTicketsSettings.ProjectPath, "Resources/style.css")))
            {
                File.Copy(Path.Combine(_airTicketsSettings.ProjectPath, "Resources/style.css"), Path.Combine(_airTicketsSettings.OutputHtmlPath, "style.css"));
            }

            //Read xml and write to html in 2 separate async tasks
            await EnqueueHtmls().ConfigureAwait(false);
            await DequeueAndWriteHtmls().ConfigureAwait(false);

            //return converted html files
            var htmlFiles = _fileReadService.GetFile(_airTicketsSettings.OutputHtmlPath, "*.html");

            return(_fileReadService.GetFiles(htmlFiles, _airTicketsSettings.OutputHtmlPath));
        }
Ejemplo n.º 2
0
        public IEnumerable <OutputFileModel> Get()
        {
            var xmlFiles = _fileReadService.GetFile(Path.Combine(_airTicketsSettings.ProjectPath, "Data/Computers"), "*.xml");

            return(_fileReadService.GetFiles(xmlFiles, Path.Combine(_airTicketsSettings.ProjectPath, "Data\\Computers\\")));
        }