Skip to content

Commit

Permalink
Force version set
Browse files Browse the repository at this point in the history
  • Loading branch information
papertoy1127 committed Sep 4, 2021
1 parent a6e28e8 commit e10fba9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
16 changes: 12 additions & 4 deletions EditorHelper/Main.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using ADOFAI;
Expand Down Expand Up @@ -51,12 +52,19 @@ internal static class Main {
// internal static UnityModManager.ModEntry.ModLogger Logger => _mod?.Logger;

private static bool Load(UnityModManager.ModEntry modEntry) {
var version = AccessTools.Field(typeof(GCNS), "releaseNumber").GetValue(null);

if (version == null || (int) version != 76) {
var version = AccessTools.Field(typeof(GCNS), "releaseNumber").GetValue(null) as int?;
var editorHelperDir = Path.Combine(Directory.GetCurrentDirectory(), "Mods", "EditorHelper");
var target = 76;
if (File.Exists(Path.Combine(editorHelperDir, "Version.txt"))) {
if (int.TryParse(File.ReadAllText(Path.Combine(editorHelperDir, "Version.txt")), out var value)) {
target = value;
UnityModManager.Logger.Log($"EditorHelper version set to {target}");
}
}
if (version == null || version != target) {
return false;
}

Settings = UnityModManager.ModSettings.Load<MainSettings>(modEntry);
Settings.moreEditorSettings_prev = Settings.moreEditorSettings;

Expand Down
2 changes: 1 addition & 1 deletion Info.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"Id": "EditorHelper",
"DisplayName": "ADOFAI Editor Helper",
"Author": "PatrickKR & PERIOT",
"Version": "1.4.0-r75",
"Version": "1.4.0-r76",
"AssemblyName": "EditorHelper.dll",
"EntryMethod": "EditorHelper.Main.Load"
}

0 comments on commit e10fba9

Please sign in to comment.