Skip to content
Snippets Groups Projects
Commit dacd9751 authored by Niko Ehrenfeuchter's avatar Niko Ehrenfeuchter :keyboard:
Browse files

Move ExpandCurrentTargetTmp to ServiceStatus.CurrentTargetTmpFull.

parent c218ade5
No related branches found
No related tags found
No related merge requests found
......@@ -19,8 +19,8 @@ namespace ATXCommon.Serializables
private DateTime _lastGraceNotification;
private string _limitReason;
string _currentTransferSrc;
string _currentTargetTmp;
private string _currentTransferSrc;
private string _currentTargetTmp;
bool _transferInProgress;
private bool _serviceSuspended;
......@@ -217,5 +217,15 @@ namespace ATXCommon.Serializables
"LastGraceNotification: " +
LastGraceNotification.ToString("yyyy-MM-dd HH:mm:ss") + "\n";
}
/// <summary>
/// Helper method to generate the full path of the current temp directory.
/// </summary>
/// <returns>A string with the path to the last tmp dir.</returns>
public string CurrentTargetTmpFull() {
return Path.Combine(_config.DestinationDirectory,
_config.TmpTransferDir,
_currentTargetTmp);
}
}
}
......@@ -509,16 +509,6 @@ namespace AutoTx
#region transfer tasks
/// <summary>
/// Helper method to generate the full path of the current temp directory.
/// </summary>
/// <returns>A string with the path to the last tmp dir.</returns>
private string ExpandCurrentTargetTmp() {
return Path.Combine(_config.DestinationDirectory,
_config.TmpTransferDir,
_status.CurrentTargetTmp);
}
/// <summary>
/// Assemble the transfer destination path and check if it exists.
/// </summary>
......@@ -627,7 +617,8 @@ namespace AutoTx
Log.Debug("Finalizing transfer, cleaning up target storage location...");
var finalDst = DestinationPath(_status.CurrentTargetTmp);
if (!string.IsNullOrWhiteSpace(finalDst)) {
if (MoveAllSubDirs(new DirectoryInfo(ExpandCurrentTargetTmp()), finalDst, true)) {
if (MoveAllSubDirs(new DirectoryInfo(_status.CurrentTargetTmpFull()),
finalDst, true)) {
_status.CurrentTargetTmp = "";
}
}
......@@ -658,7 +649,7 @@ namespace AutoTx
return;
Log.Debug("Resuming interrupted transfer from [{0}] to [{1}]",
_status.CurrentTransferSrc, ExpandCurrentTargetTmp());
_status.CurrentTransferSrc, _status.CurrentTargetTmpFull());
StartTransfer(_status.CurrentTransferSrc);
}
......
......@@ -27,7 +27,7 @@ namespace AutoTx
// the user name is expected to be the last part of the path:
_status.CurrentTargetTmp = new DirectoryInfo(sourcePath).Name;
CreateNewDirectory(ExpandCurrentTargetTmp(), false);
CreateNewDirectory(_status.CurrentTargetTmpFull(), false);
_transferState = TxState.Active;
_status.TransferInProgress = true;
......@@ -39,7 +39,7 @@ namespace AutoTx
// copy options
_roboCommand.CopyOptions.Source = sourcePath;
_roboCommand.CopyOptions.Destination = ExpandCurrentTargetTmp();
_roboCommand.CopyOptions.Destination = _status.CurrentTargetTmpFull();
// limit the transfer bandwidth by waiting between packets:
_roboCommand.CopyOptions.InterPacketGap = _config.InterPacketGap;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment