Browse Source

Refactor.

tags/3.4
Eusth 5 years ago
parent
commit
6869e584fe
1 changed files with 15 additions and 1 deletions
  1. +15
    -1
      IPA/PatchContext.cs

+ 15
- 1
IPA/PatchContext.cs View File

@@ -49,7 +49,7 @@ namespace IPA
context.ProjectName = Path.GetFileNameWithoutExtension(context.Executable);
context.DataPathDst = Path.Combine(context.ProjectRoot, context.ProjectName + "_Data");
context.ManagedPath = Path.Combine(context.DataPathDst, "Managed");
context.EngineFile = Path.Combine(context.ManagedPath, (File.Exists(Path.Combine(context.ManagedPath, "UnityEngine.CoreModule.dll")) ? "UnityEngine.CoreModule.dll" : "UnityEngine.dll"));
context.EngineFile = DetermineEngineFile(context.ManagedPath, "UnityEngine.dll", "UnityEngine.CoreModule.dll");
context.AssemblyFile = Path.Combine(context.ManagedPath, "Assembly-Csharp.dll");
context.BackupPath = Path.Combine(Path.Combine(context.IPARoot, "Backups"), context.ProjectName);
string shortcutName = string.Format("{0} (Patch & Launch)", context.ProjectName);
@@ -59,5 +59,19 @@ namespace IPA

return context;
}

private static string DetermineEngineFile(string basePath, params string[] candidates)
{
foreach(var candidate in candidates)
{
var fullPath = Path.Combine(basePath, candidate);
if(File.Exists(fullPath))
{
return fullPath;
}
}

throw new FileNotFoundException("Could not find engine DLL!");
}
}
}

Loading…
Cancel
Save