/// <summary> /// Update repository settings. /// </summary> public virtual void UpdateSettings(string password, int pollInterval) { //Get configuration Config config = ConfigManager.CurrentConfig; CmisSync.Lib.Config.SyncConfig.Folder syncConfig = config.getFolder(this.Name); //Pause sync this.remote_timer.Stop(); if (Status == SyncStatus.Idle) { Suspend(); } //Update password... if (!String.IsNullOrEmpty(password)) { this.RepoInfo.Password = new CmisSync.Auth.CmisPassword(password.TrimEnd()); syncConfig.ObfuscatedPassword = RepoInfo.Password.ObfuscatedPassword; Logger.Debug("Updated \"" + this.Name + "\" password"); } //Update poll interval this.RepoInfo.PollInterval = pollInterval; this.remote_timer.Interval = pollInterval; syncConfig.PollInterval = pollInterval; Logger.Debug("Updated \"" + this.Name + "\" poll interval: " + pollInterval); //Save configuration config.Save(); //Always resume sync... Resume(); this.remote_timer.Start(); }
/// <summary> /// Called when sync completes. /// </summary> public void OnSyncComplete(bool syncFull) { if (syncFull) { remote_timer.Start(); last_sync = DateTime.Now; } else { last_partial_sync = DateTime.Now; } if (Watcher.GetChangeCount() > 0) { //Watcher was stopped (due to error) so clear and restart sync Watcher.Clear(); } Watcher.EnableRaisingEvents = true; Watcher.EnableEvent = true; Logger.Info((syncFull ? "Full" : "Partial") + " Sync Complete: " + LocalPath); // Save last sync RepoInfo.LastSuccessedSync = DateTime.Now; //Get configuration Config config = ConfigManager.CurrentConfig; CmisSync.Lib.Config.SyncConfig.Folder syncConfig = config.getFolder(this.Name); syncConfig.LastSuccessedSync = RepoInfo.LastSuccessedSync; config.Save(); }
/// <summary> /// Restart syncing. /// </summary> public virtual void Resume() { Status = SyncStatus.Idle; RepoInfo.IsSuspended = false; //Get configuration Config config = ConfigManager.CurrentConfig; CmisSync.Lib.Config.SyncConfig.Folder syncConfig = config.getFolder(this.Name); syncConfig.IsSuspended = false; config.Save(); }
/// <summary> /// Stop syncing momentarily. /// </summary> public void Suspend() { Status = SyncStatus.Suspend; RepoInfo.IsSuspended = true; //Get configuration Config config = ConfigManager.CurrentConfig; CmisSync.Lib.Config.SyncConfig.Folder syncConfig = config.getFolder(this.Name); syncConfig.IsSuspended = true; config.Save(); }