diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-03-11 03:41:20 +0200 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-03-11 03:41:20 +0200 |
| commit | e774f9a90fd812a9de8c3efe966a759bee8be703 (patch) | |
| tree | da7a59af6af40ff810254df9e08f6a0f5a31fe1c /Software/Visual_Studio/Tango.Console/ConsoleExecutionEngine.cs | |
| parent | eb793f20dc078a304a423a481e5bb0eddce71471 (diff) | |
| download | Tango-e774f9a90fd812a9de8c3efe966a759bee8be703.tar.gz Tango-e774f9a90fd812a9de8c3efe966a759bee8be703.zip | |
Working on FSE/PPC performance provider.
Implemented resolution service.
a lot of work!
Diffstat (limited to 'Software/Visual_Studio/Tango.Console/ConsoleExecutionEngine.cs')
| -rw-r--r-- | Software/Visual_Studio/Tango.Console/ConsoleExecutionEngine.cs | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/Software/Visual_Studio/Tango.Console/ConsoleExecutionEngine.cs b/Software/Visual_Studio/Tango.Console/ConsoleExecutionEngine.cs index c4bdee0a8..42bc2ac00 100644 --- a/Software/Visual_Studio/Tango.Console/ConsoleExecutionEngine.cs +++ b/Software/Visual_Studio/Tango.Console/ConsoleExecutionEngine.cs @@ -5,6 +5,7 @@ using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.Console.Network; namespace Tango.Console { @@ -15,19 +16,19 @@ namespace Tango.Console public String Command { get; set; } public String Arguments { get; set; } - public ParsedCommand(ConsoleCommandDTO dto) + public ParsedCommand(ConsoleCommandRequest request) { - String[] s = dto.Command.Split(' '); + String[] s = request.Command.Split(' '); Command = s.First(); Arguments = String.Join(" ", s.Skip(1)); } } - public Task<ConsoleCommandExecutionResult> Execute(ConsoleCommandDTO command) + public Task<ConsoleCommandExecutionResult> Execute(ConsoleCommandRequest request) { return Task.Factory.StartNew<ConsoleCommandExecutionResult>(() => { - ParsedCommand parsedCommand = new ParsedCommand(command); + ParsedCommand parsedCommand = new ParsedCommand(request); if (parsedCommand.Command.ToLower() == "cd") { @@ -35,9 +36,9 @@ namespace Tango.Console { return CreateResult(parsedCommand.Arguments, String.Empty); } - else if (Directory.Exists(Path.Combine(command.WorkingFolder, parsedCommand.Arguments))) + else if (Directory.Exists(Path.Combine(request.WorkingFolder, parsedCommand.Arguments))) { - return CreateResult(Path.GetFullPath(Path.Combine(command.WorkingFolder, parsedCommand.Arguments)), String.Empty); + return CreateResult(Path.GetFullPath(Path.Combine(request.WorkingFolder, parsedCommand.Arguments)), String.Empty); } else { @@ -54,16 +55,16 @@ namespace Tango.Console process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; process.StartInfo.RedirectStandardError = true; process.StartInfo.RedirectStandardOutput = true; - if (command.WorkingFolder != null) + if (request.WorkingFolder != null) { - process.StartInfo.WorkingDirectory = command.WorkingFolder; + process.StartInfo.WorkingDirectory = request.WorkingFolder; } //process.StartInfo.Verb = "runas"; if (ConsoleDictionary.GetKnownCommands().Exists(x => x.Name.ToLower() == parsedCommand.Command)) { process.StartInfo.FileName = "cmd.exe"; - process.StartInfo.Arguments = "/C " + command.Command; + process.StartInfo.Arguments = "/C " + request.Command; } else { @@ -88,7 +89,7 @@ namespace Tango.Console error = process.StandardError.ReadToEnd(); } - return CreateResult(command.WorkingFolder, String.IsNullOrWhiteSpace(error) ? output.Replace(command.WorkingFolder + ">", "") : error); + return CreateResult(request.WorkingFolder, String.IsNullOrWhiteSpace(error) ? output.Replace(request.WorkingFolder + ">", "") : error); }); } |
