Database to cache remote information from the CMIS server. Implemented with SQLite.
상속: IDisposable
예제 #1
0
        /// <summary>
        /// Create from the path of a remote file, and the local filename to use.
        /// </summary>
        /// <param name="remoteRelativePath">Example: adir/a<file</param>
        /// <param name="localFilename">Example: afile.txt</param>
        public RemotePathSyncItem(string remoteRelativePath, string localFilename, RepoInfo repoInfo, Database.Database database)
        {
            this.isFolder   = false;
            this.database   = database;
            this.localRoot  = repoInfo.TargetDirectory;
            this.remoteRoot = repoInfo.RemotePath;

            this.remoteRelativePath = remoteRelativePath;
            if (remoteRelativePath.StartsWith(this.remoteRoot))
            {
                this.remoteRelativePath = this.remoteRelativePath.Substring(localRoot.Length).TrimStart(CmisUtils.CMIS_FILE_SEPARATOR);
            }

            int    lastSeparator        = remoteRelativePath.LastIndexOf(CmisUtils.CMIS_FILE_SEPARATOR);
            string remoteRelativeFolder = lastSeparator >= 0 ?
                                          remoteRelativePath.Substring(0, lastSeparator)
                : String.Empty;
            string remoteRelativePathWithCorrectLeafname = CmisUtils.PathCombine(remoteRelativeFolder, localFilename);

            localRelativePath = database.RemoteToLocal(remoteRelativePathWithCorrectLeafname, isFolder);
        }
예제 #2
0
        public RemotePathSyncItem(string remoteFolderPath, string remoteDocumentName, string localFilename, bool isFolder, RepoInfo repoInfo, Database.Database database)
        {
            this.isFolder   = isFolder;
            this.database   = database;
            this.localRoot  = repoInfo.TargetDirectory;
            this.remoteRoot = repoInfo.RemotePath;

            this.remoteRelativePath = remoteFolderPath;
            if (remoteRelativePath.StartsWith(this.remoteRoot))
            {
                this.remoteRelativePath = remoteRelativePath.Substring(this.remoteRoot.Length).TrimStart(CmisUtils.CMIS_FILE_SEPARATOR);
            }
            this.localRelativePath = localFilename;
        }
예제 #3
0
 /// <summary>
 /// Create sync item from the path of a remote folder.
 /// </summary>
 /// <param name="remoteFolderPath">Example: /sites/aproject/adir</param>
 public static SyncItem CreateFromRemoteFolder(string remoteFolderPath, RepoInfo repoInfo, Database.Database database)
 {
     return(new RemotePathSyncItem(remoteFolderPath, true, repoInfo, database));
 }
예제 #4
0
        /// <summary>
        /// Only use for documents!
        /// </summary>
        public static SyncItem CreateFromRemoteDocument(string remoteDocumentPath, IDocument remoteDocument, RepoInfo repoInfo, Database.Database database)
        {
            string remoteFolderPath           = remoteDocumentPath.Substring(0, remoteDocumentPath.LastIndexOf(CmisUtils.CMIS_FILE_SEPARATOR));
            string remoteRoot                 = repoInfo.RemotePath;
            string relativeRemoteDocumentPath = remoteDocumentPath.Substring(remoteRoot.Length).TrimStart(CmisUtils.CMIS_FILE_SEPARATOR);

            string remoteDocumentName = repoInfo.CmisProfile.localFilename(remoteDocument);

            RemotePathSyncItem item = new RemotePathSyncItem(relativeRemoteDocumentPath, remoteDocumentName, repoInfo, database);

            return(item);
        }
예제 #5
0
        /// <summary>
        /// Only use for documents!
        /// </summary>
        public static SyncItem CreateFromRemoteDocument(string remoteDocumentPath, string localFilename, RepoInfo repoInfo, Database.Database database)
        {
            string remoteFolderPath   = remoteDocumentPath.Substring(0, remoteDocumentPath.LastIndexOf(CmisUtils.CMIS_FILE_SEPARATOR));
            string remoteDocumentName = remoteDocumentPath.Substring(remoteDocumentPath.LastIndexOf(CmisUtils.CMIS_FILE_SEPARATOR) + 1); // 1 is the length of CMIS_FILE_SEPARATOR as it is a character

            RemotePathSyncItem item = new RemotePathSyncItem(remoteFolderPath, remoteDocumentName, localFilename, false, repoInfo, database);

            return(item);
        }
예제 #6
0
 public static SyncItem CreateFromLocalPath(string folder, string fileName, bool isFolder, RepoInfo repoInfo, Database.Database database)
 {
     return(new LocalPathSyncItem(Path.Combine(folder, fileName), isFolder, repoInfo, database));
 }
예제 #7
0
 public static SyncItem CreateFromLocalPath(string path, bool isFolder, RepoInfo repoInfo, Database.Database database)
 {
     return(new LocalPathSyncItem(path, isFolder, repoInfo, database));
 }