// Access Files from a directory private static async Task ProcessDirectory(string directoryPath, string fileType, CloudStorageAccount storageAccount) { switch (fileType) { case "txt": string[] files = Directory.GetFiles(directoryPath, ".txt"); foreach (var filePath in files) { var fileProcessor = new FileProcessor(filePath); await fileProcessor.Process(storageAccount); } break; case "csv": string[] csvFiles = Directory.GetFiles(directoryPath, ".csv"); foreach (var filePath in csvFiles) { var fileProcessor = new FileProcessor(filePath); await fileProcessor.Process(storageAccount); } break; case "json": string[] jsonFiles = Directory.GetFiles(directoryPath, ".json"); foreach (var filePath in jsonFiles) { var fileProcessor = new FileProcessor(filePath); await fileProcessor.Process(storageAccount); } break; default: Console.WriteLine($"Error {fileType} is not supported!"); break; } }
private static async Task ProcessSingleFile(string filePath, CloudStorageAccount storageAccount) { var fileProcessor = new FileProcessor(filePath); await fileProcessor.Process(storageAccount); }