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).Throw();
28 }
29 catch (Exception e)
30 {
32 }
33
34 return BadObject.Null;
35 }
36
37 [BadMethod(description: "Converts a BadObject to a JSON String")]
38 [return: BadReturn("The JSON String")]
39 private string ToJson([BadParameter(description: "The Object to be converted.")] BadObject o)
40 {
41 return BadJson.ToJson(o);
42 }
43
44 protected override void AdditionalData(BadTable target)
45 {
46 target.SetProperty(
47 "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:39
BadObject FromJson(BadExecutionContext ctx, [BadParameter(description:"The JSON String")] string str)
Definition BadJsonApi.cs:19
override void AdditionalData(BadTable target)
Definition BadJsonApi.cs:44
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:192
static string ToJson(BadObject o)
Converts a BadObject to a Json string.
Definition BadJson.cs:204
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:633
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.