Naanou.ResourceExchange
Class RangeGetter.RangeGetterWorker

Worker to download a chunk from a resource

Field Summary
Naanou.ResourceExchange.Block block
System.Exception caught
Naanou.ResourceExchange.ResourceAvailRange chunk
bool completed
Naanou.ResourceExchange.Downloader downloader
Naanou.ResourceExchange.WorkStatusArgs lastStatus
Naanou.ResourceExchange.Source.Manifest source
System.Threading.Thread thread

Constructor Summary
RangeGetter.RangeGetterWorker(Naanou.ResourceExchange.Downloader downloader, Naanou.ResourceExchange.Source.Manifest source, Naanou.ResourceExchange.ResourceAvailRange chunk)
         Constructor

Property Summary
Naanou.ResourceExchange.Block Block
         Gets the block written to
string Error
         Returns an error string for any error that occurred (or null if none)
bool IsComplete
         Has worker completed?
Naanou.ResourceExchange.WorkStatusArgs LastStatus
         Gets the last recorded status of worker
Naanou.ResourceExchange.Source.Manifest Manifest
         Gets manifest
Naanou.ResourceExchange.ByteRange Range
         Gets range
Naanou.ResourceExchange.ResourceAvailRange Range_
         Gets the range the worker was getting
Naanou.ResourceExchange.Source Source
         Gets the soruce
string SourceTitle
         Gets a UI-friendly title for source
bool WereErrors
         Were there any errors while running?

Method Summary
void Abort()
         Aborts the worker. May not trigger Completion event
void Join()
         Wait for worker to complete
void Join(System.TimeSpan timeout)
         Wait a finite time for worker to complete
void OnDownloadStatus(Naanou.ResourceExchange.IWorker worker, Naanou.ResourceExchange.WorkStatusArgs args)
         Status from the source re: download
void PaintStatus(System.Drawing.Graphics g, System.Drawing.Rectangle rect)
         Paint worker status
void Start()
         Starts worker in a new BelowNormal priority thread. Throws the Complete event when done
void StartImpl()
void StartSync()
         Starts in same thread as caller
string ToString()
         Gets a string representation of worker

Methods inherited from class System.Object
Equals, Finalize, GetHashCode, GetType, MemberwiseClone

Event Summary
Naanou.ResourceExchange.WorkCompleteHandler Complete
         Completion result is the block downloaded
Naanou.ResourceExchange.WorkStatusHandler Status
         Status


Field Detail

block

private Naanou.ResourceExchange.Block block


caught

private System.Exception caught


chunk

private Naanou.ResourceExchange.ResourceAvailRange chunk


completed

private bool completed


downloader

private Naanou.ResourceExchange.Downloader downloader


lastStatus

private Naanou.ResourceExchange.WorkStatusArgs lastStatus


source

private Naanou.ResourceExchange.Source.Manifest source


thread

private System.Threading.Thread thread

Constructor Detail

RangeGetter.RangeGetterWorker

public RangeGetter.RangeGetterWorker(Naanou.ResourceExchange.Downloader downloader,
                                     Naanou.ResourceExchange.Source.Manifest source,
                                     Naanou.ResourceExchange.ResourceAvailRange chunk)

Constructor

Parameters:
downloader - Downloader
source - Source to use
chunk - Chunk
Property Detail

Block

internal Naanou.ResourceExchange.Block Block

Gets the block written to


Error

public string Error

Returns an error string for any error that occurred (or null if none)


IsComplete

public bool IsComplete

Has worker completed?


LastStatus

public Naanou.ResourceExchange.WorkStatusArgs LastStatus

Gets the last recorded status of worker


Manifest

public Naanou.ResourceExchange.Source.Manifest Manifest

Gets manifest


Range

public Naanou.ResourceExchange.ByteRange Range

Gets range


Range_

public Naanou.ResourceExchange.ResourceAvailRange Range_

Gets the range the worker was getting


Source

public Naanou.ResourceExchange.Source Source

Gets the soruce


SourceTitle

public string SourceTitle

Gets a UI-friendly title for source


WereErrors

public bool WereErrors

Were there any errors while running?

Method Detail

Abort

public void Abort()

Aborts the worker. May not trigger Completion event


Join

public void Join()

Wait for worker to complete


Join

public void Join(System.TimeSpan timeout)

Wait a finite time for worker to complete

Parameters:
timeout -

OnDownloadStatus

private void OnDownloadStatus(Naanou.ResourceExchange.IWorker worker,
                              Naanou.ResourceExchange.WorkStatusArgs args)

Status from the source re: download

Parameters:
worker - Null
args - Args

PaintStatus

public void PaintStatus(System.Drawing.Graphics g,
                        System.Drawing.Rectangle rect)

Paint worker status

Parameters:
g -
rect -

Start

public void Start()

Starts worker in a new BelowNormal priority thread. Throws the Complete event when done


StartImpl

private void StartImpl()


StartSync

public void StartSync()

Starts in same thread as caller


ToString

public string ToString()

Gets a string representation of worker

Returns:
String representation of worker
Event Detail

Complete

public Naanou.ResourceExchange.WorkCompleteHandler Complete

Completion result is the block downloaded


Status

public Naanou.ResourceExchange.WorkStatusHandler Status

Status