/** * Constructor for SparkleRepo (at every launch of CmisSync) */ public CmisDirectory(string localPath, SparkleConfig config, ActivityListener activityListener) { this.activityListener = activityListener; // Set local root folder. this.localRootFolder = Path.Combine(SparkleFolder.ROOT_FOLDER, localPath); database = new CmisDatabase(localRootFolder); // Get path on remote repository. remoteFolderPath = config.GetFolderOptionalAttribute(Path.GetFileName(localRootFolder), "remoteFolder"); cmisParameters = new Dictionary<string, string>(); cmisParameters[SessionParameter.BindingType] = BindingType.AtomPub; cmisParameters[SessionParameter.AtomPubUrl] = config.GetUrlForFolder(Path.GetFileName(localRootFolder)); cmisParameters[SessionParameter.User] = config.GetFolderOptionalAttribute(Path.GetFileName(localRootFolder), "user"); cmisParameters[SessionParameter.Password] = config.GetFolderOptionalAttribute(Path.GetFileName(localRootFolder), "password"); cmisParameters[SessionParameter.RepositoryId] = config.GetFolderOptionalAttribute(Path.GetFileName(localRootFolder), "repository"); syncing = false; }
/** * Constructor for SparkleFetcher (when a new CMIS folder is first added) */ public CmisDirectory(string canonical_name, string localPath, string remoteFolderPath, string url, string user, string password, string repositoryId, ActivityListener activityListener) { this.activityListener = activityListener; this.remoteFolderPath = remoteFolderPath; // Set local root folder. this.localRootFolder = Path.Combine(SparkleFolder.ROOT_FOLDER, canonical_name); database = new CmisDatabase(localRootFolder); cmisParameters = new Dictionary<string, string>(); cmisParameters[SessionParameter.BindingType] = BindingType.AtomPub; cmisParameters[SessionParameter.AtomPubUrl] = url; cmisParameters[SessionParameter.User] = user; cmisParameters[SessionParameter.Password] = password; cmisParameters[SessionParameter.RepositoryId] = repositoryId; syncing = false; }
public void TruncatePath() { CmisDatabase db = new CmisDatabase(@"C:\User Homes\nico\CmisSync\myfolder"); string shortened = db.Normalize(@"C:\User Homes\nico\CmisSync\myfolder\dir1\dir2\file.txt"); Assert.Equal("dir1/dir2/file.txt", shortened); }