Skip to content

ImVexed/NotLiteCode

Repository files navigation

Build Status Code Factor GitHub license NuGet

NotLiteCode

A simple, hackable, remote code hosting platform.

What is?

NLC (Not Lite Code) is a simplified version of LiteCode by DragonHunter, which provides native RPC and other useful features without any external dependencies.

How does this differ from traditional RPC/RMI?

Traditionally RPC/RMI implements a stub interface and is tightly coupled. NLC however can function without a stub interface by using BinaryFormatter to serialize & deserialize objects on the fly at runtime allowing it to be loosly coupled. NLC also allows communication over SSLStream for security.

How is state handled?

NLC creates a unique instance for every client allowing you to keep stateful data alongside their functions in the SharedClass.

How is concurrency handled?

As of 1.4 NLC's networking core is now asynchronous and will invoke calls in a new Task once the data is received. Thus any synchronization must either be ensured in the client invoking the methods or inside the SharedClass functions themselves.

Sample Implementation

Server Code:

SharedClass.cs

[NLCCall("MagicNumber")]
public bool IsMagicNumber(int number)
{
  return number == 7;
}

Program.cs

server = new Server<SharedClass>();
server.Start();

Client Code:

Program.cs

public static async Task<bool> IsMagicNumber(int number) =>
      await client.RemoteCall<bool>("MagicNumber", number);
      
client = new Client();

client.Connect("localhost", 1337);

Console.WriteLine(await IsMagicNumber(-10)); // False
Console.WriteLine(await IsMagicNumber(7));   // True

Sample Outputs

Original

LiteCode by DragonHunter

Releases

No releases published

Packages

No packages published

Languages