/// <summary> /// Finalize the creation of a new CmisSync synchronized folder. /// </summary> public void FinishFetcher() { // Add folder to XML config file. ConfigManager.CurrentConfig.AddFolder(repoInfo); FolderFetched(this.fetcher.RemoteUrl.ToString()); // Initialize in the UI. AddRepository(repoInfo.TargetDirectory); FolderListChanged(); this.fetcher.Dispose(); this.fetcher = null; }
/// <summary> /// Create a new CmisSync synchronized folder. /// </summary> public void StartFetcher(string address, string remote_path, string local_path, string repository, string path, string user, string password, string localrepopath) { repoInfo = new RepoInfo(local_path, ConfigManager.CurrentConfig.ConfigPath); repoInfo.Address = new Uri(address); repoInfo.RemotePath = remote_path; repoInfo.RepoID = repository; repoInfo.User = user; repoInfo.Password = Crypto.Obfuscate(password); repoInfo.TargetDirectory = localrepopath; repoInfo.PollInterval = 5000; fetcher = new Fetcher(repoInfo, activityListenerAggregator); // Finish action. this.fetcher.Finished += delegate() { FinishFetcher(); }; this.FinishFetcher(); }
/// <summary> /// Stop fetching if failed /// TODO: necessary? /// </summary> public void StopFetcher() { if (Directory.Exists(this.fetcher.TargetFolder)) { try { Directory.Delete(this.fetcher.TargetFolder, true); Logger.Info("Deleted " + this.fetcher.TargetFolder); } catch (Exception e) { Logger.Info("Failed to delete " + this.fetcher.TargetFolder + ": " + e.Message); } } this.fetcher.Dispose(); this.fetcher = null; }
/// <summary> /// Create a new CmisSync synchronized folder. /// </summary> public void StartFetcher(string name, Uri address, string user, string password, string repository, string remote_path, string local_path, List<string> ignoredPaths) { repoInfo = new RepoInfo(name, ConfigManager.CurrentConfig.ConfigPath); repoInfo.Address = address; repoInfo.User = user; repoInfo.Password = password; repoInfo.RepoID = repository; repoInfo.RemotePath = remote_path; repoInfo.TargetDirectory = local_path; repoInfo.PollInterval = Config.DEFAULT_POLL_INTERVAL; foreach (string ignore in ignoredPaths) repoInfo.addIgnorePath(ignore); fetcher = new Fetcher(repoInfo, activityListenerAggregator); this.FinishFetcher(); }