MagicExecutorSystem 1.0.0

dotnet add package MagicExecutorSystem --version 1.0.0
                    
NuGet\Install-Package MagicExecutorSystem -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MagicExecutorSystem" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MagicExecutorSystem" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="MagicExecutorSystem" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MagicExecutorSystem --version 1.0.0
                    
#r "nuget: MagicExecutorSystem, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=MagicExecutorSystem&version=1.0.0
                    
Install MagicExecutorSystem as a Cake Addin
#tool nuget:?package=MagicExecutorSystem&version=1.0.0
                    
Install MagicExecutorSystem as a Cake Tool

Methods:

Добавить классы из текущего домена

AddInternalAssembies()

Добавить сторонние сборки

files: Пути к файлам сторонних сборок

AddExternalAssemblies(IEnumerable<string> files)

Вызов метода из указанного модуля с указанными параметрами

className: Имя модуля

methodName: Название метода

params: Список параметров

Возвращает: Результат выполнения команды

Execute(string className, string methodName, params [] @params)

Вызов метода из указанного модуля с указанными параметрами

T: Тип возвращаемого параметра

className: Имя модуля

methodName: Название метода

params: Список параметров

Возвращает: Результат выполнения команды

Execute<T>(string className, string methodName, params [] @params)

Добавляет/Заменяет инстанс в хранилище

T: Тип инстанса

rpcInstance: Инстанс помеченный аттрибутом RpcClass

AddInstance<T>(T rpcInstance)

Получить список rpc-классов в хранилище

Возвращает: Список классов в хранилище

GetClasses()

Получить список rpc-методов в классе

className: Название rpc-класса

Возвращает: Список методов класса

GetMethods(string className)

Получить информацию о rpc-методе

className: Название rpc-класса

methodName: Название rpc-метода

Возвращает: MethodInfo выбранного метода

GetMethodInfo(string className, string methodName)

Аттрибут для пометки классов для MagicExecutor

RpcClass

Аттрибут для пометки rpc-методов rpc-класса для MagicExecutor

RpcMethod

Sample:

Create a Console Application:

Sample Console Application(.NET Framwork)
using System;
using System.Linq;
using System.Reflection;
using MagicExecutorSystem;

namespace Sample
{
    class Program
    {
        static void Main(string[] args)
        {
            MagicExecutor executor = new MagicExecutor();

            executor.AddInternalAssembies();

            executor.AddExternalAssemblies(new string[] { Environment.CurrentDirectory + "/plugins/SampleLib.dll" });

            foreach(var @class in executor.GetClasses())
            {
                Console.WriteLine(@class);
                foreach (var method in executor.GetMethods(@class))
                {
                    MethodInfo info = executor.GetMethodInfo(@class, method);
                    string outType = info.ReturnType.Name;
                    
                    Console.Write("\t" + outType +" " + method + "(");
                    foreach(var param in info.GetParameters())
                    {
                        Console.Write(param.ParameterType.Name + " " + param.Name);

                        if (info.GetParameters().Last() != param)
                            Console.Write(", ");
                    }

                    Console.Write(") => ");

                    Console.WriteLine(executor.Execute<string>(@class, method, new object[] { "DezmontDeXa" }));
                }
                Console.WriteLine("");
            }

            Console.ReadLine();
        }
    }

    [MagicExecutor.RpcClass]
    public class SampleClassInInternal
    {
        [MagicExecutor.RpcMethod]
        public string Hello(string name)
        {
            return "Hello, " + name + " from internal";
        }
    }
}

And classes library:

Sample External Library(.NET Framwork)
using static MagicExecutorSystem.MagicExecutor;

namespace SampleLib
{
    [RpcClass]
    public class SampleClassInExternalLib
    {
        [RpcMethod]
        public string Hello(string name)
        {
            return "Hello, " + name + " from external lib";
        }
    }
}

Paste the DLL (External classes library) into the "plugins" folder in the Sample Console Application. Set "Assembly Action" to "No" and "Copy to Output Directory" to "Always"

Product Compatible and additional computed target framework versions.
.NET Framework net47 is compatible.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0 878 12/10/2018

First release