2using System.Collections.Generic;
3using System.Collections.Specialized;
34 foreach (
string key
in headers.AllKeys)
36 t.SetProperty(key, headers[key]);
51 foreach (Cookie cookie
in cookies)
67 foreach (KeyValuePair<string, BadObject> kvp
in src.InnerTable)
74 dst[kvp.Key] = v.Value;
88 table.SetFunction(
"AsString",
91 StreamReader sr =
new StreamReader(content, enc);
93 return sr.ReadToEnd();
98 table.SetFunction(
"AsBytes",
101 byte[] data =
new byte[content.Length];
102 int read = content.Read(data, 0, data.Length);
104 if (read != data.Length)
184 table.SetFunction(
"SetHeader", (
string key,
string value) => resp.Headers[key] = value);
186 table.SetFunction(
"SetCookie", (Cookie cookie) => resp.Cookies.Add(cookie));
188 table.SetFunction(
"SetCookies",
193 if (cookie is BadReflectedObject { Instance: Cookie c })
204 table.SetFunction(
"SetStatusCode", (
int code) => resp.StatusCode = code);
205 table.SetFunction(
"SetStatusDescription", (
string desc) => resp.StatusDescription = desc);
206 table.SetFunction(
"SetContentType", (
string type) => resp.ContentType = type);
207 table.SetFunction(
"SetContentEncoding", (
string enc) => resp.ContentEncoding = Encoding.GetEncoding(enc));
208 table.SetFunction(
"SetContentLength", (
long len) => resp.ContentLength64 = len);
209 table.SetFunction(
"SetKeepAlive", (
bool keepAlive) => resp.KeepAlive = keepAlive);
210 table.SetFunction(
"Redirect", (
string location) => resp.Redirect(location));
211 table.SetFunction(
"Abort", resp.Abort);
212 table.SetFunction(
"Close", resp.Close);
214 table.SetFunction(
"SetContent",
217 byte[] data = (resp.ContentEncoding ?? Encoding.UTF8).GetBytes(content);
218 resp.OutputStream.Write(data, 0, data.Length);
228 AddContextExtensions(provider);
229 AddRequestExtensions(provider);
Exception that is thrown when the remote console encounters an error.
Wrapper for the HttpListenerContext.
HttpListenerContext Context
The underlying HttpListenerContext.
Wrapper for the HttpListenerRequest.
HttpListenerRequest Request
The underlying HttpListenerRequest.
Implements Extensions for the "NetHost" Api.
void AddRequestExtensions(BadInteropExtensionProvider provider)
Adds Extensions for the BadHttpRequest Object.
override void AddExtensions(BadInteropExtensionProvider provider)
static void CopyHeaderTable(NameValueCollection dst, BadTable src)
Copies the Headers from the BadScript Table to the Http Header Table.
static BadTable CreateContentTable(Stream content, Encoding enc)
Creates an Http Content Table.
static BadTable CreateNameValueTable(NameValueCollection headers)
Creates a table from a name value collection.
void AddContextExtensions(BadInteropExtensionProvider provider)
Adds Extensions for the BadHttpContext Object.
static BadArray CreateCookieTable(CookieCollection cookies)
Creates a Cookie Table from the Cookie Collection.
static BadTable CreateResponseTable(HttpListenerResponse resp)
Creates a Response Table for the given Response Object.
Gets thrown by the runtime.
Public Extension API for the BS2 Runtime.
void RegisterObject(Type t, string propName, BadObject obj)
Registers the specified extension for the specified type.
Implements a Reflected Object.
Implements a Dynamic List/Array for the BadScript Language.
List< BadObject > InnerArray
The Inner Array.
The Base Class for all BadScript Objects.
Implements a Table Structure for the BadScript Language.
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.
Implements the Interface for Native Strings.
Contains the Implementation of the Remote Console Abstraction over TCP.
Contains Network Hosting Extensions and APIs for the BadScript2 Runtime.
Contains the Error Objects for the BadScript2 Language.
Contains the Extension Classes for Functions.
Contains the Classes for Reflection Objects.
Contains the Interop Abstractions and Implementations for the BadScript2 Language.
Contains the Native Runtime Objects.
Contains Runtime Type Objects.
Contains the Runtime Objects.