mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
syntax
This commit is contained in:
parent
9db804467c
commit
20be56079c
@ -155,29 +155,26 @@ 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
|
// read assembly from stream with parameters
|
||||||
using (DefaultAssemblyResolver asmResolver = new DefaultAssemblyResolver())
|
using (DefaultAssemblyResolver asmResolver = new DefaultAssemblyResolver())
|
||||||
|
using (AssemblyDefinition asmDef = AssemblyDefinition.ReadAssembly(stream, new ReaderParameters{ ReadWrite = true, ReadSymbols = true, AssemblyResolver = asmResolver }))
|
||||||
{
|
{
|
||||||
// read assembly from stream with parameters
|
// add this assembly's path and unity's assembly path
|
||||||
using (AssemblyDefinition asmDef = AssemblyDefinition.ReadAssembly(stream, new ReaderParameters{ ReadWrite = true, ReadSymbols = true, AssemblyResolver = asmResolver }))
|
asmResolver.AddSearchDirectory(Path.GetDirectoryName(assemblyPath));
|
||||||
|
asmResolver.AddSearchDirectory(Helpers.UnityEngineDllDirectoryName());
|
||||||
|
|
||||||
|
// add dependencies
|
||||||
|
if (dependencies != null)
|
||||||
{
|
{
|
||||||
// add this assembly's path and unity's assembly path
|
foreach (string path in dependencies)
|
||||||
asmResolver.AddSearchDirectory(Path.GetDirectoryName(assemblyPath));
|
|
||||||
asmResolver.AddSearchDirectory(Helpers.UnityEngineDllDirectoryName());
|
|
||||||
|
|
||||||
// add dependencies
|
|
||||||
if (dependencies != null)
|
|
||||||
{
|
{
|
||||||
foreach (string path in dependencies)
|
asmResolver.AddSearchDirectory(path);
|
||||||
{
|
|
||||||
asmResolver.AddSearchDirectory(path);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// create weaver with logger
|
|
||||||
weaver = new Weaver(new CompilationFinishedLogger());
|
|
||||||
return weaver.Weave(asmDef);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// create weaver with logger
|
||||||
|
weaver = new Weaver(new CompilationFinishedLogger());
|
||||||
|
return weaver.Weave(asmDef);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user