This project is read-only.
Project Description
ClassProxitator is a simple and lightweight communication library. It creates a proxy class of an interface witch delegate method calls to a connection.

Instalation

Use NuGet: Install-Package ClassProxitator -Pre
or simply download the .dll assembly and add reference to it.

How to use

Create some Interface to Proxify (or you probably have one):
public interface IController 
{
    void Move(int x, int y);
    void ButtonPress();
}

And implement it in some class. This will be a server.
public class PlayerController: IController
{
    public void Move(int x, int y)
    {
        // some your logic here
    }
    public void ButtonPress()
    {
        // your code
    }
}

Create a server.
var serverClass = new PlayerController();
// let it listen on some port
StreamProxy.ListenAt(12344, 
// pass it delegate for creating new Connections to your class
    () => new ClassConnection(server));

Connect with a client.
var clientConnection = StreamConnection.ConnectTo("localhost", 12344);
var clientClass = ProxyCreator.GetProxy<IController>(clientConnection);

Now you can call methods on client and they will be called at server.
clientClass.Move(7, 3);
clientClass.ButtonPress();

Proxy class of course implements your interface so you can pass it to your infrastructure (for example some GUI controls)
PS: Sorry for my English

Last edited Aug 28, 2014 at 10:01 AM by exyi, version 9