BadScript 2
Loading...
Searching...
No Matches
BadJsonApi.cs
Go to the documentation of this file.
1using System.Runtime.ExceptionServices;
2
8
10
14[BadInteropApi("Json")]
15internal partial class BadJsonApi
16{
17 [BadMethod(description: "Converts a JSON String to a BadObject")]
18 [return: BadReturn("The Parsed Object")]
19 private BadObject FromJson(BadExecutionContext ctx, [BadParameter(description: "The JSON String")] string str)
20 {
21 try
22 {
23 return BadJson.FromJson(str);
24 }
26 {
27 ExceptionDispatchInfo.Capture(e)
28 .Throw();
29 }
30 catch (Exception e)
31 {
33 }
34
35 return BadObject.Null;
36 }
37
38 [BadMethod(description: "Converts a BadObject to a JSON String")]
39 [return: BadReturn("The JSON String")]
40 private string ToJson([BadParameter(description: "The Object to be converted.")] BadObject o)
41 {
42 return BadJson.ToJson(o);
43 }
44
45 protected override void AdditionalData(BadTable target)
46 {
47 target.SetProperty("Settings",
50 );
51 }
52}
Implements the "Json" Api.
Definition BadJsonApi.cs:16
string ToJson([BadParameter(description:"The Object to be converted.")] BadObject o)
Definition BadJsonApi.cs:40
BadObject FromJson(BadExecutionContext ctx, [BadParameter(description:"The JSON String")] string str)
Definition BadJsonApi.cs:19
override void AdditionalData(BadTable target)
Definition BadJsonApi.cs:45
Implements a Json to BadObject Converter.
Definition BadJson.cs:17
static BadObject FromJson(string s)
Converts a Json string to a BadObject.
Definition BadJson.cs:223
static string ToJson(BadObject o)
Converts a BadObject to a Json string.
Definition BadJson.cs:235
Implements a Settings Object Wrapper.
static readonly BadClassPrototype Prototype
The Class Prototype.
The Execution Context. Every execution of a script needs a context the script is running in....
BadScope Scope
The Root Scope of the Context.
string GetStackTrace()
Returns the Stack Trace of the Current scope.
Definition BadScope.cs:419
Gets thrown if the runtime encounters an error.
Implements the Error Object Type.
static BadRuntimeError FromException(Exception e, string? scriptStackTrace=null)
Creates a BadRuntimeError from an Exception.
Implements an Interop API for the BS2 Language.
The Base Class for all BadScript Objects.
Definition BadObject.cs:14
static readonly BadObject Null
The Null Value for the BadScript Language.
Definition BadObject.cs:28
Stores Meta Information about a Property.
Implements a Table Structure for the BadScript Language.
Definition BadTable.cs:14
Helper class that can be used to automatically load a settings object from a file.
static BadSettings RootSettings
Returns the Root Settings Object.
Contains JSON Extensions and APIs for the BadScript2 Runtime.
Definition BadJson.cs:11
Contains the Error Objects for the BadScript2 Language.
Contains the Interop Abstractions and Implementations for the BadScript2 Language.
Contains the Runtime Objects.
Definition BadArray.cs:10
Contains the Runtime Implementation.
Contains the Settings Implementation.