private void Reset() { mContentSize = 0; mDownloadedContentSize = 0; mCompletedDownloadsCount = 0; mConnectionCount = 1; mThreadCount = 1; mDownloadComplete = false; // Data mDownloadedData = null; m_RemoteFileMetadata = null; mConsecutiveBytesCount = 0; // Other mStopwatch = new Stopwatch(); }
/// <summary> /// Downloads a file that is fragmented into different URIs /// </summary> /// <param name="fileMetadata"></param> /// <param name="threadCount"></param> public void Download(RemoteFileMetadata fileMetadata, int threadCount) { Reset(); if (!fileMetadata.IsValid()) { return; } m_RemoteFileMetadata = fileMetadata; SetConnectionCount(fileMetadata.GetFileFragments().Count); SetThreadCount(threadCount); for (int i = 0; i < mThreadCount; ++i) { Thread t = new Thread(WorkerThread); mThreads.Add(t); t.Start(); } mStopwatch.Start(); }