T.Pipes Source Code Generator. Writes Interface Implementations for Inter Process Communication.
$ dotnet add package T.Pipes.SourceGenerationA wrapper for H.Pipes For Surrogate implementation and other things too.
interface to command and command to interface boilerplate using Attributes
(Generated Functions can be only overriden staticly, but be warned to apply that correcly as there is one Collection per Unique generic type)SurrogateProcessWrapper to start/stop a surrogate safely
(it only kills it after timeout, if possible use disconnect or other packet as a termination signal, the natural exit will be awaited for the timeout duration)H.PipesBaseClass which allow to also dispose on LifetimeCancellation token and listen to cancellation events
(usefull in no IoC scenarios to handle cascading disposing)T.Pipes.Test.Client/ServerT.Pipes.Test to assert some of the issues which might arise are handledMore indepth info can be gathered by strolling trough the Code or by reading the XML docs.
If you add the Code generator to project, the PipeUse and PipeServe attributes will be generating boilerplate for your Delegating Pipe Callback implementations.
The interface to generate code for must be specified using typeof operator in the attribute parameter. Multiple instances of this attribute are allowed. All Generic types must be Closed.
PipeUse Will Use the actual Target implmentation and make the callback act like an adapter for properties/methods/eventsPipeServer Will explicityly implement the interface on the callback to avoid collisions and make the callback act like an adapter for properties/methods/eventsFrom the Pipe perspective all calls go trough collected static Functions property to lookup correct action.
Aliased implementations are visible from the Callback itself.
There is an edge case for any method of Disposing - ideally you just want to dispose the entire Callback/Server/Client/Callback/Target stack nad not just the Target object itself.
The dispose can be delegated to the target only, but then it is up to the user to handle reuse of pipes and etc., it should be possible thanks to protected Setter on Target.
Usage example can be found in T.Pipes.Test.Client/Server.
Abstract classes to build the Interface Delegation upon. Should be ideally implemented by user using a sealed class.
All actual logic lands in Callback, the Server/Client are just managing the pipe.
Abstract classes to create more Delegating Pipes. Should be ideally implemented by user using a sealed class.
All actual logic lands in Callback, the Server/Client are just managing the pipe.
Is a simple class with start and stop methods.
Starting first ensures the previous instance of the process is Stopped then calls Start on the Process.Stopping the process tries to send the CloseMainWindow, and then awaits graceful close, if the timeout will expire Kill is called on the process.