예제 #1
0
            public TemporaryFile DownloadFile()
            {
                var temp = new TemporaryFile();

                _pendingChange.DownloadShelvedFile(temp);
                _contentLength = new FileInfo(temp).Length;
                return(temp);
            }
예제 #2
0
            public Stream DownloadFile()
            {
                string temp = Path.GetTempFileName();

                _pendingChange.DownloadShelvedFile(temp);
                var stream = new TemporaryFileStream(temp);

                _contentLength = stream.Length;
                return(stream);
            }
        /// <summary>
        /// Compares the contents of two given files.
        /// </summary>
        /// <param name="firstPendingChange">The first pending change file.</param>
        /// <param name="secondPendingChange">The second pending change file</param>
        /// <returns>True if the file contents are same. False otherwise.</returns>
        private static bool AreFilesInPendingChangesSame(PendingChange firstPendingChange, PendingChange secondPendingChange)
        {
            if (firstPendingChange != null && secondPendingChange != null && firstPendingChange.ChangeType != ChangeType.Delete && secondPendingChange.ChangeType != ChangeType.Delete)
            {
                string pendingChangeFileName = Path.GetTempFileName();
                firstPendingChange.DownloadShelvedFile(pendingChangeFileName);

                string matchingFileName = Path.GetTempFileName();
                secondPendingChange.DownloadShelvedFile(matchingFileName);
                return(FileCompare(pendingChangeFileName, matchingFileName));
            }

            return(false);
        }
예제 #4
0
 /// <summary>
 /// Downloads the shelved file.
 /// </summary>
 /// <param name="filePathToDownloadFileTo">The file path to download file to.</param>
 public void DownloadShelvedFile(string filePathToDownloadFileTo)
 {
     _pendingChange.DownloadShelvedFile(filePathToDownloadFileTo);
 }
예제 #5
0
 public void Download(string destFolder) => _pendingChange.DownloadShelvedFile($"{destFolder}\\{Folder}\\{Name}");