private static void ProcessFiles(Object stateInfo)
 {
     foreach (var fileName in FilesToProcess.Keys) // May not be in order of adding
     {
         if (FilesToProcess.TryRemove(fileName, out _))
         {
             var fileProcessor = new FileProcessor(fileName);
             fileProcessor.Process();
         }
     }
 }
Beispiel #2
0
 private static void ProcessFiles(object stateInfo)
 {
     foreach (var fileName in FilesToProcess.Keys)
     {
         if (FilesToProcess.TryRemove(fileName, out _))
         {
             var fileProcessor = new FileProcessor(fileName);
             fileProcessor.Process();
         }
     }
 }
Beispiel #3
0
        private static void ProcessFile(CacheEntryRemovedArguments args)
        {
            WriteLine($"* Cahce item removed: {args.CacheItem.Key} because {args.RemovedReason}");

            if (args.RemovedReason == CacheEntryRemovedReason.Expired)
            {
                var fileProcessor = new FileProcessor(args.CacheItem.Key);
                fileProcessor.Process();
            }
            else
            {
                WriteLine($"WARNING: {args.CacheItem.Key} was removed unexpectedly and may not be...");
            }
        }
Beispiel #4
0
        /// <summary>
        /// Process the File using Caching
        /// </summary>
        /// <param name="arguments"></param>
        private static void ProcessFile(CacheEntryRemovedArguments arguments)
        {
            Console.WriteLine($"* Cache item removed: {arguments.CacheItem.Key} due to {arguments.RemovedReason}");

            if (arguments.RemovedReason == CacheEntryRemovedReason.Expired)
            {
                var fileProcessor = new FileProcessor(arguments.CacheItem.Key);
                fileProcessor.Process();
            }
            else
            {
                Console.WriteLine($"WARNING: {arguments.CacheItem.Key} was removed unexpectedly");
            }
        }
Beispiel #5
0
        private static void ProcessDirectory(string directoryPath, string fileType)
        {
            switch (fileType)
            {
            case "TEXT":
                string[] textFiles = Directory.GetFiles(directoryPath, "*.txt");
                foreach (var textFilePath in textFiles)
                {
                    var fileProcessor = new FileProcessor(textFilePath);
                    fileProcessor.Process();
                }
                break;

            default:
                WriteLine($"ERROR: {fileType} is not supported.");
                break;
            }
        }
Beispiel #6
0
        private static void ProcessDirectory(string dirpath, string fileType)
        {
            //var allFiles = Directory.GetFiles(dirpath);

            switch (fileType)
            {
            case "TEXT":
                string[] textFiles = Directory.GetFiles(dirpath, "*.txt");
                foreach (var textFilePath in textFiles)
                {
                    var fileProcessor = new FileProcessor(textFilePath);
                    fileProcessor.Process();
                }
                break;

            default:
                Console.WriteLine($"ERROR: {fileType} is NOT supported");
                return;
            }
        }
Beispiel #7
0
        private static void ProcessDirectory(string directoryPath, string fileType)
        {
            //throw new NotImplementedException();
            //var allFiles = Directory.GetFiles(directoryPath); // to get all files
            switch (fileType)
            {
            case "TEXT":
                string[] textFiles = Directory.GetFiles(directoryPath, "*.txt");
                foreach (var textFilePath in textFiles)
                {
                    var fileProcessor = new FileProcessor(textFilePath);
                    fileProcessor.Process();
                }
                break;

            default:
                WriteLine($"错误 {fileType} is not supported");
                return;
            }
        }
Beispiel #8
0
        private static void ProcessFiles(CacheEntryRemovedArguments args)
        {
            WriteLine($"* Cache item removed: {args.CacheItem.Key} because {args.RemovedReason}");

            if (args.RemovedReason == CacheEntryRemovedReason.Expired)
            {
                var fileProcessor = new FileProcessor(args.CacheItem.Key);
                fileProcessor.Process();
            }
            else
            {
                WriteLine($"WARNING: {args.CacheItem.Key} was removed unexpectedly and may not be avaiable.");
            }

            /*foreach (var fileName in FilesToProcess.Keys) // May not be in order of adding
             * {
             *  if (FilesToProcess.TryRemove(fileName, out _))
             *  {
             *      var fileProcessor = new FileProcessor(fileName);
             *      fileProcessor.Process();
             *  }
             * }
             */
        }
Beispiel #9
0
        private static void ProcessSingleFile(string filePath)
        {
            var fileProcessor = new FileProcessor(filePath);

            fileProcessor.Process();
        }