mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
comments
This commit is contained in:
parent
852ef64034
commit
08fdffd6ab
@ -155,17 +155,24 @@ static bool WeaveFromFile(string assemblyPath, string[] dependencies)
|
|||||||
// open the file as stream
|
// open the file as stream
|
||||||
using (FileStream stream = new FileStream(assemblyPath, FileMode.Open, FileAccess.ReadWrite))
|
using (FileStream stream = new FileStream(assemblyPath, FileMode.Open, FileAccess.ReadWrite))
|
||||||
{
|
{
|
||||||
|
// resolver for this assembly
|
||||||
using (DefaultAssemblyResolver asmResolver = new DefaultAssemblyResolver())
|
using (DefaultAssemblyResolver asmResolver = new DefaultAssemblyResolver())
|
||||||
{
|
{
|
||||||
|
// read assembly with the following parameters
|
||||||
ReaderParameters readerParameters = new ReaderParameters {
|
ReaderParameters readerParameters = new ReaderParameters {
|
||||||
ReadWrite = true,
|
ReadWrite = true,
|
||||||
ReadSymbols = true,
|
ReadSymbols = true,
|
||||||
AssemblyResolver = asmResolver
|
AssemblyResolver = asmResolver
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// read assembly from stream with parameters
|
||||||
using (AssemblyDefinition asmDef = AssemblyDefinition.ReadAssembly(stream, readerParameters))
|
using (AssemblyDefinition asmDef = AssemblyDefinition.ReadAssembly(stream, readerParameters))
|
||||||
{
|
{
|
||||||
|
// add this assembly's path and unity's assembly path
|
||||||
asmResolver.AddSearchDirectory(Path.GetDirectoryName(assemblyPath));
|
asmResolver.AddSearchDirectory(Path.GetDirectoryName(assemblyPath));
|
||||||
asmResolver.AddSearchDirectory(Helpers.UnityEngineDllDirectoryName());
|
asmResolver.AddSearchDirectory(Helpers.UnityEngineDllDirectoryName());
|
||||||
|
|
||||||
|
// add dependencies
|
||||||
if (dependencies != null)
|
if (dependencies != null)
|
||||||
{
|
{
|
||||||
foreach (string path in dependencies)
|
foreach (string path in dependencies)
|
||||||
|
Loading…
Reference in New Issue
Block a user