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
81596e45
Commit
81596e45
authored
7 years ago
by
Niko Ehrenfeuchter
Browse files
Options
Downloads
Patches
Plain Diff
Add GetDirectorySize method and CurrentTransferSize attribute to status.
parent
76cb10f3
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
AutoTx/AutoTx.cs
+13
-0
13 additions, 0 deletions
AutoTx/AutoTx.cs
AutoTx/RoboCommand.cs
+2
-1
2 additions, 1 deletion
AutoTx/RoboCommand.cs
AutoTx/XmlConfiguration.cs
+12
-0
12 additions, 0 deletions
AutoTx/XmlConfiguration.cs
with
27 additions
and
1 deletion
AutoTx/AutoTx.cs
+
13
−
0
View file @
81596e45
...
@@ -601,6 +601,7 @@ namespace AutoTx
...
@@ -601,6 +601,7 @@ namespace AutoTx
try
{
try
{
_status
.
CurrentTransferSrc
=
queued
[
0
].
GetDirectories
()[
0
].
FullName
;
_status
.
CurrentTransferSrc
=
queued
[
0
].
GetDirectories
()[
0
].
FullName
;
_status
.
CurrentTransferSize
=
GetDirectorySize
(
_status
.
CurrentTransferSrc
);
}
}
catch
(
Exception
ex
)
{
catch
(
Exception
ex
)
{
writeLog
(
"Error checking for data to be transferred: "
+
ex
.
Message
);
writeLog
(
"Error checking for data to be transferred: "
+
ex
.
Message
);
...
@@ -651,6 +652,7 @@ namespace AutoTx
...
@@ -651,6 +652,7 @@ namespace AutoTx
MoveToGraceLocation
();
MoveToGraceLocation
();
SendTransferCompletedMail
();
SendTransferCompletedMail
();
_status
.
CurrentTransferSrc
=
""
;
// cleanup completed, so reset CurrentTransferSrc
_status
.
CurrentTransferSrc
=
""
;
// cleanup completed, so reset CurrentTransferSrc
_status
.
CurrentTransferSize
=
0
;
_transferredFiles
.
Clear
();
// empty the list of transferred files
_transferredFiles
.
Clear
();
// empty the list of transferred files
}
}
}
}
...
@@ -928,6 +930,17 @@ namespace AutoTx
...
@@ -928,6 +930,17 @@ namespace AutoTx
_lastUserDirCheck
=
DateTime
.
Now
;
_lastUserDirCheck
=
DateTime
.
Now
;
}
}
/// <summary>
/// Recursively sum up size of all files under a given path.
/// </summary>
/// <param name="path"></param>
/// <returns>The total size in bytes.</returns>
public
static
long
GetDirectorySize
(
string
path
)
{
return
new
DirectoryInfo
(
path
)
.
GetFiles
(
"*"
,
SearchOption
.
AllDirectories
)
.
Sum
(
file
=>
file
.
Length
);
}
#
endregion
#
endregion
}
}
...
...
This diff is collapsed.
Click to expand it.
AutoTx/RoboCommand.cs
+
2
−
1
View file @
81596e45
...
@@ -69,7 +69,8 @@ namespace AutoTx
...
@@ -69,7 +69,8 @@ namespace AutoTx
_roboCommand
.
RetryOptions
.
RetryCount
=
0
;
_roboCommand
.
RetryOptions
.
RetryCount
=
0
;
_roboCommand
.
RetryOptions
.
RetryWaitTime
=
2
;
_roboCommand
.
RetryOptions
.
RetryWaitTime
=
2
;
_roboCommand
.
Start
();
_roboCommand
.
Start
();
writeLogDebug
(
"Transfer started"
);
writeLogDebug
(
"Transfer started, total size: "
+
_status
.
CurrentTransferSize
/
MegaBytes
+
" MB"
);
}
}
catch
(
ManagementException
ex
)
{
catch
(
ManagementException
ex
)
{
writeLog
(
"Error in StartTransfer(): "
+
ex
.
Message
);
writeLog
(
"Error in StartTransfer(): "
+
ex
.
Message
);
...
...
This diff is collapsed.
Click to expand it.
AutoTx/XmlConfiguration.cs
+
12
−
0
View file @
81596e45
...
@@ -128,6 +128,8 @@ namespace AutoTx
...
@@ -128,6 +128,8 @@ namespace AutoTx
bool
_filecopyFinished
;
bool
_filecopyFinished
;
private
bool
_cleanShutdown
;
private
bool
_cleanShutdown
;
private
long
_currentTransferSize
;
[
XmlElement
(
"LastStatusUpdate"
,
DataType
=
"dateTime"
)]
[
XmlElement
(
"LastStatusUpdate"
,
DataType
=
"dateTime"
)]
public
DateTime
LastStatusUpdate
{
public
DateTime
LastStatusUpdate
{
get
{
return
_lastStatusUpdate
;
}
get
{
return
_lastStatusUpdate
;
}
...
@@ -190,6 +192,16 @@ namespace AutoTx
...
@@ -190,6 +192,16 @@ namespace AutoTx
}
}
}
}
public
long
CurrentTransferSize
{
get
{
return
_currentTransferSize
;
}
set
{
_currentTransferSize
=
value
;
log
(
"CurrentTransferSize was updated ("
+
value
+
"), calling Serialize()..."
);
Serialize
();
}
}
public
XmlStatus
()
{
public
XmlStatus
()
{
_currentTransferSrc
=
""
;
_currentTransferSrc
=
""
;
_currentTargetTmp
=
""
;
_currentTargetTmp
=
""
;
...
...
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