monarchsolutions - Agency 1.0.0.4

Remote Dynamic.

PM> Install-Package Agency -Version 1.0.0.4 -Source https://www.myget.org/F/monarchsolutions/api/v3/index.json

Copy to clipboard

> nuget.exe install Agency -Version 1.0.0.4 -Source https://www.myget.org/F/monarchsolutions/api/v3/index.json

Copy to clipboard

> dotnet add package Agency --version 1.0.0.4 --source https://www.myget.org/F/monarchsolutions/api/v3/index.json

Copy to clipboard
<PackageReference Include="Agency" Version="1.0.0.4" />
Copy to clipboard
source https://www.myget.org/F/monarchsolutions/api/v3/index.json

nuget Agency  ~> 1.0.0.4
Copy to clipboard

> choco install Agency --version 1.0.0.4 --source https://www.myget.org/F/monarchsolutions/api/v2

Copy to clipboard
Import-Module PowerShellGet
Register-PSRepository -Name "monarchsolutions" -SourceLocation "https://www.myget.org/F/monarchsolutions/api/v2"
Install-Module -Name "Agency" -RequiredVersion "1.0.0.4" -Repository "monarchsolutions" 
Copy to clipboard

Browse the sources in this package using Visual Studio or WinDbg by configuring the following legacy symbol server URL: https://www.myget.org/F/monarchsolutions/symbols/


Agency

MyGet monarchsolutions MyGet Build Status

Nobody outruns the Agency. - Benjamin Travis, Division chief of ICA

Agency is a .NET lib for Remote Dynamic.

It's achieved by Trinity Force: Dynamitey · Serialize.Linq · ExpressionTree

Agent and Handler works in unity. - Diana Burnwood, ICA Handler

Agency works on .NET and mono(Unity). .NET Core is not supported currently because it has neither .NET Remoting nor WCF Server support.

Remote Dynamic? WTF?

Remote Dynamic means to share objects between processes (usually using .NET Remoting) without the type to be known (using dynamic instead). It will be useful when the type is complex or changes frequently.

Demo

Server:

class Agent47
{
    public string Weapon { get; set; } = "Fiber Wire";

    public void PointShooting(int enemy)
    {
        Console.WriteLine($"Target eliminated: {enemy}");
    }
}
static void Main(string[] args)
{
    var agent = new Agent47();
    Agency.RegisterAgent("47", agent, new IpcHandler());
    Console.ReadLine();
	//Run Client here
    Console.WriteLine($"Current Weapon: {agent.Weapon}"); //weapon changed to `Silverballer`
    Console.ReadLine();
}

Client:

static void Main(string[] args)
{
    dynamic agent;
    try
    {
        agent = Agency.SpawnAgent("47", new IpcHandler());
    }
    catch (Exception e)
    {
        Console.WriteLine(e);
        return;
    }
    Console.WriteLine($"Current Weapon: {agent.Weapon}"); //get
    var weapon = "Silverballer";
    agent.Weapon = weapon; //set
    for (int i = 0; i < 5; i++)
    {
        agent.PointShooting(i); //Called on server
    }
    Console.ReadLine();
}

Here is another demo to show how you can share an object between an Unity(mono) program and a .NET(CLR) program, to implement a chat system with comfortable syntax.

UnityDemo

Handler

Handler implements the communication way between processes.

Currently Agency has implemented IpcHandler(faster but only for local CLR & Windows) and TcpHandler (slower but mono compatible) which uses .NET Remoting IPC. You can implement your handler as well.

Events

Example

You can subscribe a server object's event using a client method. When event is triggered on server, the method executes on client. (The subscription can be slow!)

Even more, you can also subscribe a server object's event using Expression<T> and it will be compiled and executed on server!


by Ulysses (wdwxy12345@gmail.com)

  • Any 0.0
    • Dynamitey (>= 2.0.9.136)
    • Serialize.Linq (>= 1.7.3.1)
  • .NETFramework 4.8: 4.8.0.0

                        
Assembly Assembly hash Match
/lib/net48/agency.dll 67d623f1584d4340b8a9e6c3c39af3b61

Owners

UlyssesWu

Authors

UlyssesWu

Project URL

https://github.com/UlyssesWu/Agency

License

MIT

Info

303 total downloads
82 downloads for version 1.0.0.4
Download (12.29 KB)
Download legacy symbols (38.58 KB)
Found on the current feed only

Package history

Version Size Last updated Downloads Mirrored?
1.0.0.4 12.29 KB Sat, 29 Jul 2023 06:11:42 GMT 82
1.0.0-CI00003 12.14 KB Tue, 20 Nov 2018 14:27:49 GMT 77
1.0.0-CI00002 12.12 KB Tue, 20 Nov 2018 12:30:00 GMT 67
1.0.0-CI00001 12.05 KB Fri, 16 Nov 2018 14:01:00 GMT 77