-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathIExtensibleAdapter.cs
More file actions
69 lines (57 loc) · 1.76 KB
/
IExtensibleAdapter.cs
File metadata and controls
69 lines (57 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
using UnityEngine;
using System.Collections.Generic;
using ILRuntime.Other;
using System;
using System.Collections;
using ILRuntime.Runtime.Enviorment;
using ILRuntime.Runtime.Intepreter;
using ILRuntime.CLR.Method;
using ProtoBuf;
namespace MegoEngine.IL.Adapters
{
public sealed class IExtensibleAdapter : CrossBindingAdaptor
{
public override Type BaseCLRType
{
get
{
return typeof(ProtoBuf.IExtensible);
}
}
public override Type AdaptorType
{
get
{
return typeof(Adaptor);
}
}
public override object CreateCLRInstance(ILRuntime.Runtime.Enviorment.AppDomain appdomain, ILTypeInstance instance)
{
return new Adaptor(appdomain, instance);
}
public class Adaptor : IExtensible, CrossBindingAdaptorType
{
ILTypeInstance instance;
ILRuntime.Runtime.Enviorment.AppDomain appdomain;
public Adaptor():base()
{
}
public Adaptor(ILRuntime.Runtime.Enviorment.AppDomain appdomain, ILTypeInstance instance)
{
this.appdomain = appdomain;
this.instance = instance;
Init();
}
public ILTypeInstance ILInstance { get { return instance; } }
public IExtension GetExtensionObject(bool createIfMissing)
{
return appdomain.Invoke(mMethoGetExObject, instance, createIfMissing) as IExtension;
}
IMethod mMethoGetExObject;
void Init()
{
mMethoGetExObject = instance.Type.GetMethod("GetExtensionObject",0);
}
}
}
}