// Adds a repository to the list of repositories private void AddRepository(string folder_path) { if (folder_path.Equals(SparkleConfig.DefaultConfig.TmpPath)) { return; } string folder_name = Path.GetFileName(folder_path); string backend = SparkleConfig.DefaultConfig.GetBackendForFolder(folder_name); if (backend == null) { return; } SparkleRepoBase repo = new SparkleRepoGit(folder_path, SparkleBackend.DefaultBackend); repo.NewChangeSet += delegate(SparkleChangeSet change_set) { if (NotificationRaised != null) { NotificationRaised(change_set); } }; repo.NewNote += delegate(SparkleUser user) { if (NoteNotificationRaised != null) { NoteNotificationRaised(user, repo.Name); } }; repo.ConflictResolved += delegate { if (ConflictNotificationRaised != null) { ConflictNotificationRaised(); } }; repo.SyncStatusChanged += delegate(SyncStatus status) { /* if (status == SyncStatus.SyncUp) { * foreach (string path in repo.UnsyncedFilePaths) * Console.WriteLine (path); * } */ if (status == SyncStatus.Idle || status == SyncStatus.SyncUp || status == SyncStatus.SyncDown || status == SyncStatus.Error) { UpdateState(); } }; repo.ChangesDetected += delegate { UpdateState(); }; Repositories.Add(repo); }
// Adds a repository to the list of repositories private void AddRepository(string folder_path) { if (folder_path.Equals(SparkleConfig.DefaultConfig.TmpPath)) { return; } string folder_name = Path.GetFileName(folder_path); string backend = SparkleConfig.DefaultConfig.GetBackendForFolder(folder_name); if (backend == null) { return; } SparkleRepoBase repo = new SparkleRepoGit(folder_path, SparkleBackend.DefaultBackend); repo.NewChangeSet += delegate(SparkleChangeSet change_set) { if (NotificationRaised != null) { NotificationRaised(change_set); } }; repo.NewNote += delegate(SparkleUser user) { if (NoteNotificationRaised != null) { NoteNotificationRaised(user, repo.Name); } }; repo.ConflictResolved += delegate { if (ConflictNotificationRaised != null) { ConflictNotificationRaised(); } }; repo.SyncStatusChanged += delegate(SyncStatus status) { if (status == SyncStatus.Idle) { ProgressPercentage = 0.0; ProgressSpeed = ""; } if (status == SyncStatus.Idle || status == SyncStatus.SyncUp || status == SyncStatus.SyncDown || status == SyncStatus.Error) { UpdateState(); } }; repo.SyncProgressChanged += delegate(double percentage, string speed) { ProgressPercentage = percentage; ProgressSpeed = speed; UpdateState(); }; repo.ChangesDetected += delegate { UpdateState(); }; Repositories.Add(repo); }