Database to cache remote information from the CMIS server. Implemented with SQLite.
Inheritance: IDisposable
コード例 #1
0
ファイル: SyncItem.cs プロジェクト: weberale/CmisSync
        /// <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
ファイル: SyncItem.cs プロジェクト: weberale/CmisSync
        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
ファイル: SyncItem.cs プロジェクト: weberale/CmisSync
 /// <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
ファイル: SyncItem.cs プロジェクト: weberale/CmisSync
        /// <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
ファイル: SyncItem.cs プロジェクト: weberale/CmisSync
        /// <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
ファイル: SyncItem.cs プロジェクト: weberale/CmisSync
 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
ファイル: SyncItem.cs プロジェクト: weberale/CmisSync
 public static SyncItem CreateFromLocalPath(string path, bool isFolder, RepoInfo repoInfo, Database.Database database)
 {
     return(new LocalPathSyncItem(path, isFolder, repoInfo, database));
 }