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();
         }
     }
 }
示例#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();
         }
     }
 }
示例#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...");
            }
        }
示例#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");
            }
        }
示例#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;
            }
        }
示例#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;
            }
        }
示例#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;
            }
        }
示例#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();
             *  }
             * }
             */
        }
示例#9
0
        private static void ProcessSingleFile(string filePath)
        {
            var fileProcessor = new FileProcessor(filePath);

            fileProcessor.Process();
        }