Esempio n. 1
0
        void OnFilesChanged(List <string> changed_files_in_basedir)
        {
            var triggered_repos = new List <string> ();

            foreach (string file_path in changed_files_in_basedir)
            {
                string [] paths = file_path.Split(Path.DirectorySeparatorChar);

                if (paths.Length < 2)
                {
                    continue;
                }

                BaseRepository repo = GetRepoByName(paths [1]);

                if (repo != null && !triggered_repos.Contains(repo.Name))
                {
                    FileActivityTask task = MacFileActivityTask(repo,
                                                                new FileSystemEventArgs(WatcherChangeTypes.Changed, file_path, "Unknown"));

                    task();
                    triggered_repos.Add(repo.Name);
                }
            }
        }
Esempio n. 2
0
        public override void Initialize()
        {
            base.Initialize();

            SparkleRepoBase.UseCustomWatcher = true;
            this.watcher = new SparkleMacWatcher(Program.Controller.FoldersPath);

            this.watcher.Changed += delegate(string path) {
                FileSystemEventArgs fse_args = new FileSystemEventArgs(WatcherChangeTypes.Changed, path, "Unknown_File");
                FileActivityTask [] tasks    = new FileActivityTask [Repositories.Length];

                // FIXME: There are cases where the wrong repo is triggered, so
                // we trigger all of them for now. Causes only slightly more overhead
                int i = 0;
                foreach (SparkleRepoBase repo in Repositories)
                {
                    tasks [i] = MacActivityTask(repo, fse_args);
                    tasks [i] ();
                    i++;
                }
            };
        }
        public override void Initialize ()
        {
            base.Initialize ();

            SparkleRepoBase.UseCustomWatcher = true;
            this.watcher = new SparkleMacWatcher (Program.Controller.FoldersPath);

            this.watcher.Changed += delegate (string path) {
                FileSystemEventArgs fse_args = new FileSystemEventArgs (WatcherChangeTypes.Changed, path, "Unknown_File");
                FileActivityTask [] tasks = new FileActivityTask [Repositories.Length];

                // FIXME: There are cases where the wrong repo is triggered, so
                // we trigger all of them for now. Causes only slightly more overhead
                int i = 0;
                foreach (SparkleRepoBase repo in Repositories) {
                    tasks [i] = MacActivityTask (repo, fse_args);
                    tasks [i] ();
                    i++;
                }
            };

        }
Esempio n. 4
0
        private void OnFilesChanged(List <string> changed_files_in_basedir)
        {
            List <string> triggered_repos = new List <string> ();

            foreach (string file in changed_files_in_basedir)
            {
                string repo_name;
                int    path_sep_index = file.IndexOf(Path.DirectorySeparatorChar);

                if (path_sep_index >= 0)
                {
                    repo_name = file.Substring(0, path_sep_index);
                }
                else
                {
                    repo_name = file;
                }

                repo_name = Path.GetFileNameWithoutExtension(repo_name);
                SparkleRepoBase repo = GetRepoByName(repo_name);

                if (repo == null)
                {
                    continue;
                }

                if (!triggered_repos.Contains(repo_name))
                {
                    triggered_repos.Add(repo_name);

                    FileActivityTask task = MacActivityTask(repo,
                                                            new FileSystemEventArgs(WatcherChangeTypes.Changed, file, "Unknown"));

                    task();
                }
            }
        }