Ejemplo n.º 1
0
        private static void ProcessSingleFile(string filePath)
        {
            //throw new NotImplementedException(); 这个自动生成的,注释掉
            var fileProcessor = new FileProcessor(filePath);

            fileProcessor.Process();
        }
Ejemplo n.º 2
0
        private static void FileChanged(object sender, FileSystemEventArgs e)
        {
            WriteLine($"* File changed: {e.Name} - type: {e.ChangeType}");

            var fileProcessor = new FileProcessor(e.FullPath);

            fileProcessor.Process();
        }
 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();
         }
     }
 }
Ejemplo n.º 4
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();
         }
     }
 }
Ejemplo n.º 5
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...");
            }
        }
Ejemplo n.º 6
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");
            }
        }
Ejemplo n.º 7
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;
            }
        }
Ejemplo n.º 8
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;
            }
        }
Ejemplo n.º 9
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;
            }
        }
Ejemplo n.º 10
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();
             *  }
             * }
             */
        }
Ejemplo n.º 11
0
        private static void ProcessSingleFile(string filePath)
        {
            var fileProcessor = new FileProcessor(filePath);

            fileProcessor.Process();
        }