-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated parsing for rm to match download
- Loading branch information
1 parent
9a89ae7
commit e876deb
Showing
5 changed files
with
120 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Net; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace rm | ||
{ | ||
public class RmArgs | ||
{ | ||
public string path { get; set; } | ||
public string file { get; set; } | ||
public string host { get; set; } | ||
|
||
public bool Validate(out string message) | ||
{ | ||
message = string.Empty; | ||
|
||
//If we didn't get a path, then return an error | ||
if (string.IsNullOrEmpty(path)) | ||
{ | ||
message = "Missing path parameter"; | ||
return false; | ||
} | ||
|
||
//If we get to this point we either have a full path, or we're using the file browser and have all three | ||
//If we have a file combine it with the existing path | ||
if (!string.IsNullOrEmpty(file)) | ||
{ | ||
this.path = Path.Combine(this.path, this.file); | ||
} | ||
|
||
//If we have a host, append it to the beginning of the path | ||
if (!string.IsNullOrEmpty(host)) | ||
{ | ||
if (!host.Equals(Dns.GetHostName(), StringComparison.OrdinalIgnoreCase)) | ||
{ | ||
host = "\\\\" + host; | ||
this.path = Path.Combine(this.host, this.path); | ||
} | ||
} | ||
|
||
if (!File.Exists(this.path)) | ||
{ | ||
message = "File doesn't exist."; | ||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters