1using System.IO.Compression;
18using Microsoft.AspNetCore.Components.CompilerServices;
31 public static async Task<byte[]>
GetWorkspace(
string workspace, HttpClient client)
35 var result = await client.GetByteArrayAsync(workspace+
".zip");
44 public static async Task<IFileSystem>
BuildFileSystem(
string workspace,
byte[] data)
52 Workspace = workspace,
55 fs.WriteAllText($
"/.workspace/{workspace}/meta.json", JsonConvert.SerializeObject(meta, Formatting.Indented));
57 var ms =
new MemoryStream(data);
70 rootDir = rootDir.Remove(rootDir.Length - 1, 1);
77 if (!fs.
Exists(settingsFile))
90 .LoadConsoleSettings(fs)
103 return Task.FromResult(runtime);
Exposes the BadScript Runtime Functionality to Consumers.
BadRuntime UseLogMask(params BadLogMask[] mask)
Configures the Runtime to use the specified log masks.
BadRuntime UseConsoleLogWriter()
Configures the Runtime to use the default log writer implementation(log to console)
BadRuntime UseLocalModules(IFileSystem? fs=null)
Registers the Local Path Handler to the Module Importer.
BadRuntime LoadSettings(string settingsFile, IFileSystem? fileSystem=null)
Loads the specified settings file.
Implements a Mask for Log Messages.
static readonly BadLogMask None
Static Helper for the "None" Mask.
Wrapper class for the console abstraction.
static void WriteLine(string str)
Writes a string to the console and appends a newline.
Virtual File System Implementation for the BadScript Engine.
void CreateDirectory(string path, bool recursive=false)
Creates a new directory.
Public Api for the Settings System.
void SetProperty(string propertyName, BadSettings value, bool invokeOnChange=true)
Sets the Property with the given Name.
Helper class that can be used to automatically load a settings object from a file.
static BadSettings RootSettings
Returns the Root Settings Object.
static async Task< byte[]> GetWorkspace(string workspace, HttpClient client)
const string SETTINGS_FILE
Defines the Settings file.
static BadRuntime LoadConsoleSettings(this BadRuntime runtime, IFileSystem fs)
Loads the Settings.
static async Task< IFileSystem > BuildFileSystem(string workspace, byte[] data)
static Task< BadRuntime > BuildRuntime(IFileSystem fs)
Defines the interface for a file system.
string GetStartupDirectory()
The Startup Directory of the Application.
bool Exists(string path)
Returns true if the given path is a file or directory.
Contains Logging system for the BadScript Runtime.
Contains a Console Abstraction Layer to be able to Simulate Console Input/Output over the Network.
Contains the Implementation of the BadScript Virtual File System.
Contains IO Implementation for the BadScript2 Runtime.
Contains Common Interop Extensions and APIs for the BadScript2 Runtime.
Contains Compression Extensions and APIs for the BadScript2 Runtime.
Contains HTML Extensions and APIs for the BadScript2 Runtime.
Contains IO Extensions and APIs for the BadScript2 Runtime.
Contains JSON Extensions and APIs for the BadScript2 Runtime.
Contains Linq Extensions and APIs for the BadScript2 Runtime.
Contains Network Hosting Extensions and APIs for the BadScript2 Runtime.
Contains Networking Extensions and APIs for the BadScript2 Runtime.
Contains Runtime Type Objects.
Contains the Settings Implementation.