mirror of
https://github.com/BililiveRecorder/BililiveRecorder.git
synced 2024-12-25 19:56:10 +08:00
41 lines
1.3 KiB
C#
41 lines
1.3 KiB
C#
using System;
|
|
using System.Collections.Specialized;
|
|
using System.Net;
|
|
using System.Net.Http;
|
|
using System.Web;
|
|
using Jint;
|
|
using Jint.Native.Object;
|
|
using Jint.Runtime.Descriptors;
|
|
using Jint.Runtime.Interop;
|
|
|
|
namespace BililiveRecorder.Core.Scripting.Runtime
|
|
{
|
|
internal class JintDotnet : ObjectInstance
|
|
{
|
|
public JintDotnet(Engine engine) : base(engine)
|
|
{
|
|
}
|
|
|
|
protected override void Initialize()
|
|
{
|
|
this.FastSetProperty("Dns", new PropertyDescriptor(TypeReference.CreateTypeReference(this._engine, typeof(Dns)), false, false, false));
|
|
|
|
AddTypeAsProperty<Uri>();
|
|
AddTypeAsProperty<UriBuilder>();
|
|
AddTypeAsProperty<HttpUtility>();
|
|
AddTypeAsProperty<NameValueCollection>();
|
|
|
|
AddTypeAsProperty<HttpClient>();
|
|
AddTypeAsProperty<HttpClientHandler>();
|
|
AddTypeAsProperty<HttpCompletionOption>();
|
|
AddTypeAsProperty<HttpRequestMessage>();
|
|
AddTypeAsProperty<HttpMethod>();
|
|
AddTypeAsProperty<ByteArrayContent>();
|
|
AddTypeAsProperty<StringContent>();
|
|
AddTypeAsProperty<FormUrlEncodedContent>();
|
|
|
|
void AddTypeAsProperty<T>() => this.FastSetProperty(typeof(T).Name, new PropertyDescriptor(TypeReference.CreateTypeReference<T>(this._engine), false, false, false));
|
|
}
|
|
}
|
|
}
|