Skip to content

Kuinox/Kuinox.CSharpScript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kuinox.CSharpScript

A simple C# scripting dotnet tool.

Getting Started

Install it with dotnet tool install -g Kuinox.CSharpScript
Execute a C# file with c# Program.cs in your favorite terminal.

// Program.cs
Console.WriteLine("Hello World");

.csproj configuration

This is where this C# scripting tool do things differently.
You can put your own csproj configuration at the top of the file to override the projects defaults.
It allow you to import nuget package for example, or configure the project, you can do whatever you want!

<Project>
  <ItemGroup>
    <PackageReference Include="CK.MQTT.Client" Version="0.8.2" />
  </ItemGroup>
</Project>
using CK.MQTT.Client;
using CK.MQTT;
using CK.Core;

IMqtt3Client client = MqttClient.Factory.CreateMQTT3Client( new MqttClientConfiguration( "test.mosquitto.org:1883" ),
( IActivityMonitor? m, ApplicationMessage msg, CancellationToken token ) =>
{
    Console.WriteLine( msg.Topic );
    return new ValueTask();
} );
await client.ConnectAsync(null);
await client.SubscribeAsync(null, new Subscription("#", QualityOfService.AtMostOnce));
await Task.Delay( 10000 );

(This example will listen to the mosquitto public mqtt server for 10 seconds, and print the topics of the incoming messages.)

About

A super simple C# script runner tool.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages