Simplify method signature

This commit is contained in:
Paul Pacheco 2020-09-22 11:56:54 -05:00
parent fdc21582db
commit a126bfd4dd
2 changed files with 8 additions and 8 deletions

View File

@ -142,9 +142,11 @@ static void OnCompilationFinished(string assemblyPath, CompilerMessage[] message
}
HashSet<string> dependencyPaths = GetDependecyPaths(assemblyPath);
dependencyPaths.Add(Path.GetDirectoryName(mirrorRuntimeDll));
dependencyPaths.Add(Path.GetDirectoryName(unityEngineCoreModuleDLL));
// passing null in the outputDirectory param will do an in-place update of the assembly
if (Weaver.Process(unityEngineCoreModuleDLL, mirrorRuntimeDll, assemblyPath, dependencyPaths.ToArray(), HandleWarning, HandleError))
if (Weaver.Process(assemblyPath, dependencyPaths.ToArray(), HandleWarning, HandleError))
{
// NOTE: WeaveFailed is critical for unit tests but isn't used elsewhere
WeaveFailed = false;

View File

@ -281,15 +281,13 @@ static bool WeaveModule(ModuleDefinition moduleDefinition)
}
}
static bool Weave(string assName, IEnumerable<string> dependencies, string unityEngineDLLPath, string mirrorNetDLLPath)
static bool Weave(string assName, IEnumerable<string> dependencies)
{
using (DefaultAssemblyResolver asmResolver = new DefaultAssemblyResolver())
using (CurrentAssembly = AssemblyDefinition.ReadAssembly(assName, new ReaderParameters { ReadWrite = true, ReadSymbols = true, AssemblyResolver = asmResolver }))
{
asmResolver.AddSearchDirectory(Path.GetDirectoryName(assName));
asmResolver.AddSearchDirectory(Helpers.UnityEngineDllDirectoryName());
asmResolver.AddSearchDirectory(Path.GetDirectoryName(unityEngineDLLPath));
asmResolver.AddSearchDirectory(Path.GetDirectoryName(mirrorNetDLLPath));
if (dependencies != null)
{
foreach (string path in dependencies)
@ -325,14 +323,14 @@ static bool Weave(string assName, IEnumerable<string> dependencies, string unity
return true;
}
static bool WeaveAssembly(string assembly, IEnumerable<string> dependencies, string unityEngineDLLPath, string mirrorNetDLLPath)
static bool WeaveAssembly(string assembly, IEnumerable<string> dependencies)
{
WeavingFailed = false;
WeaveLists = new WeaverLists();
try
{
return Weave(assembly, dependencies, unityEngineDLLPath, mirrorNetDLLPath);
return Weave(assembly, dependencies);
}
catch (Exception e)
{
@ -342,11 +340,11 @@ static bool WeaveAssembly(string assembly, IEnumerable<string> dependencies, str
}
public static bool Process(string unityEngine, string netDLL, string assembly, string[] extraAssemblyPaths, Action<string> printWarning, Action<string> printError)
public static bool Process(string assembly, string[] extraAssemblyPaths, Action<string> printWarning, Action<string> printError)
{
Log.WarningMethod = printWarning;
Log.ErrorMethod = printError;
return WeaveAssembly(assembly, extraAssemblyPaths, unityEngine, netDLL);
return WeaveAssembly(assembly, extraAssemblyPaths);
}
}
}