forked from Unity-Technologies/com.unity.netcode.gameobjects
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathILPostProcessCompiledAssembly.cs
More file actions
42 lines (37 loc) · 1.35 KB
/
ILPostProcessCompiledAssembly.cs
File metadata and controls
42 lines (37 loc) · 1.35 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
#if !UNITY_2020_2_OR_NEWER
using System.IO;
using Unity.CompilationPipeline.Common.ILPostProcessing;
namespace MLAPI.Editor.CodeGen
{
internal class ILPostProcessCompiledAssembly : ICompiledAssembly
{
private readonly string m_AssemblyFilename;
private readonly string m_OutputPath;
private InMemoryAssembly m_InMemoryAssembly;
public ILPostProcessCompiledAssembly(string asmName, string[] refs, string[] defines, string outputPath)
{
m_AssemblyFilename = asmName;
Name = Path.GetFileNameWithoutExtension(m_AssemblyFilename);
References = refs;
Defines = defines;
m_OutputPath = outputPath;
}
public string Name { get; }
public string[] References { get; }
public string[] Defines { get; }
public InMemoryAssembly InMemoryAssembly
{
get
{
if (m_InMemoryAssembly == null)
{
m_InMemoryAssembly = new InMemoryAssembly(
File.ReadAllBytes(Path.Combine(m_OutputPath, m_AssemblyFilename)),
File.ReadAllBytes(Path.Combine(m_OutputPath, $"{Path.GetFileNameWithoutExtension(m_AssemblyFilename)}.pdb")));
}
return m_InMemoryAssembly;
}
}
}
}
#endif