aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.Common/Console
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common/Console')
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Console/DefaultConsoleEngineService.cs92
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Console/IConsoleEngineService.cs16
2 files changed, 0 insertions, 108 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Console/DefaultConsoleEngineService.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Console/DefaultConsoleEngineService.cs
deleted file mode 100644
index 94b677b18..000000000
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Console/DefaultConsoleEngineService.cs
+++ /dev/null
@@ -1,92 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Tango.Console;
-using Tango.Console.Network;
-using Tango.Core;
-using Tango.Core.DI;
-using Tango.Integration.ExternalBridge;
-using Tango.PPC.Common.ExternalBridge;
-using Tango.Transport;
-
-namespace Tango.PPC.Common.Console
-{
- /// <summary>
- /// Represents the <see cref="IConsoleEngineService"/> default implementation
- /// which listens to incoming console request by registering as a external bridge request handler.
- /// </summary>
- /// <seealso cref="Tango.PPC.Common.Console.IConsoleEngineService" />
- /// <seealso cref="Tango.Integration.ExternalBridge.IExternalBridgeRequestHandler" />
- [TangoCreateWhenRegistered]
- public class DefaultConsoleEngineService : ExtendedObject, IConsoleEngineService, IExternalBridgeRequestHandler
- {
- /// <summary>
- /// Gets or sets a value indicating whether this <see cref="IConsoleEngineService" /> is enabled.
- /// </summary>
- public bool Enabled { get; set; } = true;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="DefaultConsoleEngineService"/> class.
- /// </summary>
- /// <param name="externalBridge">The external bridge service instance.</param>
- public DefaultConsoleEngineService(IPPCExternalBridgeService externalBridge)
- {
- externalBridge.RegisterRequestHandler(this);
- }
-
- /// <summary>
- /// Handles <see cref="GetCurrentDirectoryRequest"/> requests.
- /// </summary>
- /// <param name="request">The request.</param>
- /// <param name="token">The token.</param>
- /// <param name="transporter">The transporter.</param>
- [ExternalBridgeRequestHandlerMethod(typeof(GetCurrentDirectoryRequest), RequestHandlerLoggingMode.LogRequestName)]
- public async Task OnGetCurrentDirectoryRequest(GetCurrentDirectoryRequest request, String token, ITransporter transporter)
- {
- this.ThrowIfDisabled();
-
- await transporter.SendGenericResponse(new GetCurrentDirectoryResponse()
- {
- CurrentDirectory = Environment.CurrentDirectory,
- Suggestions = ConsoleExecutionEngine.GetSuggestions(Environment.CurrentDirectory)
- }, token);
- }
-
- /// <summary>
- /// Handles <see cref="ConsoleCommandRequest"/> requests.
- /// </summary>
- /// <param name="request">The request.</param>
- /// <param name="token">The token.</param>
- /// <param name="transporter">The transporter.</param>
- [ExternalBridgeRequestHandlerMethod(typeof(ConsoleCommandRequest), RequestHandlerLoggingMode.LogRequestNameAndContent)]
- public async Task OnConsoleCommandRequest(ConsoleCommandRequest request, String token, ITransporter transporter)
- {
- this.ThrowIfDisabled();
-
- LogManager.Log($"{nameof(ConsoleCommandRequest)} received with command '{request.Command}'. Executing...");
-
- ConsoleExecutionEngine engine = new ConsoleExecutionEngine();
- var result = await engine.Execute(request);
-
- LogManager.Log("Console command executed successfully.");
-
- await transporter.SendGenericResponse<ConsoleCommandResponse>(new ConsoleCommandResponse()
- {
- Output = result.Output,
- Suggestions = result.Suggestions,
- WorkingFolder = result.WorkingFolder
- }, token);
- }
-
- /// <summary>
- /// Called when any of the external bridge clients (receivers) has disconnected.
- /// </summary>
- /// <param name="receiver">The receiver.</param>
- public void OnReceiverDisconnected(ExternalBridgeReceiver receiver)
- {
- //Do nothing.
- }
- }
-}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Console/IConsoleEngineService.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Console/IConsoleEngineService.cs
deleted file mode 100644
index 18edb3629..000000000
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Console/IConsoleEngineService.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Tango.PPC.Common.Console
-{
- /// <summary>
- /// Represents a command prompt console service which listens for incoming console requests.
- /// </summary>
- public interface IConsoleEngineService : IPPCService
- {
-
- }
-}