diff --git a/OWML.Launcher/App.cs b/OWML.Launcher/App.cs index d413e4998..7a359523f 100644 --- a/OWML.Launcher/App.cs +++ b/OWML.Launcher/App.cs @@ -12,9 +12,8 @@ namespace OWML.Launcher { public class App { - private const string Version = "0.3.42"; - private readonly IOwmlConfig _owmlConfig; + private readonly IModManifest _owmlManifest; private readonly IModConsole _writer; private readonly IModFinder _modFinder; private readonly OutputListener _listener; @@ -23,10 +22,11 @@ public class App private readonly VRPatcher _vrPatcher; private readonly CheckVersion _checkVersion; - public App(IOwmlConfig owmlConfig, IModConsole writer, IModFinder modFinder, + public App(IOwmlConfig owmlConfig, IModManifest owmlManifest, IModConsole writer, IModFinder modFinder, OutputListener listener, PathFinder pathFinder, OWPatcher owPatcher, VRPatcher vrPatcher, CheckVersion checkVersion) { _owmlConfig = owmlConfig; + _owmlManifest = owmlManifest; _writer = writer; _modFinder = modFinder; _listener = listener; @@ -38,7 +38,7 @@ public App(IOwmlConfig owmlConfig, IModConsole writer, IModFinder modFinder, public void Run(string[] args) { - _writer.WriteLine($"Started OWML v{Version}"); + _writer.WriteLine($"Started OWML v{_owmlManifest.Version}"); CheckVersion(); @@ -70,7 +70,7 @@ private void CheckVersion() _writer.WriteLine("Warning: could not check latest OWML version."); return; } - if (Version == latestVersion) + if (_owmlManifest.Version == latestVersion) { _writer.WriteLine("OWML is up to date."); return; @@ -133,7 +133,7 @@ private void ShowModList(IList mods) private bool IsMadeForSameOwmlMajorVersion(IModManifest manifest) { - var owmlVersionSplit = Version.Split('.'); + var owmlVersionSplit = _owmlManifest.Version.Split('.'); var modVersionSplit = manifest.OWMLVersion.Split('.'); return owmlVersionSplit.Length == modVersionSplit.Length && owmlVersionSplit[0] == modVersionSplit[0] && diff --git a/OWML.Launcher/OWML.Launcher.csproj b/OWML.Launcher/OWML.Launcher.csproj index a2130a3a3..8e5d1dcd3 100644 --- a/OWML.Launcher/OWML.Launcher.csproj +++ b/OWML.Launcher/OWML.Launcher.csproj @@ -59,6 +59,9 @@ + + Always + Always diff --git a/OWML.Launcher/OWML.Manifest.json b/OWML.Launcher/OWML.Manifest.json new file mode 100644 index 000000000..dbc15d1b7 --- /dev/null +++ b/OWML.Launcher/OWML.Manifest.json @@ -0,0 +1,6 @@ +{ + "author": "Alek", + "name": "OWML", + "uniqueName": "Alek.OWML", + "version": "0.3.43" +} \ No newline at end of file diff --git a/OWML.Launcher/Program.cs b/OWML.Launcher/Program.cs index a059eaa67..05fe13868 100644 --- a/OWML.Launcher/Program.cs +++ b/OWML.Launcher/Program.cs @@ -14,6 +14,7 @@ public class Program static void Main(string[] args) { var owmlConfig = GetOwmlConfig(); + var owmlManifest = GetOwmlManifest(); var writer = new OutputWriter(); var modFinder = new ModFinder(owmlConfig, writer); var outputListener = new OutputListener(owmlConfig); @@ -21,19 +22,29 @@ static void Main(string[] args) var owPatcher = new OWPatcher(owmlConfig, writer); var vrPatcher = new VRPatcher(owmlConfig, writer); var checkVersion = new CheckVersion(writer); - var app = new App(owmlConfig, writer, modFinder, outputListener, pathFinder, owPatcher, vrPatcher, checkVersion); + var app = new App(owmlConfig, owmlManifest, writer, modFinder, outputListener, pathFinder, owPatcher, vrPatcher, checkVersion); app.Run(args); } private static IOwmlConfig GetOwmlConfig() { - var json = File.ReadAllText("OWML.Config.json") - .Replace("\\\\", "/") - .Replace("\\", "/"); - var config = JsonConvert.DeserializeObject(json); + var config = GetJsonObject("OWML.Config.json"); config.OWMLPath = AppDomain.CurrentDomain.BaseDirectory; return config; } + private static IModManifest GetOwmlManifest() + { + return GetJsonObject("OWML.Manifest.json"); + } + + private static T GetJsonObject(string filename) + { + var json = File.ReadAllText(filename) + .Replace("\\\\", "/") + .Replace("\\", "/"); + return JsonConvert.DeserializeObject(json); + } + } } diff --git a/createrelease.bat b/createrelease.bat index 602c37455..858f2a6ca 100644 --- a/createrelease.bat +++ b/createrelease.bat @@ -8,6 +8,7 @@ copy "OWML.Patcher\bin\Debug\OWML.Patcher.dll" "Release\OWML.Patcher.dll" copy "OWML.ModLoader\bin\Debug\OWML.ModLoader.dll" "Release\OWML.ModLoader.dll" copy "OWML.Launcher\bin\Debug\OWML.Launcher.exe" "Release\OWML.Launcher.exe" copy "OWML.Launcher\bin\Debug\OWML.Config.json" "Release\OWML.Config.json" +copy "OWML.Launcher\bin\Debug\OWML.Manifest.json" "Release\OWML.Manifest.json" copy "OWML.Patcher\dnpatch\dnpatch.dll" "Release\dnpatch.dll" copy "OWML.Patcher\dnpatch\dnlib.dll" "Release\dnlib.dll" copy "OWML.Patcher\VR\*" "Release\VR\"