Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/havendv/h.proxyfactory
Allows creating proxy objects that look exactly like the original objects.
https://github.com/havendv/h.proxyfactory
ipc net5 net6 netstandard pipes pub-sub pubsub request-response rpc
Last synced: 19 days ago
JSON representation
Allows creating proxy objects that look exactly like the original objects.
- Host: GitHub
- URL: https://github.com/havendv/h.proxyfactory
- Owner: HavenDV
- License: mit
- Created: 2020-11-25T06:16:29.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2022-01-18T18:37:58.000Z (almost 3 years ago)
- Last Synced: 2024-10-06T09:21:38.916Z (about 1 month ago)
- Topics: ipc, net5, net6, netstandard, pipes, pub-sub, pubsub, request-response, rpc
- Language: C#
- Homepage:
- Size: 539 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# [H.ProxyFactory](https://github.com/HavenDV/H.ProxyFactory/)
[![Language](https://img.shields.io/badge/language-C%23-blue.svg?style=flat-square)](https://github.com/HavenDV/H.ProxyFactory/search?l=C%23&o=desc&s=&type=Code)
[![License](https://img.shields.io/github/license/HavenDV/H.ProxyFactory.svg?label=License&maxAge=86400)](LICENSE.md)
[![Requirements](https://img.shields.io/badge/Requirements-.NET%20Standard%202.0-blue.svg)](https://github.com/dotnet/standard/blob/master/docs/versions/netstandard2.0.md)
[![Build Status](https://github.com/HavenDV/H.ProxyFactory/workflows/.NET/badge.svg?branch=master)](https://github.com/HavenDV/H.ProxyFactory/actions?query=workflow%3A%22.NET%22)Allows you to interact with remote objects.
You will have access to an interface through which you will interact with the object created on the server.Features:
- Create proxy objects that look exactly like the original objects
- Proxy target can be located anywhere where there is access to pipes### Nuget
[![NuGet](https://img.shields.io/nuget/dt/H.ProxyFactory.Pipes.svg?style=flat-square&label=H.ProxyFactory.Pipes)](https://www.nuget.org/packages/H.ProxyFactory.Pipes/)
```
Install-Package H.ProxyFactory.Pipes
```### Usage
Shared code:
```cs
public interface IActionService
{
void SendText(string text);
void ShowTrayIcon();
void HideTrayIcon();event EventHandler TextReceived;
}public class ActionService { }
```Implementation in the server project:
```cs
public class ActionService : IActionService
{
private TrayIconService trayIconService = new();public void SendText(string text)
{
Console.WriteLine($"Text from client: {text}");TextReceived?.Invoke(this, "Hi from server");
}public void ShowTrayIcon()
{
trayIconService.ShowTrayIcon();
}public void HideTrayIcon()
{
trayIconService.HideTrayIcon();
}public event EventHandler? TextReceived;
}
```Server:
```cs
await using var server = new PipeProxyServer();await server.InitializeAsync("UniquePipeServerName");
```Client:
```cs
await using var factory = new PipeProxyFactory();await factory.InitializeAsync("UniquePipeServerName");
// You will have access to an interface through which you will interact with the object created on the server.
var service = await factory.CreateInstanceAsync();
instance.TextReceived += (_, text) =>
{
WriteLine($"{nameof(instance.TextReceived)}: {text}");
};
instance.ShowTrayIcon();
Instance.SendText("hello!");
```![1](/assets/1.png)
### Contacts
* [mail](mailto:[email protected])