mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
CompiledAssemblyFromFile simplified
This commit is contained in:
parent
523fcdec88
commit
e481a3fba5
@ -13,30 +13,19 @@ namespace Mirror.Weaver
|
|||||||
public class CompiledAssemblyFromFile : ICompiledAssembly
|
public class CompiledAssemblyFromFile : ICompiledAssembly
|
||||||
{
|
{
|
||||||
readonly string assemblyPath;
|
readonly string assemblyPath;
|
||||||
InMemoryAssembly inMemoryAssembly;
|
|
||||||
|
|
||||||
public string Name => Path.GetFileNameWithoutExtension(assemblyPath);
|
public string Name => Path.GetFileNameWithoutExtension(assemblyPath);
|
||||||
public string[] References { get; set; }
|
public string[] References { get; set; }
|
||||||
public string[] Defines { get; set; }
|
public string[] Defines { get; set; }
|
||||||
|
public InMemoryAssembly InMemoryAssembly { get; }
|
||||||
|
|
||||||
public CompiledAssemblyFromFile(string assemblyPath)
|
public CompiledAssemblyFromFile(string assemblyPath)
|
||||||
{
|
{
|
||||||
this.assemblyPath = assemblyPath;
|
this.assemblyPath = assemblyPath;
|
||||||
}
|
|
||||||
|
|
||||||
public InMemoryAssembly InMemoryAssembly
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (inMemoryAssembly == null)
|
|
||||||
{
|
|
||||||
byte[] peData = File.ReadAllBytes(assemblyPath);
|
byte[] peData = File.ReadAllBytes(assemblyPath);
|
||||||
string pdbFileName = Path.GetFileNameWithoutExtension(assemblyPath) + ".pdb";
|
string pdbFileName = Path.GetFileNameWithoutExtension(assemblyPath) + ".pdb";
|
||||||
byte[] pdbData = File.ReadAllBytes(Path.Combine(Path.GetDirectoryName(assemblyPath), pdbFileName));
|
byte[] pdbData = File.ReadAllBytes(Path.Combine(Path.GetDirectoryName(assemblyPath), pdbFileName));
|
||||||
inMemoryAssembly = new InMemoryAssembly(peData, pdbData);
|
InMemoryAssembly = new InMemoryAssembly(peData, pdbData);
|
||||||
}
|
|
||||||
return inMemoryAssembly;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user