private string GetIntegrationType(WatchConfiguration configuration) { var type = configuration.Integration.GetType(); var typeProperty = type.GetProperty("Type", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public); var integrationType = (string)typeProperty.GetValue(null); return(integrationType); }
public WatchConfiguration AddConfiguration(string sourceFolder, IIntegration integration) { var configuration = new WatchConfiguration(createId(), Path.GetFullPath(sourceFolder), integration); ActivateConfiguration(configuration); Save(); return(configuration); }
private void ActivateConfiguration(WatchConfiguration configuration) { if (!activeWatcher.ContainsKey(configuration.Folder)) { var watcher = new FileSystemWatcher(configuration.Folder); watcher.EnableRaisingEvents = true; watcher.Created += (s, e) => ExecuteIntegrations(e.FullPath); } //if there is already a watcher for the folder, the configuration will be automatically catched by ExecuteIntegrations configurations.Add(configuration); }