string file = Path.GetFileNameWithoutExtension(path);\r
string directory = Path.GetDirectoryName(path);\r
\r
- // TODO this may not be necessary.\r
- if ((!string.IsNullOrEmpty(directory) && directory.Replace("\"", string.Empty).IndexOfAny(Path.GetInvalidPathChars()) != -1) ||\r
- file.Replace("\"", string.Empty).IndexOfAny(Path.GetInvalidFileNameChars()) != -1)\r
+ if (path.Split(':').Length - 1 > 1)\r
+ {\r
+ return true;\r
+ }\r
+\r
+ if (!string.IsNullOrEmpty(file) && file.Replace("\"", string.Empty).IndexOfAny(Path.GetInvalidPathChars()) != -1)\r
+ {\r
+ return true;\r
+ }\r
+\r
+ if (!string.IsNullOrEmpty(directory) && directory.Replace("\"", string.Empty).IndexOfAny(Path.GetInvalidPathChars()) != -1)\r
{\r
return true;\r
}\r
try\r
{\r
ext = Path.GetExtension(value);\r
+ if (FileHelper.FilePathHasInvalidChars(value) || string.IsNullOrEmpty(ext))\r
+ {\r
+ this.errorService.ShowMessageBox(Resources.Main_InvalidDestination, Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error);\r
+ return;\r
+ }\r
}\r
catch (ArgumentException)\r
{\r
- this.errorService.ShowMessageBox(\r
- Resources.Main_InvalidDestination,\r
- Resources.Error,\r
- MessageBoxButton.OK,\r
- MessageBoxImage.Error);\r
+ this.errorService.ShowMessageBox(Resources.Main_InvalidDestination, Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error);\r
+ return;\r
}\r
\r
this.CurrentTask.Destination = value;\r