mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50: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
|
||||
{
|
||||
readonly string assemblyPath;
|
||||
InMemoryAssembly inMemoryAssembly;
|
||||
|
||||
public string Name => Path.GetFileNameWithoutExtension(assemblyPath);
|
||||
public string[] References { get; set; }
|
||||
public string[] Defines { get; set; }
|
||||
public InMemoryAssembly InMemoryAssembly { get; }
|
||||
|
||||
public CompiledAssemblyFromFile(string assemblyPath)
|
||||
{
|
||||
this.assemblyPath = assemblyPath;
|
||||
}
|
||||
|
||||
public InMemoryAssembly InMemoryAssembly
|
||||
{
|
||||
get
|
||||
{
|
||||
if (inMemoryAssembly == null)
|
||||
{
|
||||
byte[] peData = File.ReadAllBytes(assemblyPath);
|
||||
string pdbFileName = Path.GetFileNameWithoutExtension(assemblyPath) + ".pdb";
|
||||
byte[] pdbData = File.ReadAllBytes(Path.Combine(Path.GetDirectoryName(assemblyPath), pdbFileName));
|
||||
inMemoryAssembly = new InMemoryAssembly(peData, pdbData);
|
||||
}
|
||||
return inMemoryAssembly;
|
||||
}
|
||||
byte[] peData = File.ReadAllBytes(assemblyPath);
|
||||
string pdbFileName = Path.GetFileNameWithoutExtension(assemblyPath) + ".pdb";
|
||||
byte[] pdbData = File.ReadAllBytes(Path.Combine(Path.GetDirectoryName(assemblyPath), pdbFileName));
|
||||
InMemoryAssembly = new InMemoryAssembly(peData, pdbData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user