Skip to content

Commit

Permalink
improve debug for harmony. (#933)
Browse files Browse the repository at this point in the history
  • Loading branch information
kianzarrin committed Jun 12, 2020
1 parent c10f957 commit 63eedc0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
12 changes: 6 additions & 6 deletions TLM/TLM/Patcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ public void Install() {
Log.Info($"Harmony attribute-driven patching successfull!");
}
catch (Exception e) {
Log.Error("Could not deploy Harmony patches");
Log.Info(e.Message);
Log.Info(e.StackTrace);
Log.Error("Could not apply Harmony patches because the following exception occured:\n " +
e +
"\n -- End of inner exception stack trace -- ");
fail = true;
}

Expand All @@ -49,9 +49,9 @@ public void Install() {
AssemblyRedirector.Deploy();
}
catch (Exception e) {
Log.Error("Could not deploy attribute-driven detours");
Log.Info(e.ToString());
Log.Info(e.StackTrace);
Log.Error("Could not deploy attribute-driven detours because the following exception occured:\n "
+ e +
"\n -- End of inner exception stack trace -- ");
fail = true;
}

Expand Down
6 changes: 6 additions & 0 deletions TLM/TLM/TrafficManagerMod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ public void OnEnabled() {
InGameHotReload = InGame();

HarmonyHelper.EnsureHarmonyInstalled();

#if DEBUG
const bool installHarmonyASAP = false; // set true for fast testing
if (installHarmonyASAP)
HarmonyHelper.DoOnHarmonyReady(delegate () { Patcher.Create().Install(); });
#endif
}

[UsedImplicitly]
Expand Down

0 comments on commit 63eedc0

Please sign in to comment.