public string ResolveName(TransferEntry sourceEntry) { AzureBlobEntry blobEntry = sourceEntry as AzureBlobEntry; Debug.Assert(blobEntry != null, "blobEntry"); return(NameResolverHelper.AppendSnapShotTimeToFileName(sourceEntry.RelativePath, blobEntry.Blob.SnapshotTime)); }
public string ResolveName(TransferEntry sourceEntry) { // 1) Unescape original string, original string is UrlEncoded. // 2) Replace Azure directory separator with Windows File System directory separator. // 3) Trim spaces at the end of the file name. string destinationRelativePath = EscapeInvalidCharacters(this.TranslateDelimiters(sourceEntry.RelativePath).TrimEnd(new char[] { ' ' })); // Split into path + filename parts. int lastSlash = destinationRelativePath.LastIndexOf(this.DirSeparator, StringComparison.Ordinal); string destinationFileName; string destinationPath; if (-1 == lastSlash) { destinationPath = string.Empty; destinationFileName = destinationRelativePath; } else { destinationPath = destinationRelativePath.Substring(0, lastSlash + 1); destinationFileName = destinationRelativePath.Substring(lastSlash + 1); } // Append snapshot time to filename. AzureBlobEntry blobEntry = sourceEntry as AzureBlobEntry; if (blobEntry != null) { destinationFileName = NameResolverHelper.AppendSnapShotTimeToFileName(destinationFileName, blobEntry.Blob.SnapshotTime); } // Combine path and filename back together again. destinationRelativePath = this.CombinePath(destinationPath, destinationFileName); return(destinationRelativePath); }