|
@@ -7,7 +7,7 @@ using System.Linq;
|
|
|
|
|
|
|
|
namespace ET
|
|
namespace ET
|
|
|
{
|
|
{
|
|
|
- public class CodeLoader
|
|
|
|
|
|
|
+ public class CodeLoader: IDisposable
|
|
|
{
|
|
{
|
|
|
public static CodeLoader Instance = new CodeLoader();
|
|
public static CodeLoader Instance = new CodeLoader();
|
|
|
|
|
|
|
@@ -16,6 +16,8 @@ namespace ET
|
|
|
public Action OnApplicationQuit;
|
|
public Action OnApplicationQuit;
|
|
|
|
|
|
|
|
private Assembly assembly;
|
|
private Assembly assembly;
|
|
|
|
|
+
|
|
|
|
|
+ private ILRuntime.Runtime.Enviorment.AppDomain appDomain;
|
|
|
|
|
|
|
|
private Type[] allTypes;
|
|
private Type[] allTypes;
|
|
|
|
|
|
|
@@ -24,6 +26,11 @@ namespace ET
|
|
|
private CodeLoader()
|
|
private CodeLoader()
|
|
|
{
|
|
{
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ public void Dispose()
|
|
|
|
|
+ {
|
|
|
|
|
+ this.appDomain?.Dispose();
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
public void Start()
|
|
public void Start()
|
|
|
{
|
|
{
|
|
@@ -50,7 +57,7 @@ namespace ET
|
|
|
//byte[] assBytes = File.ReadAllBytes(Path.Combine("../Unity/", Define.BuildOutputDir, "Code.dll"));
|
|
//byte[] assBytes = File.ReadAllBytes(Path.Combine("../Unity/", Define.BuildOutputDir, "Code.dll"));
|
|
|
//byte[] pdbBytes = File.ReadAllBytes(Path.Combine("../Unity/", Define.BuildOutputDir, "Code.pdb"));
|
|
//byte[] pdbBytes = File.ReadAllBytes(Path.Combine("../Unity/", Define.BuildOutputDir, "Code.pdb"));
|
|
|
|
|
|
|
|
- ILRuntime.Runtime.Enviorment.AppDomain appDomain = new ILRuntime.Runtime.Enviorment.AppDomain();
|
|
|
|
|
|
|
+ appDomain = new ILRuntime.Runtime.Enviorment.AppDomain();
|
|
|
MemoryStream assStream = new MemoryStream(assBytes);
|
|
MemoryStream assStream = new MemoryStream(assBytes);
|
|
|
MemoryStream pdbStream = new MemoryStream(pdbBytes);
|
|
MemoryStream pdbStream = new MemoryStream(pdbBytes);
|
|
|
appDomain.LoadAssembly(assStream, pdbStream, new ILRuntime.Mono.Cecil.Pdb.PdbReaderProvider());
|
|
appDomain.LoadAssembly(assStream, pdbStream, new ILRuntime.Mono.Cecil.Pdb.PdbReaderProvider());
|