RemoteToLocal() публичный Метод

Return the remote path of an item identified by its local path. If no such item exist yet in database (ex: new local file), returns the remote path it should be written to.
public RemoteToLocal ( string remotePath, bool isFolder ) : string
remotePath string
isFolder bool
Результат string
Пример #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
        /// <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);
        }