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

Validate drive location of a new transfer directory.

This is the last missing strict requirement for the first version of a
tray app, so this commit closes #2.
parent 37e5d7bf
No related branches found
No related tags found
No related merge requests found
......@@ -59,6 +59,7 @@ namespace ATxTray
private static TaskDialog _confirmDialog;
private static DirectoryInfo _selectedDir;
public AutoTxTray() {
#region logging configuration
......@@ -245,6 +246,14 @@ namespace ATxTray
return;
_selectedDir = new DirectoryInfo(dirDialog.FileName);
var drive = dirDialog.FileName.Substring(0, 3);
if (drive != _config.SourceDrive) {
MessageBox.Show($@"The selected directory '{_selectedDir}' is required to be on " +
$@"drive {_config.SourceDrive}, please choose another directory!",
@"Selected directory on wrong drive", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
var folderName = _selectedDir.Name;
var locationPath = _selectedDir.Parent?.FullName;
var size = Conv.BytesToString(FsUtils.GetDirectorySize(_selectedDir.FullName));
......
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