public void CreateDirectories(string tempdir, string targetdir)
        {
            if (!_fileSystemHelper.DirectoryExists(tempdir))
            {
                _fileSystemHelper.CreateDirectory(tempdir);
            }

            if (!_fileSystemHelper.DirectoryExists(targetdir))
            {
                _fileSystemHelper.CreateDirectory(targetdir);
            }
        }
Ejemplo n.º 2
0
 public HtmlFileWriter(DirectoryInfo htmlDirectoryInfo, DirectoryInfo resourcesDirectoryInfo, IFileSystemHelper fileSystemHelper)
 {
     _fileSystemHelper       = fileSystemHelper;
     _htmlDirectoryInfo      = htmlDirectoryInfo;
     _resourcesDirectoryInfo = resourcesDirectoryInfo;
     if (!_htmlDirectoryInfo.Exists)
     {
         _fileSystemHelper.CreateDirectory(_htmlDirectoryInfo.FullName);
     }
     _xsltString = LoadXsltString();
     CopyCssToOutputDirectory();
 }
        /// <inheritdoc />
        public async Task Update(bool updateFile = true)
        {
            _logger.LogInformation("Starting updating to latest OSM file.");
            var workingDirectory  = Path.Combine(_options.BinariesFolder, OSM_C_TOOLS_FOLDER);
            var directoryContents = _fileProvider.GetDirectoryContents(OSM_C_TOOLS_FOLDER);

            if (!directoryContents.Any())
            {
                _fileSystemHelper.CreateDirectory(workingDirectory);
            }
            await DownloadDailyOsmFile(workingDirectory);

            if (updateFile)
            {
                UpdateFileToLatestVersion(workingDirectory);
            }
            _logger.LogInformation("Finished updating to latest OSM file.");
        }
Ejemplo n.º 4
0
        /// <inheritdoc />
        public async Task <Stream> Get(bool updateFile = true)
        {
            var workingDirectory  = Path.Combine(_options.BinariesFolder, OSM_C_TOOLS_FOLDER);
            var directoryContents = _fileProvider.GetDirectoryContents(OSM_C_TOOLS_FOLDER);

            if (!directoryContents.Any())
            {
                _fileSystemHelper.CreateDirectory(workingDirectory);
            }
            await DownloadDailyOsmFile(workingDirectory);

            if (updateFile)
            {
                UpdateFileToLatestVersion(workingDirectory);
            }
            var fileInfo = _fileProvider.GetFileInfo(Path.Combine(OSM_C_TOOLS_FOLDER, Sources.OSM_FILE_NAME));

            return(fileInfo.CreateReadStream());
        }