public void Execute(string dataFolder) { foreach (var x in directory.EnumerateFiles(dataFolder, "test*.xml")) { //... } }
public ImageRepository(HttpServerUtilityBase server, IDirectoryService directory, string rootPath) { string path = server.MapPath(rootPath); var files = directory.EnumerateFiles(path, "*.jpg"); foreach (var file in files) { string imageUrl = VirtualPathUtility.Combine(VirtualPathUtility.AppendTrailingSlash(rootPath), Path.GetFileName(file)); string metaPath = file + ".meta"; using (var reader = directory.GetReader(metaPath)) { _images.Add(new ImageMetadata(imageUrl, reader)); } } }
public ImageRepository(HttpServerUtilityBase server, IDirectoryService directory, string rootPath) { string path = server.MapPath(rootPath); var files = directory.EnumerateFiles(path, "*.jpg"); foreach (var file in files) { string imageUrl = VirtualPathUtility.Combine(VirtualPathUtility.AppendTrailingSlash(rootPath), Path.GetFileName(file)); string metaPath = file + ".meta"; using (var reader = directory.GetReader(metaPath)) { _images.Add(new ImageMetadata(imageUrl, reader)); } } }
public async Task <bool> Execute(string tipoProjeto, string nomeProjeto) { try { foreach (var item in DirectoryService.GetDirectories(nomeProjeto)) { var newPath = item.Replace(Constante.GetIdentifier(), Constante.GetPathOutput()); DirectoryService.CreateDirectory(newPath); } foreach (var item in from files in DirectoryService.EnumerateFiles() where files.Split('.').Last() != "suo" select new { File = files } ) { var newPath = item.File.Replace( Constante.GetIdentifier(), Constante.GetPathOutput() ).Replace( Constante.GetNameTemplate(), nomeProjeto ); File.Copy(item.File, newPath, false); await File.WriteAllTextAsync( newPath, File.ReadAllText(newPath) .Replace( Constante.GetNameTemplate(), nomeProjeto ) ); } DirectoryService.MoveDirectory(tipoProjeto, nomeProjeto); Process.Start( $"_Config/open.bat", $"{Constante.GetFullPath(tipoProjeto, nomeProjeto)}\\{Constante.GetIdentifier()}" ); return(true); } catch (Exception ex) { Console.WriteLine($"Gerado Error: {ex.Message}", ConsoleColor.Red); return(false); } }
private List <string> GetRedistFilesInFolder(string folder) { return(_directoryService.EnumerateFiles(folder).Where(x => _redistFiles.Any(y => y.Key.IsMatch(x))).ToList()); }