public void CreateDirectoryShouldSucceed()
        {
            const string directoryName = "testdirectory";

            fileStorage.CreateDirectory(directoryName);

            Assert.True(fileStorage.DirectoryExists(directoryName));
        }
Esempio n. 2
0
        private IFile GetWorkingFileInfo(IFile droppedFile, Guid processId)
        {
            string directory = Path.Combine(
                _settings.ServiceWorkingDirectory,
                processId.ToString().Replace("-", "_"));

            _fileStorage.CreateDirectory(directory);

            return(_fileStorage.GetFile(Path.Combine(directory, droppedFile.FileName)));
        }
Esempio n. 3
0
        public Task WriteFilesToDirectory <T>(string originalFilePath, ConcurrentBag <T> fileList)
        {
            var sw = Stopwatch.StartNew();

            try
            {
                var absoluteFilePath      = _fileStorage.GetAbsoluteFilePath(originalFilePath);
                var absoluteDirectoryPath = _fileStorage.GetAbsoluteDirectoryPath(absoluteFilePath);
                var storeFileName         =
                    absoluteFilePath.Replace("[CURRENTDATE]", DateTime.Now.ToString("yyyyMMdd"));
                _logger.Information($"check if storage directory <{storeFileName}> exists, if not try to create it.");
                var directoryExists = _fileStorage.DirectoryExists(absoluteDirectoryPath) ||
                                      _fileStorage.CreateDirectory(absoluteDirectoryPath);

                if (directoryExists)
                {
                    return(_fileStorage.WriteAllDataAsync(fileList, storeFileName));
                }

                _logger.Warning(
                    $"cannot write files to path {storeFileName}, directory does not exists and cannot be created!");
                return(Task.CompletedTask);
            }
            finally
            {
                sw.Stop();
                _logger.Information("Processed {MethodName} in {ElapsedMs:000} ms", "WriteFilesToDirectory",
                                    sw.ElapsedMilliseconds);
            }
        }
        private void CreateLanguageFile(string language, string physicalPath)
        {
            var doc = new XDocument(
                new XDeclaration(version: "1.0", encoding: "utf-8", standalone: "yes"),
                new XElement("languages",
                             new XElement("language",
                                          new XAttribute("name", new CultureInfo(language).EnglishName),
                                          new XAttribute("id", language.ToLower())))
                );

            _storage.CreateDirectory(Path.GetDirectoryName(physicalPath));
            _xml.Save(doc, physicalPath);
        }
 public void CreateDirectory(IOConnectionInfo ioc, string newDirName)
 {
     _baseStorage.CreateDirectory(ioc, newDirName);
 }