|
.NET Framework | |||||||||
PREV TYPE NEXT TYPE | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONST | PROP | METHOD | OP | EVENT | DETAIL: FIELD | CONST | PROP | METHOD | OP | EVENT |
Manages the download of one particular resource
Field Summary | |
---|---|
System.Threading.ReaderWriterLock | bdRwl |
long |
bytesDownloaded
Do not set directly |
Naanou.ResourceExchange.ResourceAvailRangeComparer | comp |
System.Collections.ArrayList |
doneRanges
Array list of ByteRanges. Gets updated by StartImpl() and OnWorkerComplete handler |
string |
downloadElapsed
Set when status is updated |
long |
downloadStartTicks
Gets set by Start to DateTime.Now.Ticks |
long |
fileLength
Expected length of file |
bool | hadError |
string | hash |
Naanou.ResourceExchange.WorkStatusArgs | lastStatus |
Naanou.ResourceExchange.Source.Manifest[] | likelySourcesQ |
System.Collections.Hashtable |
likelySourcesUQ
Sources that may have resource, but we don't know any more than their id and url. Keyed by Naanou Id, value is where we found them from |
Naanou.ResourceExchange.IMonitorForm | monitorForm |
System.Threading.ManualResetEvent | mutex |
string |
pathForEndFile
Full path (including filename) to use for file when downloaded |
System.Collections.ArrayList | pool |
Naanou.ResourceExchange.Downloader.Priority | priority |
System.Random | random |
System.Threading.ReaderWriterLock | rwl |
System.Collections.ArrayList | searchProgressTemp |
System.Collections.ArrayList |
sourcesToUse
Array List of Source.Manifest. Gets updated by StartImpl and QuerySources |
Naanou.ResourceExchange.Downloader.State | state |
System.Threading.ReaderWriterLock | statsLock |
System.Threading.Thread | thread |
System.Collections.Hashtable | workerStatus |
Constructor Summary | |
---|---|
Downloader(string hash, Naanou.ResourceExchange.Downloader.Priority priority) Downloader for a file of unknown length |
|
Downloader(string hash, long fileLength, Naanou.ResourceExchange.Downloader.Priority priority) Constructor |
Property Summary | |
---|---|
string |
ElapsedTime
Gets the elapsed time for download |
long |
FileLength
Gets the total file length of the file this downloader is getting |
string |
HashSerial
Gets the serialised hash of resource |
bool |
IsClosed
Has the downloader closed (or is otherwise aborted, complete or in an error state) |
Naanou.ResourceExchange.WorkStatusArgs |
LastStatus
Gets the last recorded status |
Naanou.ResourceExchange.Source.Manifest[] |
LikelySourcesQueried
Gets or sets likely sources (and what ranges they have) for content (gathered from search results for instance) |
Naanou.ResourceExchange.IMonitorForm |
MonitorForm
Gets or sets the monitor form |
string |
PathForEndFile
Gets path to use for saving the file |
string |
Progress
Gets progress |
string |
StateText
Gets the current state of this downloader in string form |
int |
Threads
Gets the number of threads in use |
bool |
WorkersAvailable
Are there any workers available? |
Method Summary | |
---|---|
void |
Abort() Aborts download |
void | AddCombinedRange(System.Collections.ArrayList combined, System.Collections.Hashtable combinedHash, Naanou.ResourceExchange.ByteRange newRange, Naanou.ResourceExchange.Source.Manifest source, Naanou.ResourceExchange.ResourceAvailRange existing, bool mergeExisting, bool isFilled) |
void |
AddLikelyUQSource(Naanou.ResourceExchange.Source source, string findMethod) Adds a likely, but unqueried source for this downloader |
bool |
AssembleFile(string location) Assembles all the blocks we've downloaded into a single file |
void | BlockDownloadedOk(Naanou.ResourceExchange.Block b) |
long | BytesDownloaded() |
System.Collections.ArrayList |
CombineRanges(System.Collections.ArrayList sources, System.Collections.ArrayList doneRanges, long totalSize) Combines the available ranges from all sources into one big list, sorted in scarcity order (0 = scarcist) |
void |
GetStats() Gets the latest stats, and updates any monitorForm downloader has. Only allows one GetStats to run at a time |
void | GetStats(System.Drawing.Graphics g, System.Drawing.Rectangle rect) |
Naanou.ResourceExchange.IWorker[] |
GetWorkerPool() Gets a copy of all the workers currently in the pool for this downloader. |
Naanou.ResourceExchange.IWorker[] |
GetWorkers(Naanou.ResourceExchange.WorkStatusArgs[] statuses) Gets a copy of all workers that the Downloader is receiving stats for and their statuses |
void | HandleShutdown(bool errorWhileRunning) |
void |
LocateSources() Attempt to locate sources for resource |
void | OnSearchProgress(Naanou.Common.Search.SearchResultSet rs, bool complete) |
void |
OnWorkerComplete(Naanou.ResourceExchange.IWorker sender, Naanou.ResourceExchange.WorkCompleteArgs args) Notification by a worker that it has completed |
void | OnWorkerStatus(Naanou.ResourceExchange.IWorker worker, Naanou.ResourceExchange.WorkStatusArgs args) |
void | QuerySources(System.Collections.ArrayList sources, Naanou.ResourceExchange.Downloader.QueryDepth queryDepth) |
void | SetState(Naanou.ResourceExchange.Downloader.State state) |
void |
Start(string savePath) Starts download process in a new thread |
void | StartImpl() |
void |
StartWorker(Naanou.ResourceExchange.IWorker worker) Starts a worker if there are threads available, or waits |
void | StartWrapper() |
void | WaitForWorkers(bool abort) |
void | WaitForWorkerSlot() |
Methods inherited from class System.Object |
---|
Equals, Finalize, GetHashCode, GetType, MemberwiseClone, ToString |
Event Summary | |
---|---|
Naanou.ResourceExchange.TransferFinishedEventHandler |
TransferFinished
Indicates when a transfer (i.e. a swarmed download) has finished |
Naanou.ResourceExchange.TransferStartedEventHandler |
TransferStarted
Indicates when a transfer (i.e. a swarmed download) has stated |
Field Detail |
---|
private System.Threading.ReaderWriterLock bdRwl
private long bytesDownloaded
Do not set directly
private Naanou.ResourceExchange.ResourceAvailRangeComparer comp
private System.Collections.ArrayList doneRanges
Array list of ByteRanges. Gets updated by StartImpl() and OnWorkerComplete handler
private string downloadElapsed
Set when status is updated
private long downloadStartTicks
Gets set by Start to DateTime.Now.Ticks
private long fileLength
Expected length of file
private bool hadError
private string hash
private Naanou.ResourceExchange.WorkStatusArgs lastStatus
private Naanou.ResourceExchange.Source.Manifest[] likelySourcesQ
private System.Collections.Hashtable likelySourcesUQ
Sources that may have resource, but we don't know any more than their id and url. Keyed by Naanou Id, value is where we found them from
private Naanou.ResourceExchange.IMonitorForm monitorForm
private System.Threading.ManualResetEvent mutex
private string pathForEndFile
Full path (including filename) to use for file when downloaded
private System.Collections.ArrayList pool
private Naanou.ResourceExchange.Downloader.Priority priority
private System.Random random
private System.Threading.ReaderWriterLock rwl
private System.Collections.ArrayList searchProgressTemp
private System.Collections.ArrayList sourcesToUse
Array List of Source.Manifest. Gets updated by StartImpl and QuerySources
private Naanou.ResourceExchange.Downloader.State state
private System.Threading.ReaderWriterLock statsLock
private System.Threading.Thread thread
private System.Collections.Hashtable workerStatus
Constructor Detail |
---|
internal Downloader(string hash, Naanou.ResourceExchange.Downloader.Priority priority)
Downloader for a file of unknown length
Parameters:
hash
- Resource to get's hashpathForFile
- Path for filepriority
- Priorityinternal Downloader(string hash, long fileLength, Naanou.ResourceExchange.Downloader.Priority priority)
Constructor
Parameters:
hash
- Resource's hashfileLength
- Length of filepathForFile
- Where to save filepriority
- PriorityProperty Detail |
---|
public string ElapsedTime
Gets the elapsed time for download
public long FileLength
Gets the total file length of the file this downloader is getting
public string HashSerial
Gets the serialised hash of resource
public bool IsClosed
Has the downloader closed (or is otherwise aborted, complete or in an error state)
public Naanou.ResourceExchange.WorkStatusArgs LastStatus
Gets the last recorded status
public Naanou.ResourceExchange.Source.Manifest[] LikelySourcesQueried
Gets or sets likely sources (and what ranges they have) for content (gathered from search results for instance)
public Naanou.ResourceExchange.IMonitorForm MonitorForm
Gets or sets the monitor form
public string PathForEndFile
Gets path to use for saving the file
public string Progress
Gets progress
public string StateText
Gets the current state of this downloader in string form
public int Threads
Gets the number of threads in use
public bool WorkersAvailable
Are there any workers available?
Method Detail |
---|
public void Abort()
Aborts download
private void AddCombinedRange(System.Collections.ArrayList combined, System.Collections.Hashtable combinedHash, Naanou.ResourceExchange.ByteRange newRange, Naanou.ResourceExchange.Source.Manifest source, Naanou.ResourceExchange.ResourceAvailRange existing, bool mergeExisting, bool isFilled)
public void AddLikelyUQSource(Naanou.ResourceExchange.Source source, string findMethod)
Adds a likely, but unqueried source for this downloader
Parameters:
source
- SourcefindMethod
- How was source discoveredprivate bool AssembleFile(string location)
Assembles all the blocks we've downloaded into a single file
Parameters:
location
- Full path to save blocks toprivate void BlockDownloadedOk(Naanou.ResourceExchange.Block b)
private long BytesDownloaded()
public System.Collections.ArrayList CombineRanges(System.Collections.ArrayList sources, System.Collections.ArrayList doneRanges, long totalSize)
Combines the available ranges from all sources into one big list, sorted in scarcity order (0 = scarcist)
Parameters:
sources
- ArrayList of ResourceSourcesprivate void GetStats()
Gets the latest stats, and updates any monitorForm downloader has. Only allows one GetStats to run at a time
private void GetStats(System.Drawing.Graphics g, System.Drawing.Rectangle rect)
public Naanou.ResourceExchange.IWorker[] GetWorkerPool()
Gets a copy of all the workers currently in the pool for this downloader.
Returns:
public Naanou.ResourceExchange.IWorker[] GetWorkers(Naanou.ResourceExchange.WorkStatusArgs[] statuses)
Gets a copy of all workers that the Downloader is receiving stats for and their statuses
Parameters:
statuses
- private void HandleShutdown(bool errorWhileRunning)
private void LocateSources()
Attempt to locate sources for resource
Returns:
private void OnSearchProgress(Naanou.Common.Search.SearchResultSet rs, bool complete)
private void OnWorkerComplete(Naanou.ResourceExchange.IWorker sender, Naanou.ResourceExchange.WorkCompleteArgs args)
Notification by a worker that it has completed
Parameters:
sender
- Workerargs
- Completion detailsprivate void OnWorkerStatus(Naanou.ResourceExchange.IWorker worker, Naanou.ResourceExchange.WorkStatusArgs args)
private void QuerySources(System.Collections.ArrayList sources, Naanou.ResourceExchange.Downloader.QueryDepth queryDepth)
private void SetState(Naanou.ResourceExchange.Downloader.State state)
public void Start(string savePath)
Starts download process in a new thread
private void StartImpl()
internal void StartWorker(Naanou.ResourceExchange.IWorker worker)
Starts a worker if there are threads available, or waits
Parameters:
rg
- private void StartWrapper()
private void WaitForWorkers(bool abort)
private void WaitForWorkerSlot()
Event Detail |
---|
public Naanou.ResourceExchange.TransferFinishedEventHandler TransferFinished
Indicates when a transfer (i.e. a swarmed download) has finished
public Naanou.ResourceExchange.TransferStartedEventHandler TransferStarted
Indicates when a transfer (i.e. a swarmed download) has stated
|
.NET Framework | |||||||||
PREV TYPE NEXT TYPE | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONST | PROP | METHOD | OP | EVENT | DETAIL: FIELD | CONST | PROP | METHOD | OP | EVENT |