BadScript 2
Loading...
Searching...
No Matches
BadInteropApi.cs
Go to the documentation of this file.
3
8
12public abstract class BadInteropApi
13{
18 protected BadInteropApi(string name)
19 {
20 Name = name;
21 }
22
26 public string Name { get; }
27
31 public virtual Version Version => GetType().Assembly.GetName().Version;
32
37 protected abstract void LoadApi(BadTable target);
38
43 public void LoadRawApi(BadTable target)
44 {
45 LoadApi(target);
46 }
47
52 public void Load(BadExecutionContext ctx, BadTable table)
53 {
54 BadTable info = new BadTable();
55 info.SetProperty("Name", Name, new BadPropertyInfo(BadNativeClassBuilder.GetNative("string"), true));
56 info.SetProperty("Version", Version.ToString(), new BadPropertyInfo(BadNativeClassBuilder.GetNative("string"), true));
57 info.SetProperty("AssemblyName", GetType().Assembly.GetName().Name, new BadPropertyInfo(BadNativeClassBuilder.GetNative("string"), true));
58
59 if (!table.HasProperty("Info"))
60 {
61 table.SetProperty("Info", info, new BadPropertyInfo(BadNativeClassBuilder.GetNative("Table"), true));
62 }
63
64 LoadApi(table);
66 }
67}
The Execution Context. Every execution of a script needs a context the script is running in....
BadScope Scope
The Root Scope of the Context.
void SetRegisteredApi(string api)
Registers an API.
Definition BadScope.cs:478
Implements an Interop API for the BS2 Language.
void Load(BadExecutionContext ctx, BadTable table)
Loads the API into the given Table.
void LoadRawApi(BadTable target)
Loads the API into the given Table.
void LoadApi(BadTable target)
Loads the API into the given Table.
BadInteropApi(string name)
Creates a new Interop API.
virtual Version Version
The Version of the API.
Stores Meta Information about a Property.
Implements a Table Structure for the BadScript Language.
Definition BadTable.cs:14
override bool HasProperty(string propName, BadScope? caller=null)
Returns true if the object contains a given property or there exists an extension for the current Ins...
Definition BadTable.cs:129
Helper Class that Builds a Native Class from a Prototype.
static BadClassPrototype GetNative(string name)
Returns a Native Class Prototype for the given Native Type.
Contains the Interop Abstractions and Implementations for the BadScript2 Language.
Contains the Runtime Objects.
Definition BadArray.cs:10