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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vamp
auto-tx
Commits
5be372cb
Commit
5be372cb
authored
Feb 6, 2018
by
Niko Ehrenfeuchter
Browse files
Options
Downloads
Patches
Plain Diff
Use C# 6.0 string interpolation.
parent
3557dc84
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
ATxCommon/Conv.cs
+1
-1
1 addition, 1 deletion
ATxCommon/Conv.cs
ATxService/AutoTx.cs
+4
-7
4 additions, 7 deletions
ATxService/AutoTx.cs
ATxService/RoboCommand.cs
+1
-2
1 addition, 2 deletions
ATxService/RoboCommand.cs
ATxTray/AutoTxTray.cs
+6
-8
6 additions, 8 deletions
ATxTray/AutoTxTray.cs
with
12 additions
and
18 deletions
ATxCommon/Conv.cs
+
1
−
1
View file @
5be372cb
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
order
++;
order
++;
numBytes
/=
1024
;
numBytes
/=
1024
;
}
}
return
string
.
Format
(
"{0:0.#} {1}"
,
numBytes
,
suffixes
[
order
]
)
;
return
$"
{
numBytes
:
0
.
#
}
{
suffixes
[
order
]
}
"
;
}
}
}
}
}
}
This diff is collapsed.
Click to expand it.
ATxService/AutoTx.cs
+
4
−
7
View file @
5be372cb
...
@@ -111,13 +111,10 @@ namespace ATxService
...
@@ -111,13 +111,10 @@ namespace ATxService
string
.
IsNullOrWhiteSpace
(
_config
.
AdminEmailAdress
))
string
.
IsNullOrWhiteSpace
(
_config
.
AdminEmailAdress
))
return
;
return
;
var
subject
=
string
.
Format
(
"{0} - {1} - Admin Notification"
,
var
subject
=
$"
{
ServiceName
}
-
{
Environment
.
MachineName
}
- Admin Notification"
;
ServiceName
,
Environment
.
MachineName
);
var
body
=
$"Notification from '
{
_config
.
HostAlias
}
' [
{
Environment
.
MachineName
}
] (via NLog)\n\n"
+
var
body
=
string
.
Format
(
"Notification from '{0}' [{1}] (via NLog)\n\n{2}\n\n"
+
$"
{
LogFormatDefault
}
\n\nNOTE: messages of the same log level won't be sent via email for the\n"
+
"NOTE: log messages of the same level will not be sent via email for the\n"
+
$"next
{
_config
.
AdminNotificationDelta
}
minutes, please check the corresponding log file!"
;
"next {3} minutes, please check the log file on the corresponding host!"
,
_config
.
HostAlias
,
Environment
.
MachineName
,
LogFormatDefault
,
_config
.
AdminNotificationDelta
);
var
logConfig
=
LogManager
.
Configuration
;
var
logConfig
=
LogManager
.
Configuration
;
...
...
This diff is collapsed.
Click to expand it.
ATxService/RoboCommand.cs
+
1
−
2
View file @
5be372cb
...
@@ -129,8 +129,7 @@ namespace ATxService
...
@@ -129,8 +129,7 @@ namespace ATxService
// WARNING: RoboSharp doesn't seem to offer a culture invariant representation
// WARNING: RoboSharp doesn't seem to offer a culture invariant representation
// of the FileClass, so this might fail in non-english environments:
// of the FileClass, so this might fail in non-english environments:
if
(
processed
.
FileClass
.
ToLower
().
Equals
(
"new file"
))
{
if
(
processed
.
FileClass
.
ToLower
().
Equals
(
"new file"
))
{
_transferredFiles
.
Add
(
string
.
Format
(
"{0} ({1})"
,
processed
.
Name
,
_transferredFiles
.
Add
(
$"
{
processed
.
Name
}
(
{
Conv
.
BytesToString
(
processed
.
Size
)}
)"
);
Conv
.
BytesToString
(
processed
.
Size
)));
// reset the value for the amount of bytes transferred for the current file:
// reset the value for the amount of bytes transferred for the current file:
_status
.
TransferredBytesCurrentFile
=
0
;
_status
.
TransferredBytesCurrentFile
=
0
;
// now add _txCurFileSize (containing either the size of the previously
// now add _txCurFileSize (containing either the size of the previously
...
...
This diff is collapsed.
Click to expand it.
ATxTray/AutoTxTray.cs
+
6
−
8
View file @
5be372cb
...
@@ -199,7 +199,7 @@ namespace ATxTray
...
@@ -199,7 +199,7 @@ namespace ATxTray
if
((
DateTime
.
Now
-
_status
.
LastStatusUpdate
).
TotalSeconds
<
60
)
if
((
DateTime
.
Now
-
_status
.
LastStatusUpdate
).
TotalSeconds
<
60
)
heartBeat
=
"OK"
;
heartBeat
=
"OK"
;
if
(
_txInProgress
)
if
(
_txInProgress
)
txProgress
=
_tx
Size
.
ToString
();
txProgress
=
_tx
ProgressPct
.
ToString
();
}
}
UpdateTrayIcon
();
UpdateTrayIcon
();
...
@@ -207,8 +207,7 @@ namespace ATxTray
...
@@ -207,8 +207,7 @@ namespace ATxTray
if
(!
_statusChanged
)
if
(!
_statusChanged
)
return
;
return
;
UpdateHoverText
(
string
.
Format
(
"AutoTx [svc={0}] [hb={1}] [tx={2}]"
,
UpdateHoverText
(
$"AutoTx [svc=
{
serviceRunning
}
] [hb=
{
heartBeat
}
] [tx=
{
txProgress
}
%]"
);
serviceRunning
,
heartBeat
,
txProgress
));
}
}
private
void
MiExitClick
(
object
sender
,
EventArgs
e
)
{
private
void
MiExitClick
(
object
sender
,
EventArgs
e
)
{
...
@@ -229,9 +228,9 @@ namespace ATxTray
...
@@ -229,9 +228,9 @@ namespace ATxTray
DefaultDirectory
=
_config
.
SourceDrive
DefaultDirectory
=
_config
.
SourceDrive
};
};
if
(
dirDialog
.
ShowDialog
()
==
CommonFileDialogResult
.
Ok
)
{
if
(
dirDialog
.
ShowDialog
()
==
CommonFileDialogResult
.
Ok
)
{
MessageBox
.
Show
(
"Directory\nselected:\n\n
"
+
dirDialog
.
FileName
+
MessageBox
.
Show
(
$@
"Directory\nselected:\n\n
{
dirDialog
.
FileName
}
\n\n"
+
"
\n\n
WARNING: adding new transfers is NOT YET IMPLEMENTED!"
,
@
"WARNING: adding new transfers is NOT YET IMPLEMENTED!"
,
"New transfer confirmation"
,
MessageBoxButtons
.
YesNo
,
MessageBoxIcon
.
Question
);
@
"New transfer confirmation"
,
MessageBoxButtons
.
YesNo
,
MessageBoxIcon
.
Question
);
}
}
}
}
...
@@ -317,8 +316,7 @@ namespace ATxTray
...
@@ -317,8 +316,7 @@ namespace ATxTray
_txInProgress
=
_status
.
TransferInProgress
;
_txInProgress
=
_status
.
TransferInProgress
;
_txSize
=
_status
.
CurrentTransferSize
;
_txSize
=
_status
.
CurrentTransferSize
;
if
(
_txInProgress
)
{
if
(
_txInProgress
)
{
_miTxProgress
.
Text
=
@"Transfer in progress (size: "
+
_miTxProgress
.
Text
=
$@"Transfer in progress (size:
{
Conv
.
BytesToString
(
_txSize
)}
)"
;
Conv
.
BytesToString
(
_txSize
)
+
")"
;
_miTxProgress
.
BackColor
=
Color
.
LightGreen
;
_miTxProgress
.
BackColor
=
Color
.
LightGreen
;
_notifyIcon
.
ShowBalloonTip
(
500
,
AppTitle
,
_notifyIcon
.
ShowBalloonTip
(
500
,
AppTitle
,
"New transfer started (size: "
+
"New transfer started (size: "
+
...
...
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
sign in
to comment