Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
auto-tx
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vamp
auto-tx
Commits
07325fec
Commit
07325fec
authored
7 years ago
by
Niko Ehrenfeuchter
Browse files
Options
Downloads
Patches
Plain Diff
Store the overall progress in percent in the status.
Refers to
#26
parent
539b9831
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ATxCommon/Serializables/ServiceStatus.cs
+15
-0
15 additions, 0 deletions
ATxCommon/Serializables/ServiceStatus.cs
ATxService/RoboCommand.cs
+7
-4
7 additions, 4 deletions
ATxService/RoboCommand.cs
with
22 additions
and
4 deletions
ATxCommon/Serializables/ServiceStatus.cs
+
15
−
0
View file @
07325fec
...
...
@@ -32,6 +32,8 @@ namespace ATxCommon.Serializables
private
long
_transferredBytesCompleted
;
private
long
_transferredBytesCurrentFile
;
private
int
_currentTransferPercent
;
#
region
constructor
,
serializer
and
deserializer
...
...
@@ -44,6 +46,7 @@ namespace ATxCommon.Serializables
_transferInProgress
=
false
;
_transferredBytesCompleted
=
0
;
_transferredBytesCurrentFile
=
0
;
_currentTransferPercent
=
0
;
}
public
void
Serialize
()
{
...
...
@@ -254,6 +257,18 @@ namespace ATxCommon.Serializables
}
}
/// <summary>
/// The progress of the current transfer in percent.
/// </summary>
public
int
CurrentTransferPercent
{
get
{
return
_currentTransferPercent
;
}
set
{
_currentTransferPercent
=
value
;
Log
.
Trace
(
"CurrentTransferPercent was updated ({0})."
,
value
);
Serialize
();
}
}
#
endregion
getter
/
setter
methods
...
...
This diff is collapsed.
Click to expand it.
ATxService/RoboCommand.cs
+
7
−
4
View file @
07325fec
...
...
@@ -159,6 +159,7 @@ namespace ATxService
_transferState
=
TxState
.
Stopped
;
_status
.
TransferredBytesCompleted
=
0
;
_status
.
TransferredBytesCurrentFile
=
0
;
_status
.
CurrentTransferPercent
=
0
;
_txCurFileSize
=
0
;
_txCurFileProgress
=
0
;
_roboCommand
.
Dispose
();
...
...
@@ -180,12 +181,14 @@ namespace ATxService
_txCurFileProgress
=
progress
;
_status
.
TransferredBytesCurrentFile
=
(
long
)
(
_txCurFileSize
*
e
.
CurrentFileProgress
/
100
);
var
overallProgress
=
((
double
)(
_status
.
TransferredBytesCompleted
+
_status
.
TransferredBytesCurrentFile
)
/
_status
.
CurrentTransferSize
)
*
100
;
Log
.
Info
(
"Current transfer at {0:0}%"
,
overallProgress
);
// NOTE: the (double) is required to make the division work on float which can then
// eventually be cast into an (int) after multiplying it by 100:
_status
.
CurrentTransferPercent
=
(
int
)((
_status
.
TransferredBytesCompleted
+
_status
.
TransferredBytesCurrentFile
)
*
100
/
_status
.
CurrentTransferSize
);
Log
.
Info
(
"Current transfer at {0}%"
,
_status
.
CurrentTransferPercent
);
Log
.
Trace
(
"Tx progress: complete [{0}] - current [{1}] - combined {2:0}%"
,
_status
.
TransferredBytesCompleted
,
_status
.
TransferredBytesCurrentFile
,
overallProgress
);
_status
.
CurrentTransferPercent
);
Log
.
Trace
(
"Current file transfer progress {0}%"
,
progress
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment