private void ProcessFile(string fileInfo) { ServiceLogger.LogInfo("ProcessFile() - Start"); string[] file = fileInfo.Split('|'); WatcherChangeTypes changeType; WatcherChangeTypes.TryParse(file[0], true, out changeType); string filepath = file[1]; if (!File.Exists(filepath)) { ServiceLogger.LogInfo("File is not exist, File name: " + filepath); return; } // Check if file is accessble if (!WaitReady(filepath, SmartWatcherService.SettingsReadTries)) { ServiceLogger.LogInfo("File can be opened with write permission, File name: " + filepath); return; } foreach (IPlugin plugin in SmartWatcherService.lstPlugins) { string strFiletr = plugin.Filter.Replace("*", @"\\*"); Match match = Regex.Match(Path.GetFileName(filepath), strFiletr); if (match.Success == true) { Func<string, bool> pluginFunc = null; switch (changeType) { case WatcherChangeTypes.Created: { pluginFunc = plugin.FileCreated; break; } case WatcherChangeTypes.Changed: { pluginFunc = plugin.FileChanged; break; } case WatcherChangeTypes.Renamed: { pluginFunc = plugin.FileRenamed; break; } case WatcherChangeTypes.Deleted: { pluginFunc = plugin.FileDeleted; break; } } ServiceLogger.LogInfo("ProcessPluginAction, Plugin Name: " + plugin.Name); ProcessPluginAction(pluginFunc, filepath, plugin.ArchiveFiles, plugin.DeleteFiles, plugin.FilePrefix, plugin.ZipPassword); } } ServiceLogger.LogInfo("ProcessFile() - Finish"); }