Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        public WatchConfiguration AddConfiguration(string sourceFolder, IIntegration integration)
        {
            var configuration = new WatchConfiguration(createId(), Path.GetFullPath(sourceFolder), integration);

            ActivateConfiguration(configuration);
            Save();
            return(configuration);
        }
Esempio n. 3
0
        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);
        }