Skip to content

Commit 0318e18

Browse files
committed
merge release/downloader-v1 into master. made some methods public so unit tests can run
1 parent eb3fda5 commit 0318e18

File tree

5 files changed

+11
-8
lines changed

5 files changed

+11
-8
lines changed

src/TerminalVelocity.Sharp/Downloader.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ public static int ComputeProgressIndicator(long bytesWritten, long fileSize)
294294

295295
}
296296

297-
internal Downloader(BufferManager bufferManager,
297+
public Downloader(BufferManager bufferManager,
298298
ILargeFileDownloadParameters parameters,
299299
ConcurrentQueue<ChunkedFilePart> writeQueue,
300300
ConcurrentStack<int> readStack,
@@ -431,7 +431,7 @@ internal static void ExecuteAndSquash( Action a)
431431
}
432432
}
433433

434-
internal static int ExpectedDownloadTimeInSeconds(int chunkSizeInBytes)
434+
public static int ExpectedDownloadTimeInSeconds(int chunkSizeInBytes)
435435
{
436436
//so lets say 128Kbps per second with no overhead takes 62 seconds for 1MB 64kb = 16384bytes
437437
//20% latency
@@ -443,12 +443,12 @@ internal static int ExpectedDownloadTimeInSeconds(int chunkSizeInBytes)
443443
}
444444

445445

446-
internal static long GetChunkStart(int currentChunk, int maxChunkSize)
446+
public static long GetChunkStart(int currentChunk, int maxChunkSize)
447447
{
448448
return currentChunk*(long)maxChunkSize;
449449
}
450450

451-
internal static int GetChunkCount(long fileSize, long chunkSize)
451+
public static int GetChunkCount(long fileSize, long chunkSize)
452452
{
453453
if (chunkSize == 0)
454454
return 0;
@@ -463,7 +463,7 @@ internal static int GetChunkCount(long fileSize, long chunkSize)
463463
return 1 + chunkCount;
464464
}
465465

466-
internal static int GetChunkSizeForCurrentChunk(long fileSize, int maxChunkSize, int zeroBasedChunkNumber)
466+
public static int GetChunkSizeForCurrentChunk(long fileSize, int maxChunkSize, int zeroBasedChunkNumber)
467467
{
468468
int chunkCount = GetChunkCount(fileSize, maxChunkSize);
469469

src/TerminalVelocity.Sharp/FailureToken.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
namespace Illumina.TerminalVelocity
55
{
6-
internal class FailureToken
6+
public class FailureToken
77
{
88
public bool FailureDetected { get; private set; }
99

src/TerminalVelocity.Sharp/LargeFileDownloadParameters.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ protected static FileStream CreateOutputStream(string filePath, long fileLength,
7979
return stream;
8080
}
8181

82-
internal static void EnsureCleanFile(string filePath, bool deleteIfExists)
82+
public static void EnsureCleanFile(string filePath, bool deleteIfExists)
8383
{
8484
if ((File.Exists(filePath) && deleteIfExists) || !File.Exists(filePath))
8585
{

src/TerminalVelocity.Sharp/SimpleHttpGetByRangeClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ protected void EnsureConnection(Uri uri, bool forceRebuild = false)
160160
}
161161

162162

163-
internal static string BuildHttpRequest(Uri uri, long start, long length)
163+
public static string BuildHttpRequest(Uri uri, long start, long length)
164164
{
165165
string hostHeader;
166166
// see if they provided a port explicitly in the URI. If so, that must be set in the header

tests/TerminalVelocity.Tests/TerminalVelocity.Tests.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@
7777
<ItemGroup>
7878
<Content Include="DownloadTests.SimpleGetClientGetsFirst100Bytes.approved.txt" />
7979
</ItemGroup>
80+
<ItemGroup>
81+
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
82+
</ItemGroup>
8083
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
8184
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
8285
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

0 commit comments

Comments
 (0)