NanoByte.Common  2.4.2
Public Member Functions | Public Attributes | Properties | List of all members
NanoByte.Common.Tasks.TaskSnapshot Struct Reference

Represents a progress snapshot of an ITask. More...

Public Member Functions

 TaskSnapshot (TaskState state, bool unitsByte=false, long unitsProcessed=0, long unitsTotal=-1)
 Create a new progress snapshot. More...
 
override string ToString ()
 

Public Attributes

double Value
 The progress of the task as a value between 0 and 1; -1 when unknown. More...
 

Properties

TaskState State [get]
 The current State of the task. More...
 
bool UnitsByte [get]
 true if UnitsProcessed and UnitsTotal are measured in bytes; false if they are measured in generic units. More...
 
long UnitsProcessed [get]
 The number of units that have been processed so far. More...
 
long UnitsTotal [get]
 The total number of units that are to be processed; -1 for unknown. More...
 

Detailed Description

Represents a progress snapshot of an ITask.

Constructor & Destructor Documentation

◆ TaskSnapshot()

NanoByte.Common.Tasks.TaskSnapshot.TaskSnapshot ( TaskState  state,
bool  unitsByte = false,
long  unitsProcessed = 0,
long  unitsTotal = -1 
)
inline

Create a new progress snapshot.

Parameters
stateThe current State of the task.
unitsBytetrue if UnitsProcessed and UnitsTotal are measured in bytes; false if they are measured in generic units.
unitsProcessedThe number of units that have been processed so far.
unitsTotalThe total number of units that are to be processed; -1 for unknown.

Member Data Documentation

◆ Value

double NanoByte.Common.Tasks.TaskSnapshot.Value
Initial value:
=>
UnitsTotal switch
{
-1 => -1,
0 => 1,
_ => (UnitsProcessed / (double)UnitsTotal)
}

The progress of the task as a value between 0 and 1; -1 when unknown.

Property Documentation

◆ State

TaskState NanoByte.Common.Tasks.TaskSnapshot.State
get

The current State of the task.

◆ UnitsByte

bool NanoByte.Common.Tasks.TaskSnapshot.UnitsByte
get

true if UnitsProcessed and UnitsTotal are measured in bytes; false if they are measured in generic units.

◆ UnitsProcessed

long NanoByte.Common.Tasks.TaskSnapshot.UnitsProcessed
get

The number of units that have been processed so far.

◆ UnitsTotal

long NanoByte.Common.Tasks.TaskSnapshot.UnitsTotal
get

The total number of units that are to be processed; -1 for unknown.


The documentation for this struct was generated from the following file:
NanoByte.Common.Tasks.TaskSnapshot.UnitsProcessed
long UnitsProcessed
The number of units that have been processed so far.
Definition: TaskSnapshot.cs:29
NanoByte.Common.Tasks.TaskSnapshot.UnitsTotal
long UnitsTotal
The total number of units that are to be processed; -1 for unknown.
Definition: TaskSnapshot.cs:34