1using System.Diagnostics;
3using System.Net.Sockets;
50 public override string Name =>
"run";
62 Runtime.UseConsole(host);
65 Runtime.UseStartupArguments(settings.
Args);
68 $
".{BadRuntimeSettings.Instance.FileExtension}",
71 .Concat(settings.
Files);
77 BadLogger.
Warn(
"Benchmarking is not supported in interactive mode");
80 await Runtime.RunInteractiveAsync(files);
89 sw = Stopwatch.StartNew();
94 Runtime.UseScriptDebugger();
97 foreach (
string file
in files)
99 Runtime.ExecuteFile(file);
102 if (settings.Benchmark)
105 BadLogger.
Log($
"Execution Time: {sw?.ElapsedMilliseconds ?? 0}ms",
"Benchmark");
Exposes the BadScript Runtime Functionality to Consumers.
Public facing interface for a logger.
static void Log(string message)
Writes a Log to the Message Handler.
static void Warn(string message)
Writes a Warning to the Message Handler.
Implements a Host for the Remote Console.
void Start()
Starts the Host.
Implements a Console System that uses a settings object of Type T.
Runs one or more BadScript scripts.
static string StartupDirectory
The Startup Directory where all containing scripts will be loaded at every execution.
BadRunSystem(BadRuntime runtime)
Creates a new BadRunSystem instance.
override async Task< int > Run(BadRunSystemSettings settings)
Settings for the Run System.
bool Benchmark
If Enabled, the execution time will be printed to the console.
int RemotePort
If specified, the Run System will try to host a remote shell on the specified port.
IEnumerable< string > Files
The Files that will be executed.
bool Interactive
If Enabled, the Console will be started in interactive mode.
IEnumerable< string > Args
The Commandline Arguments for the Scripts.
bool Debug
If enabled, the debugger will be attached to the process.
Public interface for the filesystem abstraction of the BadScript Engine.
static IFileSystem Instance
File System implementation.
Gets thrown by the runtime.
BadSettings? FindProperty(string propertyPath)
Finds a property based on the property path relative to this object.
Helper class that can be used to automatically load a settings object from a file.
static BadSettings RootSettings
Returns the Root Settings Object.
void CreateDirectory(string path, bool recursive=false)
Creates a new directory.
IEnumerable< string > GetFiles(string path, string extension, bool recursive)
Returns all files in the given directory that match the specified extension.
Contains Logging system for the BadScript Runtime.
Contains the Implementation of the Remote Console Abstraction over TCP.
Contains the 'run' console command implementation.
Contains the debugger implementations for the BadScript2 Runtime.
Contains IO Implementation for the BadScript2 Runtime.
Contains the interactive console Implementation.
Contains Common Interop Extensions and APIs for the BadScript2 Runtime.
Contains the Error Objects for the BadScript2 Language.
Contains Runtime Settings Objects.
Contains the Settings Implementation.