-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from CitiesSkylinesMods/v1.1
Compatibility improvements with Harmony mod
- Loading branch information
Showing
5 changed files
with
53 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using System; | ||
using System.Reflection; | ||
using ColossalFramework.UI; | ||
using HarmonyLib; | ||
using UnityEngine; | ||
|
||
namespace TrolleybusTrailerMod { | ||
public static class Patcher { | ||
private const string HarmonyId = "krzychu124.trolleybus.trailer.ai"; | ||
private static bool patched; | ||
public static void PatchAll() { | ||
try { | ||
Harmony harmony = new Harmony(HarmonyId); | ||
harmony.PatchAll(Assembly.GetExecutingAssembly()); | ||
Debug.Log("[Trolleybus Trailer AI] Patches applied correctly"); | ||
patched = true; | ||
} catch (Exception e) { | ||
Debug.LogError("[Trolleybus Trailer AI] Exception while patching game:\n" + e); | ||
UIView.library | ||
.ShowModal<ExceptionPanel>( | ||
"ExceptionPanel") | ||
.SetMessage( | ||
"Trolleybus Trailer AI ", | ||
"Something went wrong while patching. :(\nMod will not work correctly. Contact author for support.", | ||
true); | ||
} | ||
} | ||
|
||
public static void UnPatchAll() { | ||
if (!patched) return; | ||
Harmony harmony = new Harmony(HarmonyId); | ||
harmony.UnpatchAll(HarmonyId ); | ||
patched = false; | ||
Debug.Log("[Trolleybus Trailer AI] UnPatched successfully"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="CitiesHarmony.API" version="1.0.5" targetFramework="net35" /> | ||
<package id="Lib.Harmony" version="2.0.1" targetFramework="net35" /> | ||
<package id="CitiesHarmony.API" version="1.0.6" targetFramework="net35" /> | ||
<package id="Lib.Harmony" version="2.0.4" targetFramework="net35" /> | ||
</packages> |