forked from JasonXuDeveloper/Nino
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Test11.cs
31 lines (29 loc) · 1.11 KB
/
Test11.cs
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
#if ILRuntime
using System.IO;
using Nino.Shared.Util;
using Nino.Serialization;
using ILRuntime.Runtime.Enviorment;
// ReSharper disable RedundantTypeArgumentsOfMethod
namespace Nino.Test.Editor.Serialization
{
public class Test11
{
private const string SerializationTest11 = "Nino/Test/Serialization/Test11 - ILRuntime";
#if UNITY_2017_1_OR_NEWER
[UnityEditor.MenuItem(SerializationTest11, priority=11)]
#endif
public static void Main()
{
var buf = File.ReadAllBytes("Assets/Nino/Test/Editor/Serialization/Test11.bytes");
AppDomain domain = new AppDomain();
domain.LoadAssembly(new MemoryStream(buf));
ILRuntimeResolver.RegisterILRuntimeClrRedirection(domain);
var ret = (byte[])domain.Invoke("Test.Test11", "TestSerialize", null);
Logger.D($"Serialized as {ret.Length} bytes, {string.Join(",",ret)}");
var dd = (string)domain.Invoke("Test.Test11", "TestDeserialize", null, ret);
Logger.D($"Deserialized as: {dd}");
}
}
}
// ReSharper restore RedundantTypeArgumentsOfMethod
#endif