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 | |
| 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')
| -rw-r--r-- | Software/Visual_Studio/Tango.Console/ConsoleExecutionEngine.cs | 21 | ||||
| -rw-r--r-- | Software/Visual_Studio/Tango.Console/Network/ConsoleCommandRequest.cs (renamed from Software/Visual_Studio/Tango.Console/ConsoleCommandDTO.cs) | 4 | ||||
| -rw-r--r-- | Software/Visual_Studio/Tango.Console/Network/ConsoleCommandResponse.cs | 20 | ||||
| -rw-r--r-- | Software/Visual_Studio/Tango.Console/Network/GetCurrentDirectoryRequest.cs | 13 | ||||
| -rw-r--r-- | Software/Visual_Studio/Tango.Console/Network/GetCurrentDirectoryResponse.cs | 13 | ||||
| -rw-r--r-- | Software/Visual_Studio/Tango.Console/Tango.Console.csproj | 5 |
6 files changed, 63 insertions, 13 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); }); } diff --git a/Software/Visual_Studio/Tango.Console/ConsoleCommandDTO.cs b/Software/Visual_Studio/Tango.Console/Network/ConsoleCommandRequest.cs index 1d96fccc2..d7541506c 100644 --- a/Software/Visual_Studio/Tango.Console/ConsoleCommandDTO.cs +++ b/Software/Visual_Studio/Tango.Console/Network/ConsoleCommandRequest.cs @@ -4,9 +4,9 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace Tango.Console +namespace Tango.Console.Network { - public class ConsoleCommandDTO + public class ConsoleCommandRequest { public String WorkingFolder { get; set; } public String Command { get; set; } diff --git a/Software/Visual_Studio/Tango.Console/Network/ConsoleCommandResponse.cs b/Software/Visual_Studio/Tango.Console/Network/ConsoleCommandResponse.cs new file mode 100644 index 000000000..70b72e703 --- /dev/null +++ b/Software/Visual_Studio/Tango.Console/Network/ConsoleCommandResponse.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.Console.Network +{ + public class ConsoleCommandResponse + { + public String WorkingFolder { get; set; } + public String Output { get; set; } + public List<ConsoleSuggestion> Suggestions { get; set; } + + public ConsoleCommandResponse() + { + Suggestions = new List<ConsoleSuggestion>(); + } + } +} diff --git a/Software/Visual_Studio/Tango.Console/Network/GetCurrentDirectoryRequest.cs b/Software/Visual_Studio/Tango.Console/Network/GetCurrentDirectoryRequest.cs new file mode 100644 index 000000000..f5abfda70 --- /dev/null +++ b/Software/Visual_Studio/Tango.Console/Network/GetCurrentDirectoryRequest.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.Console.Network +{ + public class GetCurrentDirectoryRequest + { + + } +} diff --git a/Software/Visual_Studio/Tango.Console/Network/GetCurrentDirectoryResponse.cs b/Software/Visual_Studio/Tango.Console/Network/GetCurrentDirectoryResponse.cs new file mode 100644 index 000000000..30a24e461 --- /dev/null +++ b/Software/Visual_Studio/Tango.Console/Network/GetCurrentDirectoryResponse.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.Console.Network +{ + public class GetCurrentDirectoryResponse + { + public String CurrentDirectory { get; set; } + } +} diff --git a/Software/Visual_Studio/Tango.Console/Tango.Console.csproj b/Software/Visual_Studio/Tango.Console/Tango.Console.csproj index 00b2042f8..9c4819389 100644 --- a/Software/Visual_Studio/Tango.Console/Tango.Console.csproj +++ b/Software/Visual_Studio/Tango.Console/Tango.Console.csproj @@ -49,7 +49,6 @@ </ItemGroup> <ItemGroup> <Compile Include="ConsoleCommand.cs" /> - <Compile Include="ConsoleCommandDTO.cs" /> <Compile Include="ConsoleCommandExecutingEventArgs.cs" /> <Compile Include="ConsoleCommandExecutionResult.cs" /> <Compile Include="ConsoleControl.xaml.cs"> @@ -63,6 +62,10 @@ <Compile Include="ConsoleSuggestionType.cs" /> <Compile Include="ConsoleTextBox.cs" /> <Compile Include="ConsoleTextBoxMaxWidthConverter.cs" /> + <Compile Include="Network\ConsoleCommandRequest.cs" /> + <Compile Include="Network\ConsoleCommandResponse.cs" /> + <Compile Include="Network\GetCurrentDirectoryRequest.cs" /> + <Compile Include="Network\GetCurrentDirectoryResponse.cs" /> <Compile Include="Properties\AssemblyInfo.cs"> <SubType>Code</SubType> </Compile> |
