Simple .net DLL executor, separated to client (endpoint, simple .NET 8.0 program) / server (ASP.NET Core Web API application) / example module (simple NET 8.0 class library).
The client (endpoint) downloads the DLL module via REST API from the server and runs it locally.
The server connects to the SQL (connection string defined in appsettings.json) database and handles three API requests:
GET moduleMd5 - retrieves md5 of latest dll module from the sql database
GET moduleDll - retrieves dll of selected by md5 module from the sql database
POST moduleDll - adds a DLL module to the SQL database, also calculating its MD5 hash
After launching, the client (endpoint) checks whether %appdata%/SimpleNetExecutor contains a clientId.txt with the client ID. If it is missing, we generate a new one based on a new GUID.
The next step is to download current MD5 of latest version of the DLL module downloaded from the server via a GET request to the api/moduleMd5 API (with the client ID parameter). This request updates ‘lastEndpointHearthbeat’ in the SQL database for this client ID and downloads the MD5 of the latest DLL module.
If %appdata%/SimpleNetExecutor contains module.dll with the same MD5 as the one just downloaded, we simply run it (we load this DLL into Assembly and run the Main method with output parameter Action<string>). If the MD5s differ, we will download and update module.dll.
After completing above steps, the endpoint launches a WPF window that serves as a place to display the output from the loaded DLL module.
An example of a supported module is a regular .dll file containing Main(Action<string> output).
SQL server structure (database name: "SimpleNetExecutor"):
Table "modules":
[id] [int] IDENTITY(1,1) NOT NULL,
[endpointId] [nvarchar](max) NOT NULL,
[lastEndpointHeartbeat] [datetime2](7) NOT NULL
Table "endpoints":
[id] [int] IDENTITY(1,1) NOT NULL,
[moduleMd5] [nvarchar](max) NOT NULL,
[moduleDll] [varbinary](max) NOT NULL




